This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PR14464, ppc64 function symbols in scripts
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Date: Fri, 31 Aug 2012 12:13:24 +0930
- Subject: PR14464, ppc64 function symbols in scripts
Committed.
PR ld/14464
* elf64-ppc.c (ppc64_elf_relocate_section): Map symbols defined
by a linker script in .opd to corresponding input .opd section.
Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.391
diff -u -p -r1.391 elf64-ppc.c
--- bfd/elf64-ppc.c 28 Aug 2012 20:17:56 -0000 1.391
+++ bfd/elf64-ppc.c 31 Aug 2012 01:13:58 -0000
@@ -12328,6 +12328,33 @@ ppc64_elf_relocate_section (bfd *output_
unresolved_reloc, warned);
sym_name = h_elf->root.root.string;
sym_type = h_elf->type;
+ if (sec != NULL
+ && sec->owner == output_bfd
+ && strcmp (sec->name, ".opd") == 0)
+ {
+ /* This is a symbol defined in a linker script. All
+ such are defined in output sections, even those
+ defined by simple assignment from a symbol defined in
+ an input section. Transfer the symbol to an
+ appropriate input .opd section, so that a branch to
+ this symbol will be mapped to the location specified
+ by the opd entry. */
+ struct bfd_link_order *lo;
+ for (lo = sec->map_head.link_order; lo != NULL; lo = lo->next)
+ if (lo->type == bfd_indirect_link_order)
+ {
+ asection *isec = lo->u.indirect.section;
+ if (h_elf->root.u.def.value >= isec->output_offset
+ && h_elf->root.u.def.value < (isec->output_offset
+ + isec->size))
+ {
+ h_elf->root.u.def.value -= isec->output_offset;
+ h_elf->root.u.def.section = isec;
+ sec = isec;
+ break;
+ }
+ }
+ }
}
h = (struct ppc_link_hash_entry *) h_elf;
--
Alan Modra
Australia Development Lab, IBM