aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2015-09-01 17:28:13 +0930
committerAlan Modra <amodra@gmail.com>2015-09-01 17:44:33 +0930
commitb07bca4ecd27f9cbaff822e4135abaf0ae6cd0db (patch)
tree0325b2e4e4c6dba0d282f34c46358b304bc66953 /bfd
parenta4b6fadd50968ec6c1b687fe52b88bd11ff734b3 (diff)
downloadgdb-b07bca4ecd27f9cbaff822e4135abaf0ae6cd0db.zip
gdb-b07bca4ecd27f9cbaff822e4135abaf0ae6cd0db.tar.gz
gdb-b07bca4ecd27f9cbaff822e4135abaf0ae6cd0db.tar.bz2
Wrong function reported for linker error message
OPD lookup goes awry when .opd has been shuffled to remove unused functions. * elf64-ppc.c (ppc64_elf_maybe_function_sym): Adjust symbol value if .opd section has been edited.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf64-ppc.c18
2 files changed, 22 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index e2819fe..b3ee41b 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@
2015-09-01 Alan Modra <amodra@gmail.com>
+ * elf64-ppc.c (ppc64_elf_maybe_function_sym): Adjust symbol value
+ if .opd section has been edited.
+
+2015-09-01 Alan Modra <amodra@gmail.com>
+
PR 18878
* elf64-ppc.c (ARRAY_SIZE): Define. Use throughout.
(enum ppc_stub_type): Add ppc_stub_save_res.
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 15d5238..f179f6d 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -6130,7 +6130,23 @@ ppc64_elf_maybe_function_sym (const asymbol *sym, asection *sec,
if (strcmp (sym->section->name, ".opd") == 0)
{
- if (opd_entry_value (sym->section, sym->value,
+ struct _opd_sec_data *opd = get_opd_info (sym->section);
+ bfd_vma symval = sym->value;
+
+ if (opd != NULL
+ && opd->adjust != NULL
+ && elf_section_data (sym->section)->relocs != NULL)
+ {
+ /* opd_entry_value will use cached relocs that have been
+ adjusted, but with raw symbols. That means both local
+ and global symbols need adjusting. */
+ long adjust = opd->adjust[OPD_NDX (symval)];
+ if (adjust == -1)
+ return 0;
+ symval += adjust;
+ }
+
+ if (opd_entry_value (sym->section, symval,
&sec, code_off, TRUE) == (bfd_vma) -1)
return 0;
/* An old ABI binary with dot-syms has a size of 24 on the .opd