This is the mail archive of the binutils@sourceware.org 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]
Other format: [Raw text]

[PATCH 8/7] Fix --gc-sections for C++ MIPS ELF


Eric Botcazou <ebotcazou@adacore.com> writes:
>> Non-PIC CIEs for targets like x86_64-linux-gnu also have direct references
>> to the personality routines.  I suspect the only reason -Wl,--gc-sections
>> -static-libgcc works for them is that libgcc's own CIEs use an indirect
>> reference, so the section gets marked that way.
>
> The section is supposed to be always marked, see scripttempl/elf.sc.

Gah!  Sorry, I'm an idiot.  I should have known to look for that.
So we could fix the original problem by modifying the libgloss
scripts instead.

I still think the patches make the linker more robust though,
both because it can then cope with scripts that don't have the KEEPs[*],
and because it no longer discards sections referenced by unparseable
.eh_frames.  There's also the theoretical advantage that we can get
rid of personality routines we don't need, although I doubt that occurs
very often in practice.  So I'd still like to go with these patches.

 [*] As a datapoint, current libgloss has 71 *.ld scripts, only 4 of
     which keep personality sections.  I imagine quite a few users have
     their own local scripts too.

Anyway, there's now an unscheduled eighth patch in the series.  Thanks
for the pointer!  I repeated the original testing with this patch also
applied, and there were no changes.

Richard


ld/scripttempl/
	* armbpabi.sc (.text): Remove KEEP (*(.text.*personality*)).
	(.data): KEEP (*(.gnu.linkonce.d.*personality*)).
	* elf.sc: As for armbpabi.sc.
	* elfxtensa.sc: Likewise.
	* mep.sc: Likewise.

Index: ld/scripttempl/armbpabi.sc
===================================================================
--- ld/scripttempl/armbpabi.sc	2007-12-02 22:47:25.000000000 +0000
+++ ld/scripttempl/armbpabi.sc	2007-12-02 22:47:38.000000000 +0000
@@ -183,7 +183,6 @@ cat <<EOF
   {
     ${RELOCATING+${TEXT_START_SYMBOLS}}
     *(.text .stub${RELOCATING+ .text.* .gnu.linkonce.t.*})
-    KEEP (*(.text.*personality*))
     /* .gnu.warning sections are handled specially by elf32.em.  */
     *(.gnu.warning)
     ${RELOCATING+${OTHER_TEXT_SECTIONS}}
@@ -271,7 +270,6 @@ cat <<EOF
   {
     ${RELOCATING+${DATA_START_SYMBOLS}}
     *(.data${RELOCATING+ .data.* .gnu.linkonce.d.*})
-    KEEP (*(.gnu.linkonce.d.*personality*))
     ${CONSTRUCTING+SORT(CONSTRUCTORS)}
   }
   .data1        ${RELOCATING-0} : { *(.data1) }
Index: ld/scripttempl/elf.sc
===================================================================
--- ld/scripttempl/elf.sc	2007-12-02 22:47:44.000000000 +0000
+++ ld/scripttempl/elf.sc	2007-12-02 22:47:58.000000000 +0000
@@ -350,7 +350,6 @@ cat <<EOF
   {
     ${RELOCATING+${TEXT_START_SYMBOLS}}
     *(.text .stub${RELOCATING+ .text.* .gnu.linkonce.t.*})
-    KEEP (*(.text.*personality*))
     /* .gnu.warning sections are handled specially by elf32.em.  */
     *(.gnu.warning)
     ${RELOCATING+${OTHER_TEXT_SECTIONS}}
@@ -427,7 +426,6 @@ cat <<EOF
   {
     ${RELOCATING+${DATA_START_SYMBOLS}}
     *(.data${RELOCATING+ .data.* .gnu.linkonce.d.*})
-    ${RELOCATING+KEEP (*(.gnu.linkonce.d.*personality*))}
     ${CONSTRUCTING+SORT(CONSTRUCTORS)}
   }
   .data1        ${RELOCATING-0} : { *(.data1) }
Index: ld/scripttempl/elfxtensa.sc
===================================================================
--- ld/scripttempl/elfxtensa.sc	2007-12-02 22:48:02.000000000 +0000
+++ ld/scripttempl/elfxtensa.sc	2007-12-02 22:48:12.000000000 +0000
@@ -366,7 +366,6 @@ cat <<EOF
 
     ${RELOCATING+${TEXT_START_SYMBOLS}}
     *(.literal .text .stub${RELOCATING+ .literal.* .text.* .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*})
-    KEEP (*(.text.*personality*))
     /* .gnu.warning sections are handled specially by elf32.em.  */
     *(.gnu.warning)
     ${RELOCATING+${OTHER_TEXT_SECTIONS}}
@@ -446,7 +445,6 @@ cat <<EOF
   {
     ${RELOCATING+${DATA_START_SYMBOLS}}
     *(.data${RELOCATING+ .data.* .gnu.linkonce.d.*})
-    ${RELOCATING+KEEP (*(.gnu.linkonce.d.*personality*))}
     ${CONSTRUCTING+SORT(CONSTRUCTORS)}
   }
   .data1        ${RELOCATING-0} : { *(.data1) }
Index: ld/scripttempl/mep.sc
===================================================================
--- ld/scripttempl/mep.sc	2007-12-02 22:48:16.000000000 +0000
+++ ld/scripttempl/mep.sc	2007-12-02 22:48:28.000000000 +0000
@@ -300,7 +300,6 @@ cat <<EOF
   {
     ${RELOCATING+${TEXT_START_SYMBOLS}}
     *(.text .stub${RELOCATING+ .text.* .gnu.linkonce.t.*})
-    KEEP (*(.text.*personality*))
     /* .gnu.warning sections are handled specially by elf32.em.  */
     *(.gnu.warning)
     ${RELOCATING+${OTHER_TEXT_SECTIONS}}
@@ -360,7 +359,6 @@ cat <<EOF
   {
     ${RELOCATING+${DATA_START_SYMBOLS}}
     *(.data${RELOCATING+ .data.* .gnu.linkonce.d.*})
-    KEEP (*(.gnu.linkonce.d.*personality*))
     ${CONSTRUCTING+SORT(CONSTRUCTORS)}
   }
   .data1        ${RELOCATING-0} : { *(.data1) }


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