From: Kevin O'Connor Date: Thu, 9 Apr 2009 01:10:08 +0000 (-0400) Subject: Rework linker scripts so they work on new version of ld. X-Git-Tag: rel-0.4.1~115 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=7cf17f2e436e466b52b67cca735397089ff78086;p=seabios.git Rework linker scripts so they work on new version of ld. Declare output sections with explicit start address - don't rely on LD using '.' for the start of the section. Make addresses that are absolute by using the ABSOLUTE() function. Discard .eh_frame - new gcc has this on by default. Also, don't use '-d' - instead use FORCE_COMMON_ALLOCATION. --- diff --git a/Makefile b/Makefile index 7d7dbeb..1df23b4 100644 --- a/Makefile +++ b/Makefile @@ -102,7 +102,7 @@ $(OUT)ccode32.o: ; $(call whole-compile, $(CFLAGS), $(addprefix src/, $(SRC32)), $(OUT)rom32.o: $(OUT)ccode32.o $(OUT)rombios32.lds @echo " Linking (no relocs) $@" - $(Q)$(LD) -r -d -T $(OUT)rombios32.lds $< -o $@ + $(Q)$(LD) -r -T $(OUT)rombios32.lds $< -o $@ $(OUT)romlayout.lds: $(OUT)romlayout16.o @echo " Building layout information $@" diff --git a/src/rombios.lds.S b/src/rombios.lds.S index e43822a..a6afe1f 100644 --- a/src/rombios.lds.S +++ b/src/rombios.lds.S @@ -16,5 +16,5 @@ SECTIONS *(.text16) final_code16_end = . ; } - /DISCARD/ : { *(.discard*) } + /DISCARD/ : { *(.discard*) *(.eh_frame) } } diff --git a/src/rombios16.lds.S b/src/rombios16.lds.S index c52afdb..a25392c 100644 --- a/src/rombios16.lds.S +++ b/src/rombios16.lds.S @@ -10,17 +10,15 @@ OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") OUTPUT_ARCH("i386") SECTIONS { - . = ( _code32_code32_end - BUILD_BIOS_ADDR ) ; - . = ALIGN(16) ; - code16_start = . ; - .text16 : { + .text16 ALIGN(_code32_code32_end - _code32_code32_start, 16) : { + code16_start = ABSOLUTE(.) ; // The actual placement of the 16bit sections is determined by the // script tools/layoutrom.py #include "../out/romlayout.lds" + code16_end = ABSOLUTE(.) ; } - code16_end = . ; // Discard regular data sections to force a link error if // 16bit code attempts to access data not marked with VAR16. diff --git a/src/rombios32.lds.S b/src/rombios32.lds.S index 4aa88f0..311da25 100644 --- a/src/rombios32.lds.S +++ b/src/rombios32.lds.S @@ -8,17 +8,17 @@ OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") OUTPUT_ARCH("i386") +FORCE_COMMON_ALLOCATION SECTIONS { - . = BUILD_BIOS_ADDR ; - code32_start = . ; - .text : { + .text BUILD_BIOS_ADDR : { + code32_start = ABSOLUTE(.) ; *(.text) code32_rodata = . ; *(.rodata*) *(.data) *(.bss) *(COMMON) + code32_end = ABSOLUTE(.) ; } - code32_end = . ; }