Patrick Georgi (pgeorgi@google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7307
-gerrit
commit 90c6f69ae987d51cabacdfcbadbde80168103b93 Author: Patrick Georgi pgeorgi@google.com Date: Sat Nov 1 00:02:50 2014 +0100
x86 romstage.ld: handle the AGESA special case in the linker script
Move the .illegal_globals definition lower in the romstage linker script to make some versions of ld happy.
Also add a special case for AGESA files (which host a bunch of globals that could be const, but aren't) here, so they're ignored from the start instead of failing the test, then have the Makefile ignore the test result.
Change-Id: Ib533b7516135d2d3cab2bfda50d69c132c68e261 Signed-off-by: Patrick Georgi pgeorgi@google.com --- src/arch/x86/Makefile.inc | 2 +- src/arch/x86/init/romstage.ld | 28 +++++++++++++++------------- 2 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc index 7ca3ca4..55266f6 100644 --- a/src/arch/x86/Makefile.inc +++ b/src/arch/x86/Makefile.inc @@ -217,7 +217,7 @@ endif $(OBJCOPY_romstage) --only-section .illegal_globals $(@) $(objcbfs)/romstage_null.offenders && \ $(NM_romstage) $(objcbfs)/romstage_null.offenders | grep -q ""; if [ $$? -eq 0 ]; then \ echo "Forbidden global variables in romstage:"; \ - $(NM_romstage) $(objcbfs)/romstage_null.offenders; test "$(CONFIG_CPU_AMD_AGESA)" = y; \ + $(NM_romstage) $(objcbfs)/romstage_null.offenders; false; \ else true; fi
$(objcbfs)/romstage_xip.debug: $$(romstage-objs) $(objgenerated)/romstage_xip.ld $$(romstage-libs) diff --git a/src/arch/x86/init/romstage.ld b/src/arch/x86/init/romstage.ld index f4a4dde..56b096e 100644 --- a/src/arch/x86/init/romstage.ld +++ b/src/arch/x86/init/romstage.ld @@ -43,19 +43,6 @@ SECTIONS _erom = .; }
- /* Global variables are not allowed in romstage - * This section is checked during stage creation to ensure - * that there are no global variables present - */ - .illegal_globals . : { - *(.data) - *(.data.*) - *(.bss) - *(.bss.*) - *(.sbss) - *(.sbss.*) - } - /DISCARD/ : { *(.comment) *(.note) @@ -78,5 +65,20 @@ SECTIONS preram_cbmem_console = .; }
+ /* Global variables are not allowed in romstage + * This section is checked during stage creation to ensure + * that there are no global variables present + */ + + . = 0xffffff00; + .illegal_globals . : { + *(EXCLUDE_FILE (*/libagesa.*.a: */buildOpts.romstage.o */agesawrapper.romstage.o) .data) + *(.data.*) + *(.bss) + *(.bss.*) + *(.sbss) + *(.sbss.*) + } + _bogus = ASSERT((SIZEOF(.car.data) + CONFIG_CONSOLE_PRERAM_BUFFER_SIZE <= CONFIG_DCACHE_RAM_SIZE), "Cache as RAM area is too full"); }