x86 makefile: Use preprocessed linker files

The top level Makefile runs the $stage-src .ld scripts through
the preprocessor and puts them in $(obj). Use the preprocessed
.ld files and cat them together into x86 romstage_null.ld.

Change-Id: If71240fbf7231df2b1333a1f8e5160cb8694f6ce
Signed-off-by: Marc Jones <marc.jones@se-eng.com>
Reviewed-on: http://review.coreboot.org/10743
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Marc Jones 2015-06-30 15:46:49 -06:00 committed by Patrick Georgi
parent 10ef872cdb
commit ac630f7070
1 changed files with 6 additions and 5 deletions

View File

@ -101,9 +101,10 @@ ifeq ($(CONFIG_SSE),y)
bootblock_romccflags := -mcpu=k7 -msse -O2 -D__PRE_RAM__ -D__BOOTBLOCK__ bootblock_romccflags := -mcpu=k7 -msse -O2 -D__PRE_RAM__ -D__BOOTBLOCK__
endif endif
$(objgenerated)/bootblock.ld: $(obj)/config.h $$(filter %.ld,$$(bootblock-srcs)) $(objgenerated)/bootblock.ld: $$(filter %.ld,$$(bootblock-objs))
@printf " GEN $(subst $(obj)/,,$(@))\n" @printf " GEN $(subst $(obj)/,,$(@))\n"
printf '$(foreach ldscript,$(^),#include "$(ldscript)"\n)' | $(CC_bootblock) $(PREPROCESS_ONLY) - > $@ cat $^ >> $@.tmp
mv $@.tmp $@
$(objgenerated)/bootblock_inc.S: $$(bootblock_inc) $(objgenerated)/bootblock_inc.S: $$(bootblock_inc)
@printf " GEN $(subst $(obj)/,,$(@))\n" @printf " GEN $(subst $(obj)/,,$(@))\n"
@ -220,12 +221,12 @@ $(objcbfs)/romstage.debug: $$(romstage-objs) $(objgenerated)/romstage.ld $$(roms
@printf " LINK $(subst $(obj)/,,$(@))\n" @printf " LINK $(subst $(obj)/,,$(@))\n"
$(LD_romstage) --gc-sections -nostdlib -nostartfiles -static -o $@ -L$(obj) $(COMPILER_RT_FLAGS_romstage) --whole-archive --start-group $(filter-out %.ld,$(romstage-objs)) $(romstage-libs) --no-whole-archive $(COMPILER_RT_romstage) --end-group -T $(objgenerated)/romstage.ld --oformat $(romstage-oformat) $(LD_romstage) --gc-sections -nostdlib -nostartfiles -static -o $@ -L$(obj) $(COMPILER_RT_FLAGS_romstage) --whole-archive --start-group $(filter-out %.ld,$(romstage-objs)) $(romstage-libs) --no-whole-archive $(COMPILER_RT_romstage) --end-group -T $(objgenerated)/romstage.ld --oformat $(romstage-oformat)
$(objgenerated)/romstage_null.ld: $(obj)/config.h $$(filter %.ld,$$(romstage-srcs)) $(objgenerated)/romstage_null.ld: $$(filter %.ld,$$(romstage-objs))
@printf " GEN $(subst $(obj)/,,$(@))\n" @printf " GEN $(subst $(obj)/,,$(@))\n"
rm -f $@ rm -f $@
printf "ROMSTAGE_BASE = 0x0;\n" > $@.tmp printf "ROMSTAGE_BASE = 0x0;\n" > $@.tmp
printf '$(foreach ldscript,$(^),#include "$(ldscript)"\n)' >> $@.tmp cat $^ >> $@.tmp
$(CC_romstage) $(PREPROCESS_ONLY) $@.tmp > $@ mv $@.tmp $@
$(objgenerated)/romstage.ld: $(objgenerated)/romstage_null.ld $(objcbfs)/base_xip.txt $(objgenerated)/romstage.ld: $(objgenerated)/romstage_null.ld $(objcbfs)/base_xip.txt
@printf " GEN $(subst $(obj)/,,$(@))\n" @printf " GEN $(subst $(obj)/,,$(@))\n"