summaryrefslogtreecommitdiffstats
path: root/src/arch/arm
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/arm
parentd126a749b86504a6f4c3a6c572fc8a3b14de6df9 (diff)
downloadcoreboot-828e0e86f3b7ddb7cde5daddc83be4386a4d43b1.tar.gz
coreboot-828e0e86f3b7ddb7cde5daddc83be4386a4d43b1.tar.bz2
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/arm')
-rw-r--r--src/arch/arm/Makefile.inc24
-rw-r--r--src/arch/arm/bootblock.ld2
-rw-r--r--src/arch/arm/ramstage.ld3
-rw-r--r--src/arch/arm/romstage.ld1
-rw-r--r--src/arch/arm/verstage.ld1
5 files changed, 16 insertions, 15 deletions
diff --git a/src/arch/arm/Makefile.inc b/src/arch/arm/Makefile.inc
index ffbc8413a75e..cd6c4a4e21d5 100644
--- a/src/arch/arm/Makefile.inc
+++ b/src/arch/arm/Makefile.inc
@@ -63,9 +63,11 @@ bootblock-y += memmove.S
bootblock-y += div0.c
bootblock-y += clock.c
-$(objcbfs)/bootblock.debug: $(src)/arch/arm/bootblock.ld $(obj)/ldoptions $$(bootblock-objs) $$(VERSTAGE_LIB)
+bootblock-y += bootblock.ld
+
+$(objcbfs)/bootblock.debug: $(obj)/arch/arm/bootblock.bootblock.ld $$(bootblock-objs) $$(VERSTAGE_LIB)
@printf " LINK $(subst $(obj)/,,$(@))\n"
- $(LD_bootblock) --gc-sections -static -o $@ -L$(obj) --start-group $(bootblock-objs) --end-group -T $(src)/arch/arm/bootblock.ld
+ $(LD_bootblock) --gc-sections -static -o $@ -L$(obj) -T $(obj)/arch/arm/bootblock.bootblock.ld --start-group $(bootblock-objs) --end-group
endif # CONFIG_ARCH_BOOTBLOCK_ARM
@@ -73,9 +75,9 @@ endif # CONFIG_ARCH_BOOTBLOCK_ARM
# verification stage
###############################################################################
-$(objcbfs)/verstage.debug: $$(verstage-objs) $(src)/arch/arm/verstage.ld $(obj)/ldoptions $$(VB2_LIB)
+$(objcbfs)/verstage.debug: $$(verstage-objs) $(obj)/arch/arm/verstage.verstage.ld $$(VB2_LIB)
@printf " LINK $(subst $(obj)/,,$(@))\n"
- $(LD_verstage) --gc-sections -static -o $@ -L$(obj) --start-group $(verstage-objs) --end-group -T $(src)/arch/arm/verstage.ld
+ $(LD_verstage) --gc-sections -static -o $@ -L$(obj) -T $(obj)/arch/arm/verstage.verstage.ld --start-group $(verstage-objs) --end-group
verstage-y += div0.c
verstage-y += eabi_compat.c
@@ -84,6 +86,8 @@ verstage-y += memcpy.S
verstage-y += memmove.S
verstage-y += stages.c
+verstage-y += verstage.ld
+
###############################################################################
# romstage
###############################################################################
@@ -103,11 +107,13 @@ rmodules_arm-y += memcpy.S
rmodules_arm-y += memmove.S
rmodules_arm-y += eabi_compat.c
+romstage-y += romstage.ld
+
VBOOT_STUB_DEPS += $(obj)/arch/arm/eabi_compat.rmodules_arm.o
-$(objcbfs)/romstage.debug: $$(romstage-objs) $(src)/arch/arm/romstage.ld $(obj)/ldoptions
+$(objcbfs)/romstage.debug: $$(romstage-objs) $(obj)/arch/arm/romstage.romstage.ld
@printf " LINK $(subst $(obj)/,,$(@))\n"
- $(LD_romstage) -nostdlib --gc-sections -static -o $@ -L$(obj) --start-group $(romstage-objs) --end-group -T $(src)/arch/arm/romstage.ld
+ $(LD_romstage) -nostdlib --gc-sections -static -o $@ -L$(obj) -T $(obj)/arch/arm/romstage.romstage.ld --start-group $(romstage-objs) --end-group
endif # CONFIG_ARCH_ROMSTAGE_ARM
@@ -133,9 +139,11 @@ rmodules_arm-y += memmove.S
rmodules_arm-y += eabi_compat.c
ramstage-srcs += $(wildcard src/mainboard/$(MAINBOARDDIR)/mainboard.c)
-$(objcbfs)/ramstage.debug: $$(ramstage-objs) $(src)/arch/arm/ramstage.ld $(obj)/ldoptions
+ramstage-y += ramstage.ld
+
+$(objcbfs)/ramstage.debug: $$(ramstage-objs) $(obj)/arch/arm/ramstage.ramstage.ld
@printf " CC $(subst $(obj)/,,$(@))\n"
- $(LD_ramstage) -nostdlib --gc-sections -o $@ -L$(obj) --start-group $(ramstage-objs) --end-group -T $(src)/arch/arm/ramstage.ld
+ $(LD_ramstage) -nostdlib --gc-sections -o $@ -L$(obj) -T $(obj)/arch/arm/ramstage.ramstage.ld --start-group $(ramstage-objs) --end-group
$(objgenerated)/ramstage.o: $(stages_o) $$(ramstage-objs)
@printf " CC $(subst $(obj)/,,$(@))\n"
diff --git a/src/arch/arm/bootblock.ld b/src/arch/arm/bootblock.ld
index 23d66f1e7655..091e3ebdd6bc 100644
--- a/src/arch/arm/bootblock.ld
+++ b/src/arch/arm/bootblock.ld
@@ -21,7 +21,6 @@
/* We use ELF as output format. So that we can debug the code in some form. */
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
-INCLUDE ldoptions
PHDRS
{
@@ -29,7 +28,6 @@ PHDRS
}
ENTRY(_start)
-TARGET(binary)
SECTIONS
{
. = CONFIG_BOOTBLOCK_BASE;
diff --git a/src/arch/arm/ramstage.ld b/src/arch/arm/ramstage.ld
index 5e0607d9a793..7daa8cbbb899 100644
--- a/src/arch/arm/ramstage.ld
+++ b/src/arch/arm/ramstage.ld
@@ -19,9 +19,6 @@
* 2005.12 yhlu add ramstage cross the vga font buffer handling
*/
-/* We use ELF as output format. So that we can debug the code in some form. */
-INCLUDE ldoptions
-
ENTRY(stage_entry)
PHDRS
diff --git a/src/arch/arm/romstage.ld b/src/arch/arm/romstage.ld
index 873b8e0012eb..d107687c901b 100644
--- a/src/arch/arm/romstage.ld
+++ b/src/arch/arm/romstage.ld
@@ -22,7 +22,6 @@
/* We use ELF as output format. So that we can debug the code in some form. */
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
-INCLUDE ldoptions
ENTRY(stage_entry)
diff --git a/src/arch/arm/verstage.ld b/src/arch/arm/verstage.ld
index f0e88e590217..88d4bc8dfb03 100644
--- a/src/arch/arm/verstage.ld
+++ b/src/arch/arm/verstage.ld
@@ -10,7 +10,6 @@
/* We use ELF as output format. So that we can debug the code in some form. */
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
-INCLUDE ldoptions
PHDRS
{