This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: strip 2.11.90.0.25 dumps core
- To: "H . J . Lu" <hjl at lucon dot org>
- Subject: Re: strip 2.11.90.0.25 dumps core
- From: Alan Modra <amodra at bigpond dot net dot au>
- Date: Fri, 3 Aug 2001 14:47:34 +0930
- Cc: Artur Frysiak <wiget at pld dot org dot pl>, binutils at sourceware dot cygnus dot com
- References: <20010731141628.I30121@free.buy.pl> <20010731083312.A10404@lucon.org> <20010801154411.D12322@free.buy.pl> <20010801083023.A32569@lucon.org> <20010801181946.A7168@ikar.t17.ds.pwr.wroc.pl> <20010801092817.A1059@lucon.org> <20010802111445.A29935@ikar.t17.ds.pwr.wroc.pl> <20010802100941.A23775@lucon.org> <20010803091510.E26828@bubble.sa.bigpond.net.au> <20010802170226.A30404@lucon.org>
On Thu, Aug 02, 2001 at 05:02:26PM -0700, H . J . Lu wrote:
> On Fri, Aug 03, 2001 at 09:15:10AM +0930, Alan Modra wrote:
> > On Thu, Aug 02, 2001 at 10:09:41AM -0700, H . J . Lu wrote:
> > >
> > > Alan, why don't we discard all relocations for static binaries?
> >
> > A thinko on my part. We obviously should be discarding them. I
> > suspect this crept into elf32-i386.c from elf32-hppa.c, and it's
> > wrong there too.
>
> Could you please fix both of them?
Your patch does the right thing, but I'm tweaking it a little.
bfd/ChangeLog
From H.J. Lu <hjl@gnu.org>
* elf32-i386.c (allocate_plt_and_got_and_discard_relocs): Don't
keep relocs for undefined syms if there are no dynamic sections in
executable.
* elf32-hppa.c (allocate_plt_and_got_and_discard_relocs): Likewise.
--
Alan Modra
Index: bfd/elf32-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-hppa.c,v
retrieving revision 1.41
diff -u -p -r1.41 elf32-hppa.c
--- elf32-hppa.c 2001/06/30 00:34:10 1.41
+++ elf32-hppa.c 2001/08/03 05:07:46
@@ -2141,8 +2141,9 @@ allocate_plt_and_got_and_discard_relocs
if (!info->shared
&& (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
&& ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- || h->root.type == bfd_link_hash_undefweak
- || h->root.type == bfd_link_hash_undefined))
+ || (hplink->root.dynamic_sections_created
+ && (h->root.type == bfd_link_hash_undefweak
+ || h->root.type == bfd_link_hash_undefined))))
{
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
Index: bfd/elf32-i386.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i386.c,v
retrieving revision 1.36
diff -u -p -r1.36 elf32-i386.c
--- elf32-i386.c 2001/06/27 01:46:17 1.36
+++ elf32-i386.c 2001/08/03 05:07:49
@@ -1199,8 +1199,9 @@ allocate_plt_and_got_and_discard_relocs
if (!info->shared
&& (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
&& ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- || h->root.type == bfd_link_hash_undefweak
- || h->root.type == bfd_link_hash_undefined))
+ || (htab->root.dynamic_sections_created
+ && (h->root.type == bfd_link_hash_undefweak
+ || h->root.type == bfd_link_hash_undefined))))
{
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */