1 On Thu, Aug 02, 2001 at 05:02:26PM -0700, H . J . Lu wrote:
2 > On Fri, Aug 03, 2001 at 09:15:10AM +0930, Alan Modra wrote:
3 > > On Thu, Aug 02, 2001 at 10:09:41AM -0700, H . J . Lu wrote:
5 > > > Alan, why don't we discard all relocations for static binaries?
7 > > A thinko on my part. We obviously should be discarding them. I
8 > > suspect this crept into elf32-i386.c from elf32-hppa.c, and it's
11 > Could you please fix both of them?
13 Your patch does the right thing, but I'm tweaking it a little.
16 From H.J. Lu <hjl@gnu.org>
17 * elf32-i386.c (allocate_plt_and_got_and_discard_relocs): Don't
18 keep relocs for undefined syms if there are no dynamic sections in
20 * elf32-hppa.c (allocate_plt_and_got_and_discard_relocs): Likewise.
25 Index: bfd/elf32-hppa.c
26 ===================================================================
27 RCS file: /cvs/src/src/bfd/elf32-hppa.c,v
28 retrieving revision 1.41
29 diff -u -p -r1.41 elf32-hppa.c
30 --- bfd/elf32-hppa.c 2001/06/30 00:34:10 1.41
31 +++ bfd/elf32-hppa.c 2001/08/03 05:07:46
32 @@ -2141,8 +2141,9 @@ allocate_plt_and_got_and_discard_relocs
34 && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
35 && ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
36 - || h->root.type == bfd_link_hash_undefweak
37 - || h->root.type == bfd_link_hash_undefined))
38 + || (hplink->root.dynamic_sections_created
39 + && (h->root.type == bfd_link_hash_undefweak
40 + || h->root.type == bfd_link_hash_undefined))))
42 /* Make sure this symbol is output as a dynamic symbol.
43 Undefined weak syms won't yet be marked as dynamic. */
44 Index: bfd/elf32-i386.c
45 ===================================================================
46 RCS file: /cvs/src/src/bfd/elf32-i386.c,v
47 retrieving revision 1.36
48 diff -u -p -r1.36 elf32-i386.c
49 --- bfd/elf32-i386.c 2001/06/27 01:46:17 1.36
50 +++ bfd/elf32-i386.c 2001/08/03 05:07:49
51 @@ -1199,8 +1199,9 @@ allocate_plt_and_got_and_discard_relocs
53 && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
54 && ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
55 - || h->root.type == bfd_link_hash_undefweak
56 - || h->root.type == bfd_link_hash_undefined))
57 + || (htab->root.dynamic_sections_created
58 + && (h->root.type == bfd_link_hash_undefweak
59 + || h->root.type == bfd_link_hash_undefined))))
61 /* Make sure this symbol is output as a dynamic symbol.
62 Undefined weak syms won't yet be marked as dynamic. */