This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

patch for .gnu.linkonce.b.foo and other section names...



This patch makes all the .gnu.linkonce.* stuff and all the
.<section-name>.* stuff in elf.sc consistent.

I couldn't think of reasonable single-letter names once I was up to
.sbss2, so decided that we'd just have to live with the terrible waste
of four extra bytes in every object file as a tradeoff for slightly
more meaningful section names.

Note that this goes with a corresponding gcc patch to use the new
section names on powerpc.

OK to commit?  Tested on powerpc-linux.

-- 
- Geoffrey Keating <geoffk@cygnus.com>

===File ~/patches/cygnus/rs6000-sdata_data-ld.patch=========
2000-08-08  Geoff Keating  <geoffk@cygnus.com>

	* 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.

Index: ld/scripttempl/elf.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/elf.sc,v
retrieving revision 1.13
diff -p -u -u -p -r1.13 elf.sc
--- elf.sc	2000/07/17 22:41:08	1.13
+++ elf.sc	2000/08/09 02:49:37
@@ -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
============================================================

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]