public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Richard Sandiford <rsandifo@nildram.co.uk>
To: Eric Botcazou <ebotcazou@adacore.com>
Cc: binutils@sourceware.org
Subject: [PATCH 8/7] Fix --gc-sections for C++ MIPS ELF
Date: Tue, 04 Dec 2007 10:02:00 -0000	[thread overview]
Message-ID: <87y7ca3hic.fsf_-_@firetop.home> (raw)
In-Reply-To: <200712022326.57206.ebotcazou@adacore.com> (Eric Botcazou's 	message of "Sun\, 2 Dec 2007 23\:26\:57 +0100")

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) }

  reply	other threads:[~2007-12-04 10:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-02 20:15 Richard Sandiford
2007-12-02 20:18 ` [PATCH 1/7] " Richard Sandiford
2007-12-02 20:19 ` [PATCH 2/7] " Richard Sandiford
2007-12-02 20:28 ` [PATCH 3/7] " Richard Sandiford
2007-12-02 20:31 ` [PATCH 4/7] " Richard Sandiford
2007-12-02 20:35 ` [PATCH 5/7] " Richard Sandiford
2007-12-02 20:37 ` [PATCH 6/7] " Richard Sandiford
2007-12-02 20:39 ` [PATCH 7/7] " Richard Sandiford
2007-12-02 21:55 ` Jakub Jelinek
2007-12-04 10:08   ` Richard Sandiford
2007-12-02 22:26 ` Eric Botcazou
2007-12-04 10:02   ` Richard Sandiford [this message]
2007-12-04 11:39     ` [PATCH 8/7] " Eric Botcazou
2007-12-15  1:46 ` Alan Modra
2007-12-15  9:46   ` Richard Sandiford

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y7ca3hic.fsf_-_@firetop.home \
    --to=rsandifo@nildram.co.uk \
    --cc=binutils@sourceware.org \
    --cc=ebotcazou@adacore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).