[coreboot] New patch to review for coreboot: eb9de1d build system: Eliminate special case for c_start

Patrick Georgi (patrick@georgi-clan.de) gerrit at coreboot.org
Sun Nov 25 18:13:59 CET 2012


Patrick Georgi (patrick at georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1909

-gerrit

commit eb9de1deb223e876515ccef97289b461d800c56a
Author: Patrick Georgi <patrick at georgi-clan.de>
Date:   Sun Nov 25 17:31:25 2012 +0100

    build system: Eliminate special case for c_start
    
    c_start.o has a special case in the build system, which we can
    eliminate, somewhat simplifying the build.
    
    To ensure that the entry point is at the beginning, introduce a
    new section .textfirst that is placed appropriately. In principle
    the ENTRY() definition in the linker script should be enough, but
    better be safe.
    
    Change-Id: I9737f7f5731e12ceb2119eb432b0e09832bc53fa
    Signed-off-by: Patrick Georgi <patrick at georgi-clan.de>
---
 src/arch/x86/Makefile.inc    | 6 +++---
 src/arch/x86/coreboot_ram.ld | 1 +
 src/arch/x86/lib/c_start.S   | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc
index a7446df..2555280 100644
--- a/src/arch/x86/Makefile.inc
+++ b/src/arch/x86/Makefile.inc
@@ -161,12 +161,12 @@ else
 	$(CC) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(src)/arch/x86/coreboot_ram.ld $<
 endif
 
-$(objgenerated)/coreboot_ram.o: $(obj)/arch/x86/lib/c_start.ramstage.o $$(ramstage-objs) $(LIBGCC_FILE_NAME)
+$(objgenerated)/coreboot_ram.o: $$(ramstage-objs) $(LIBGCC_FILE_NAME)
 	@printf "    CC         $(subst $(obj)/,,$(@))\n"
 ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
-	$(LD) -m elf_i386 -r -o $@ $(obj)/arch/x86/lib/c_start.ramstage.o --wrap __divdi3 --wrap __udivdi3 --wrap __moddi3 --wrap __umoddi3 --start-group $(filter-out $(obj)/arch/x86/lib/c_start.ramstage.o,$(ramstage-objs)) $(LIBGCC_FILE_NAME) --end-group
+	$(LD) -m elf_i386 -r -o $@ --wrap __divdi3 --wrap __udivdi3 --wrap __moddi3 --wrap __umoddi3 --start-group $(ramstage-objs) $(LIBGCC_FILE_NAME) --end-group
 else
-	$(CC) -nostdlib -r -o $@ $(obj)/arch/x86/lib/c_start.ramstage.o -Wl,--wrap,__divdi3 -Wl,--wrap,__udivdi3 -Wl,--wrap,__moddi3 -Wl,--wrap,__umoddi3 -Wl,--start-group $(filter-out $(obj)/arch/x86/lib/c_start.ramstage.o,$(ramstage-objs)) $(LIBGCC_FILE_NAME) -Wl,--end-group
+	$(CC) -nostdlib -r -o $@ -Wl,--wrap,__divdi3 -Wl,--wrap,__udivdi3 -Wl,--wrap,__moddi3 -Wl,--wrap,__umoddi3 -Wl,--start-group $(ramstage-objs) $(LIBGCC_FILE_NAME) -Wl,--end-group
 endif
 
 ################################################################################
diff --git a/src/arch/x86/coreboot_ram.ld b/src/arch/x86/coreboot_ram.ld
index 57ddd03..a87a0e7 100644
--- a/src/arch/x86/coreboot_ram.ld
+++ b/src/arch/x86/coreboot_ram.ld
@@ -32,6 +32,7 @@ SECTIONS
 	 */
 	.text : {
 		_text = .;
+		*(.textfirst);
 		*(.text);
 		*(.text.*);
 		. = ALIGN(16);
diff --git a/src/arch/x86/lib/c_start.S b/src/arch/x86/lib/c_start.S
index a84724d..9a8b4ac 100644
--- a/src/arch/x86/lib/c_start.S
+++ b/src/arch/x86/lib/c_start.S
@@ -1,6 +1,6 @@
 #include <cpu/x86/post_code.h>
 
-	.section ".text"
+	.section ".textfirst"
 	.code32
 	.globl _start
 _start:




More information about the coreboot mailing list