diff options
author | Ian Lance Taylor <ian@airs.com> | 1997-05-12 15:12:12 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1997-05-12 15:12:12 +0000 |
commit | 3d046499bc8ad7c3f113386ac6e5481ac698ebd9 (patch) | |
tree | 63c0f7d5dbfa765dcf9a25025ec4e0a42da3076e | |
parent | 9af5dcea8f103c6385dc2244dfb654ad7c7e928d (diff) | |
download | gdb-3d046499bc8ad7c3f113386ac6e5481ac698ebd9.zip gdb-3d046499bc8ad7c3f113386ac6e5481ac698ebd9.tar.gz gdb-3d046499bc8ad7c3f113386ac6e5481ac698ebd9.tar.bz2 |
Mon May 12 11:11:06 1997 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* scripttempl/elf.sc: Don't align the data segment on the next 8
byte boundary, instead let the linker use whatever the individual
sections require.
-rw-r--r-- | ld/ChangeLog | 6 | ||||
-rw-r--r-- | ld/scripttempl/elf.sc | 87 |
2 files changed, 75 insertions, 18 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index b601fd6..e8dd495 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +Mon May 12 11:11:06 1997 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * scripttempl/elf.sc: Don't align the data segment on the next 8 + byte boundary, instead let the linker use whatever the individual + sections require. + Fri May 9 17:45:46 1997 Ian Lance Taylor <ian@cygnus.com> * configure.tgt (i[3456]86-*-gnu*): Don't include Mach support. diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc index 665af8e..27f2e9d 100644 --- a/ld/scripttempl/elf.sc +++ b/ld/scripttempl/elf.sc @@ -16,6 +16,7 @@ # OTHER_BSS_SYMBOLS - symbols that appear at the start of the # .bss section besides __bss_start. # DATA_PLT - .plt should be in data segment, not text segment. +# EMBEDDED - whether this is for an embedded system. # # When adding sections, do note that the names of some sections are used # when specifying the start address of the next. @@ -27,6 +28,14 @@ if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHI test "$LD_FLAG" = "N" && DATA_ADDR=. INTERP=".interp ${RELOCATING-0} : { *(.interp) }" PLT=".plt ${RELOCATING-0} : { *(.plt) }" + +# if this is for an embedded system, don't add SIZEOF_HEADERS. +if [ -z "$EMBEDDED" ]; then + test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR} + SIZEOF_HEADERS" +else + test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR}" +fi + cat <<EOF OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", "${LITTLE_OUTPUT_FORMAT}") @@ -44,18 +53,27 @@ ${RELOCATING- /* For some reason, the Solaris linker makes bad executables SECTIONS { /* Read-only sections, merged into text segment: */ - ${CREATE_SHLIB-${RELOCATING+. = ${TEXT_START_ADDR} + SIZEOF_HEADERS;}} + ${CREATE_SHLIB-${RELOCATING+. = ${TEXT_BASE_ADDRESS};}} ${CREATE_SHLIB+${RELOCATING+. = SIZEOF_HEADERS;}} ${CREATE_SHLIB-${INTERP}} .hash ${RELOCATING-0} : { *(.hash) } .dynsym ${RELOCATING-0} : { *(.dynsym) } .dynstr ${RELOCATING-0} : { *(.dynstr) } - .rel.text ${RELOCATING-0} : { *(.rel.text) } - .rela.text ${RELOCATING-0} : { *(.rela.text) } - .rel.data ${RELOCATING-0} : { *(.rel.data) } - .rela.data ${RELOCATING-0} : { *(.rela.data) } - .rel.rodata ${RELOCATING-0} : { *(.rel.rodata) } - .rela.rodata ${RELOCATING-0} : { *(.rela.rodata) } + .gnu.version ${RELOCATING-0} : { *(.gnu.version) } + .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) } + .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) } + .rel.text ${RELOCATING-0} : + { *(.rel.text) *(.rel.gnu.linkonce.t*) } + .rela.text ${RELOCATING-0} : + { *(.rela.text) *(.rela.gnu.linkonce.t*) } + .rel.data ${RELOCATING-0} : + { *(.rel.data) *(.rel.gnu.linkonce.d*) } + .rela.data ${RELOCATING-0} : + { *(.rela.data) *(.rela.gnu.linkonce.d*) } + .rel.rodata ${RELOCATING-0} : + { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } + .rela.rodata ${RELOCATING-0} : + { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } .rel.got ${RELOCATING-0} : { *(.rel.got) } .rela.got ${RELOCATING-0} : { *(.rela.got) } .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) } @@ -78,32 +96,43 @@ SECTIONS *(.text) /* .gnu.warning sections are handled specially by elf32.em. */ *(.gnu.warning) - *(.gnu.linkonce*) + *(.gnu.linkonce.t*) } =${NOP-0} ${RELOCATING+_etext = .;} ${RELOCATING+PROVIDE (etext = .);} .fini ${RELOCATING-0} : { *(.fini) } =${NOP-0} - .rodata ${RELOCATING-0} : { *(.rodata) } + .rodata ${RELOCATING-0} : { *(.rodata) *(.gnu.linkonce.r*) } .rodata1 ${RELOCATING-0} : { *(.rodata1) } ${RELOCATING+${OTHER_READONLY_SECTIONS}} /* Adjust the address for the data segment. We want to adjust up to the same address within the page on the next page up. */ - ${RELOCATING+. = ${DATA_ADDR-ALIGN(${MAXPAGESIZE}) + (ALIGN(8) & (${MAXPAGESIZE} - 1))};} + ${RELOCATING+. = ${DATA_ADDR-ALIGN(${MAXPAGESIZE}) + (. & (${MAXPAGESIZE} - 1))};} .data ${RELOCATING-0} : { ${RELOCATING+${DATA_START_SYMBOLS}} *(.data) + *(.gnu.linkonce.d*) ${CONSTRUCTING+CONSTRUCTORS} } .data1 ${RELOCATING-0} : { *(.data1) } ${RELOCATING+${OTHER_READWRITE_SECTIONS}} - .ctors ${RELOCATING-0} : { *(.ctors) } - .dtors ${RELOCATING-0} : { *(.dtors) } + .ctors ${RELOCATING-0} : + { + ${CONSTRUCTING+${CTOR_START}} + *(.ctors) + ${CONSTRUCTING+${CTOR_END}} + } + .dtors ${RELOCATING-0} : + { + ${CONSTRUCTING+${DTOR_START}} + *(.dtors) + ${CONSTRUCTING+${DTOR_END}} + } + ${DATA_PLT+${PLT}} .got ${RELOCATING-0} : { *(.got.plt) *(.got) } .dynamic ${RELOCATING-0} : { *(.dynamic) } - ${DATA_PLT+${PLT}} /* We want the small data sections together, so single-instruction offsets can access them all, and initialized data all before uninitialized, so we can shorten the on-disk segment size. */ @@ -133,15 +162,37 @@ SECTIONS .comment 0 : { *(.comment) } /* DWARF debug sections. - Symbols in the .debug DWARF section are relative to the beginning of the - section so we begin .debug at 0. It's not clear yet what needs to happen - for the others. */ + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + + /* DWARF 1 */ .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + + /* GNU DWARF 1 extensions */ .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + + /* DWARF 1.1 and DWARF 2 */ .debug_aranges 0 : { *(.debug_aranges) } .debug_pubnames 0 : { *(.debug_pubnames) } - .debug_sfnames 0 : { *(.debug_sfnames) } - .line 0 : { *(.line) } + + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + + ${RELOCATING+${OTHER_RELOCATING_SECTIONS}} /* These must appear regardless of ${RELOCATING}. */ ${OTHER_SECTIONS} |