From 9ac4db9c1c6312a2d2a7d73b816f9b5caeafe5c4 Mon Sep 17 00:00:00 2001 From: Geoffrey Keating Date: Thu, 10 Aug 2000 23:43:57 +0000 Subject: [PATCH] * scripttempl/elf.sc: Add a comment giving the correspondence between sections, per-datum sections, and linkonce sections. Make the comment true even for .bss, .sdata, .sdata2, .sbss, and .sbss2. --- ld/ChangeLog | 7 +++ ld/scripttempl/elf.sc | 105 +++++++++++++++++++++++++++++++++--------- 2 files changed, 91 insertions(+), 21 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index ae6238dd8d..cf6fd16492 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,10 @@ +2000-08-10 Geoff Keating + + * scripttempl/elf.sc: Add a comment giving the correspondence + between sections, per-datum sections, and linkonce sections. Make + the comment true even for .bss, .sdata, .sdata2, .sbss, and + .sbss2. + 2000-08-10 Jason Eckhardt * emulparams/elf32_i860.sh: New file. diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc index 1f5c716425..65f578ff49 100644 --- a/ld/scripttempl/elf.sc +++ b/ld/scripttempl/elf.sc @@ -37,6 +37,27 @@ # when specifying the start address of the next. # +/* Many sections come in three flavours. There is the 'real' section, + like ".data". Then there are the per-procedure or per-variable + sections, generated by -ffunction-sections and -fdata-sections in GCC, + and useful for --gc-sections, which for a variable "foo" might be + ".data.foo". Then there are the linkonce sections, for which the linker + eliminates duplicates, which are named like ".gnu.linkonce.d.foo". + The exact correspondences are: + + Section Linkonce section + .text .gnu.linkonce.t.foo + .rodata .gnu.linkonce.r.foo + .data .gnu.linkonce.d.foo + .bss .gnu.linkonce.b.foo + .sdata .gnu.linkonce.s.foo + .sbss .gnu.linkonce.sb.foo + .sdata2 .gnu.linkonce.s2.foo + .sbss2 .gnu.linkonce.sb2.foo + + Each of these can also have corresponding .rel.* and .rela.* sections. +*/ + test -z "$ENTRY" && ENTRY=_start test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT} test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT} @@ -47,9 +68,9 @@ test "$LD_FLAG" = "N" && DATA_ADDR=. INTERP=".interp ${RELOCATING-0} : { *(.interp) }" PLT=".plt ${RELOCATING-0} : { *(.plt) }" DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }" -RODATA=".rodata ${RELOCATING-0} : { *(.rodata) ${RELOCATING+*(.rodata.*)} ${RELOCATING+*(.gnu.linkonce.r*)} }" -SBSS2=".sbss2 ${RELOCATING-0} : { *(.sbss2) }" -SDATA2=".sdata2 ${RELOCATING-0} : { *(.sdata2) }" +RODATA=".rodata ${RELOCATING-0} : { *(.rodata) ${RELOCATING+*(.rodata.*)} ${RELOCATING+*(.gnu.linkonce.r.*)} }" +SBSS2=".sbss2 ${RELOCATING-0} : { *(.sbss2) ${RELOCATING+*(.sbss2.*)} ${RELOCATING+*(.gnu.linkonce.sb2.*)} }" +SDATA2=".sdata2 ${RELOCATING-0} : { *(.sdata2) ${RELOCATING+*(.sdata2.*)} ${RELOCATING+*(.gnu.linkonce.s2.*)} }" CTOR=".ctors ${CONSTRUCTING-0} : { ${CONSTRUCTING+${CTOR_START}} @@ -130,13 +151,13 @@ SECTIONS { *(.rel.text) ${RELOCATING+*(.rel.text.*)} - ${RELOCATING+*(.rel.gnu.linkonce.t*)} + ${RELOCATING+*(.rel.gnu.linkonce.t.*)} } .rela.text ${RELOCATING-0} : { *(.rela.text) ${RELOCATING+*(.rela.text.*)} - ${RELOCATING+*(.rela.gnu.linkonce.t*)} + ${RELOCATING+*(.rela.gnu.linkonce.t.*)} } .rel.fini ${RELOCATING-0} : { *(.rel.fini) } .rela.fini ${RELOCATING-0} : { *(.rela.fini) } @@ -144,26 +165,26 @@ SECTIONS { *(.rel.rodata) ${RELOCATING+*(.rel.rodata.*)} - ${RELOCATING+*(.rel.gnu.linkonce.r*)} + ${RELOCATING+*(.rel.gnu.linkonce.r.*)} } .rela.rodata ${RELOCATING-0} : { *(.rela.rodata) ${RELOCATING+*(.rela.rodata.*)} - ${RELOCATING+*(.rela.gnu.linkonce.r*)} + ${RELOCATING+*(.rela.gnu.linkonce.r.*)} } ${OTHER_READONLY_RELOC_SECTIONS} .rel.data ${RELOCATING-0} : { *(.rel.data) ${RELOCATING+*(.rel.data.*)} - ${RELOCATING+*(.rel.gnu.linkonce.d*)} + ${RELOCATING+*(.rel.gnu.linkonce.d.*)} } .rela.data ${RELOCATING-0} : { *(.rela.data) ${RELOCATING+*(.rela.data.*)} - ${RELOCATING+*(.rela.gnu.linkonce.d*)} + ${RELOCATING+*(.rela.gnu.linkonce.d.*)} } .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) } .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } @@ -176,22 +197,62 @@ SECTIONS { *(.rel.sdata) ${RELOCATING+*(.rel.sdata.*)} - ${RELOCATING+*(.rel.gnu.linkonce.s*)} + ${RELOCATING+*(.rel.gnu.linkonce.s.*)} } .rela.sdata ${RELOCATING-0} : { *(.rela.sdata) ${RELOCATING+*(.rela.sdata.*)} - ${RELOCATING+*(.rela.gnu.linkonce.s*)} + ${RELOCATING+*(.rela.gnu.linkonce.s.*)} + } + .rel.sbss ${RELOCATING-0} : + { + *(.rel.sbss) + ${RELOCATING+*(.rel.sbss.*)} + ${RELOCATING+*(.rel.gnu.linkonce.sb.*)} + } + .rela.sbss ${RELOCATING-0} : + { + *(.rela.sbss) + ${RELOCATING+*(.rela.sbss.*)} + ${RELOCATING+*(.rel.gnu.linkonce.sb.*)} + } + .rel.sdata2 ${RELOCATING-0} : + { + *(.rel.sdata2) + ${RELOCATING+*(.rel.sdata2.*)} + ${RELOCATING+*(.rel.gnu.linkonce.s2.*)} + } + .rela.sdata2 ${RELOCATING-0} : + { + *(.rela.sdata2) + ${RELOCATING+*(.rela.sdata2.*)} + ${RELOCATING+*(.rela.gnu.linkonce.s2.*)} + } + .rel.sbss2 ${RELOCATING-0} : + { + *(.rel.sbss2) + ${RELOCATING+*(.rel.sbss2.*)} + ${RELOCATING+*(.rel.gnu.linkonce.sb2.*)} + } + .rela.sbss2 ${RELOCATING-0} : + { + *(.rela.sbss2) + ${RELOCATING+*(.rela.sbss2.*)} + ${RELOCATING+*(.rela.gnu.linkonce.sb2.*)} + } + .rel.bss ${RELOCATING-0} : + { + *(.rel.bss) + ${RELOCATING+*(.rel.bss.*)} + ${RELOCATING+*(.rel.gnu.linkonce.b.*)} + } + .rela.bss ${RELOCATING-0} : + { + *(.rela.bss) + ${RELOCATING+*(.rela.bss.*)} + ${RELOCATING+*(.rela.gnu.linkonce.b.*)} } - .rel.sbss ${RELOCATING-0} : { *(.rel.sbss) } - .rela.sbss ${RELOCATING-0} : { *(.rela.sbss) } - .rel.sdata2 ${RELOCATING-0} : { *(.rel.sdata2) } - .rela.sdata2 ${RELOCATING-0} : { *(.rela.sdata2) } - .rel.sbss2 ${RELOCATING-0} : { *(.rel.sbss2) } - .rela.sbss2 ${RELOCATING-0} : { *(.rela.sbss2) } - .rel.bss ${RELOCATING-0} : { *(.rel.bss) } - .rela.bss ${RELOCATING-0} : { *(.rela.bss) } .rel.plt ${RELOCATING-0} : { *(.rel.plt) } .rela.plt ${RELOCATING-0} : { *(.rela.plt) } ${OTHER_PLT_RELOC_SECTIONS} @@ -212,7 +273,7 @@ SECTIONS *(.stub) /* .gnu.warning sections are handled specially by elf32.em. */ *(.gnu.warning) - ${RELOCATING+*(.gnu.linkonce.t*)} + ${RELOCATING+*(.gnu.linkonce.t.*)} ${RELOCATING+${OTHER_TEXT_SECTIONS}} } =${NOP-0} .fini ${RELOCATING-0} : @@ -240,7 +301,7 @@ SECTIONS ${RELOCATING+${DATA_START_SYMBOLS}} *(.data) ${RELOCATING+*(.data.*)} - ${RELOCATING+*(.gnu.linkonce.d*)} + ${RELOCATING+*(.gnu.linkonce.d.*)} ${CONSTRUCTING+SORT(CONSTRUCTORS)} } .data1 ${RELOCATING-0} : { *(.data1) } @@ -278,6 +339,7 @@ SECTIONS *(.dynsbss) *(.sbss) ${RELOCATING+*(.sbss.*)} + ${RELOCATING+*(.gnu.linkonce.sb.*)} *(.scommon) ${RELOCATING+PROVIDE (__sbss_end = .);} ${RELOCATING+PROVIDE (___sbss_end = .);} @@ -288,6 +350,7 @@ SECTIONS *(.dynbss) *(.bss) ${RELOCATING+*(.bss.*)} + ${RELOCATING+*(.gnu.linkonce.b.*)} *(COMMON) /* Align here to ensure that the .bss section occupies space up to _end. Align after .bss to ensure correct alignment even if the -- 2.34.1