This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Fix ppc64 ld-selective failures
On Tue, Aug 17, 2004 at 09:21:57AM +0930, Alan Modra wrote:
> On Sat, Aug 14, 2004 at 05:47:43PM +0200, Jakub Jelinek wrote:
> > FAIL: selective1
> > FAIL: selective2
* elf64-ppc.c (struct ppc64_elf_obj_tdata): Add "deleted_section".
(adjust_opd_syms): Attach opd syms for deleted entries to one of
the sections that will be discarded.
Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.159
diff -u -p -r1.159 elf64-ppc.c
--- bfd/elf64-ppc.c 13 Aug 2004 03:15:58 -0000 1.159
+++ bfd/elf64-ppc.c 17 Aug 2004 01:21:09 -0000
@@ -2333,6 +2333,10 @@ struct ppc64_elf_obj_tdata
asection *got;
asection *relgot;
+ /* Used during garbage collection. We attach global symbols defined
+ on removed .opd entries to this section so that the sym is removed. */
+ asection *deleted_section;
+
/* TLS local dynamic got entry handling. Suppose for multiple GOT
sections means we potentially need one of these for each input bfd. */
union {
@@ -5227,8 +5231,18 @@ adjust_opd_syms (struct elf_link_hash_en
if (adjust == -1)
{
/* This entry has been deleted. */
+ asection *dsec = ppc64_elf_tdata (sym_sec->owner)->deleted_section;
+ if (dsec == NULL)
+ {
+ for (dsec = sym_sec->owner->sections; dsec; dsec = dsec->next)
+ if (elf_discarded_section (dsec))
+ {
+ ppc64_elf_tdata (sym_sec->owner)->deleted_section = dsec;
+ break;
+ }
+ }
eh->elf.root.u.def.value = 0;
- eh->elf.root.u.def.section = &bfd_abs_section;
+ eh->elf.root.u.def.section = dsec;
}
else
eh->elf.root.u.def.value += adjust;
--
Alan Modra
IBM OzLabs - Linux Technology Centre