[coreboot-gerrit] Patch set updated for coreboot: x86: Move architecture selection from linker script to Makefile.inc

Stefan Reinauer (stefan.reinauer@coreboot.org) gerrit at coreboot.org
Sat Jun 20 20:29:04 CEST 2015


Stefan Reinauer (stefan.reinauer at coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10590

-gerrit

commit 67b88f358c4e8b941371d6789e1ef26e0987cd05
Author: Stefan Reinauer <stefan.reinauer at coreboot.org>
Date:   Thu Jun 18 21:59:34 2015 -0700

    x86: Move architecture selection from linker script to Makefile.inc
    
    Change-Id: I5efd3cb3e6970b5740f740507244a1ab823e0bb6
    Signed-off-by: Stefan Reinauer <stefan.reinauer at coreboot.org>
---
 src/arch/x86/Makefile.inc     | 14 ++++++++++----
 src/arch/x86/init/failover.ld |  4 ----
 src/arch/x86/init/romstage.ld |  4 ----
 3 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc
index 7e10acb..f4c5dda 100644
--- a/src/arch/x86/Makefile.inc
+++ b/src/arch/x86/Makefile.inc
@@ -126,9 +126,9 @@ $(objgenerated)/bootblock.inc: $(src)/arch/x86/init/$(subst ",,$(CONFIG_BOOTBLOC
 $(objcbfs)/bootblock.debug: $(objgenerated)/bootblock.o $(objgenerated)/bootblock.ld
 	@printf "    LINK       $(subst $(obj)/,,$(@))\n"
 ifeq ($(CONFIG_ARCH_BOOTBLOCK_X86_32),y)
-	$(LD_bootblock) -m elf_i386 -static -o $@ -L$(obj) $< -T $(objgenerated)/bootblock.ld
+	$(LD_bootblock) -m elf_i386 --oformat elf32-i386 -static -o $@ -L$(obj) $< -T $(objgenerated)/bootblock.ld
 else
-	$(LD_bootblock) -m elf_x86_64 -static -o $@ -L$(obj) $< -T $(objgenerated)/bootblock.ld
+	$(LD_bootblock) -m elf_x86_64 --oformat elf64-x86-64 -static -o $@ -L$(obj) $< -T $(objgenerated)/bootblock.ld
 endif
 
 
@@ -201,9 +201,15 @@ romstage-srcs += $(objgenerated)/crt0.S
 
 romstage-libs ?=
 
+ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y)
+romstage-oformat=elf32-i386
+else
+romstage-oformat=elf64-x86-64
+endif
+
 $(objcbfs)/romstage_null.debug: $$(romstage-objs) $(objgenerated)/romstage_null.ld $$(romstage-libs)
 	@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_null.ld
+	$(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_null.ld --oformat $(romstage-oformat)
 	$(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:"; \
@@ -212,7 +218,7 @@ $(objcbfs)/romstage_null.debug: $$(romstage-objs) $(objgenerated)/romstage_null.
 
 $(objcbfs)/romstage.debug: $$(romstage-objs) $(objgenerated)/romstage.ld $$(romstage-libs)
 	@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
+	$(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))
 	@printf "    GEN        $(subst $(obj)/,,$(@))\n"
diff --git a/src/arch/x86/init/failover.ld b/src/arch/x86/init/failover.ld
index 5e4efa9..d7aa47e 100644
--- a/src/arch/x86/init/failover.ld
+++ b/src/arch/x86/init/failover.ld
@@ -18,10 +18,6 @@
  * Foundation, Inc.
  */
 
-/* We use ELF as output format. So that we can debug the code in some form. */
-OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
-OUTPUT_ARCH(i386)
-
 MEMORY {
 	rom : ORIGIN = 0xffff0000, LENGTH = 64K
 }
diff --git a/src/arch/x86/init/romstage.ld b/src/arch/x86/init/romstage.ld
index 74e665f..7b9cb6a 100644
--- a/src/arch/x86/init/romstage.ld
+++ b/src/arch/x86/init/romstage.ld
@@ -18,10 +18,6 @@
  * Foundation, Inc.
  */
 
-/* We use ELF as output format. So that we can debug the code in some form. */
-OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
-OUTPUT_ARCH(i386)
-
 TARGET(binary)
 SECTIONS
 {



More information about the coreboot-gerrit mailing list