aboutsummaryrefslogtreecommitdiffstats
path: root/src/arch/x86/Makefile.inc
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@chromium.org>2015-04-04 15:50:20 +0200
committerStefan Reinauer <stefan.reinauer@coreboot.org>2015-04-06 19:14:00 +0200
commit828e0e86f3b7ddb7cde5daddc83be4386a4d43b1 (patch)
treebd8573ffb53ff1acc6d9c7b8fac86c876f4e04e3 /src/arch/x86/Makefile.inc
parentd126a749b86504a6f4c3a6c572fc8a3b14de6df9 (diff)
downloadcoreboot-828e0e86f3b7ddb7cde5daddc83be4386a4d43b1.tar.gz
coreboot-828e0e86f3b7ddb7cde5daddc83be4386a4d43b1.tar.xz
coreboot-828e0e86f3b7ddb7cde5daddc83be4386a4d43b1.zip
build system: run linker scripts through the preprocessor
This allows combining and simplifying linker scripts. This is inspired by the commit listed below, but rewritten to match upstream, and split in smaller pieces to keep intent clear. Change-Id: Ie5c11bd8495a399561cefde2f3e8dd300f4feb98 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Based-On-Change-Id: I50af7dacf616e0f8ff4c43f4acc679089ad7022b Based-On-Signed-off-by: Julius Werner <jwerner@chromium.org> Based-On-Reviewed-on: https://chromium-review.googlesource.com/219170 Reviewed-on: http://review.coreboot.org/9303 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/arch/x86/Makefile.inc')
-rw-r--r--src/arch/x86/Makefile.inc18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc
index e4af06d87..065b7778f 100644
--- a/src/arch/x86/Makefile.inc
+++ b/src/arch/x86/Makefile.inc
@@ -103,9 +103,9 @@ ifeq ($(CONFIG_SSE),y)
bootblock_romccflags := -mcpu=k7 -msse -O2 -D__PRE_RAM__ -D__BOOTBLOCK__
endif
-$(objgenerated)/bootblock.ld: $(obj)/ldoptions $$(filter %.ld,$$(bootblock-srcs))
+$(objgenerated)/bootblock.ld: $(obj)/config.h $$(filter %.ld,$$(bootblock-srcs))
@printf " GEN $(subst $(obj)/,,$(@))\n"
- printf '$(foreach ldscript,$(^),INCLUDE "$(ldscript)"\n)' > $@
+ printf '$(foreach ldscript,$(^),#include "$(ldscript)"\n)' | $(CC_bootblock) $(PREPROCESS_ONLY) - > $@
$(objgenerated)/bootblock_inc.S: $$(bootblock_inc)
@printf " GEN $(subst $(obj)/,,$(@))\n"
@@ -212,18 +212,18 @@ $(objcbfs)/romstage.debug: $$(romstage-objs) $(objgenerated)/romstage.ld $$(roms
@printf " LINK $(subst $(obj)/,,$(@))\n"
$(LD_romstage) --gc-sections -nostdlib -nostartfiles -static -o $@ -L$(obj) $(COMPILER_RT_FLAGS_romstage) --start-group $(filter-out %.ld,$(romstage-objs)) $(romstage-libs) $(COMPILER_RT_romstage) --end-group -T $(objgenerated)/romstage.ld
-$(objgenerated)/romstage_null.ld: $(obj)/ldoptions $$(filter %.ld,$$(romstage-srcs))
+$(objgenerated)/romstage_null.ld: $(obj)/config.h $$(filter %.ld,$$(romstage-srcs))
@printf " GEN $(subst $(obj)/,,$(@))\n"
rm -f $@
printf "ROMSTAGE_BASE = 0x0;\n" > $@.tmp
- printf '$(foreach ldscript,$(^),INCLUDE "$(ldscript)"\n)' >> $@.tmp
- mv $@.tmp $@
+ printf '$(foreach ldscript,$(^),#include "$(ldscript)"\n)' >> $@.tmp
+ $(CC_romstage) $(PREPROCESS_ONLY) $@.tmp > $@
$(objgenerated)/romstage.ld: $(objgenerated)/romstage_null.ld $(objcbfs)/base_xip.txt
@printf " GEN $(subst $(obj)/,,$(@))\n"
rm -f $@
sed -e 's/^/ROMSTAGE_BASE = /g' -e 's/$$/;/g' $(objcbfs)/base_xip.txt > $@.tmp
- sed -e '/ROMSTAGE_BASE/d' $(objgenerated)/romstage_null.ld >> $@.tmp
+ sed -e '/^ROMSTAGE_BASE/d' $(objgenerated)/romstage_null.ld >> $@.tmp
mv $@.tmp $@
$(objcbfs)/base_xip.txt: $(obj)/coreboot.pre1 $(objcbfs)/romstage_null.bin
@@ -299,9 +299,11 @@ $(objcbfs)/ramstage.elf: $(objcbfs)/ramstage.debug.rmod
else
-$(objcbfs)/ramstage.debug: $(objgenerated)/ramstage.o $(src)/arch/x86/ramstage.ld
+ramstage-srcs += $(src)/arch/x86/ramstage.ld
+
+$(objcbfs)/ramstage.debug: $(objgenerated)/ramstage.o $(obj)/arch/x86/ramstage.ramstage.ld
@printf " CC $(subst $(obj)/,,$(@))\n"
- $(LD_ramstage) --gc-sections -o $@ -L$(obj) $< -T $(src)/arch/x86/ramstage.ld
+ $(LD_ramstage) --gc-sections -o $@ -L$(obj) $< -T $(obj)/arch/x86/ramstage.ramstage.ld
endif