aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-ppc.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elf64-ppc.c')
-rw-r--r--bfd/elf64-ppc.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index bf2a6d7..37b30e6 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -3675,12 +3675,16 @@ edit_opd (obfd, info)
break;
}
- if (sym_sec->output_section == bfd_abs_section_ptr)
- {
- /* OK, we've found a function that's excluded from the
- link. */
- need_edit = true;
- }
+ /* opd entries are always for functions defined in the
+ current input bfd. If the symbol isn't defined in the
+ input bfd, then we won't be using the function in this
+ bfd; It must be defined in a linkonce section in another
+ bfd, or is weak. It's also possible that we are
+ discarding the function due to a linker script /DISCARD/,
+ which we test for via the output_section. */
+ if (sym_sec->owner != ibfd
+ || sym_sec->output_section == bfd_abs_section_ptr)
+ need_edit = true;
offset += 24;
}
@@ -3754,7 +3758,8 @@ edit_opd (obfd, info)
sym->st_shndx);
}
- skip = sym_sec->output_section == bfd_abs_section_ptr;
+ skip = (sym_sec->owner != ibfd
+ || sym_sec->output_section == bfd_abs_section_ptr);
if (skip)
{
if (h != NULL)