aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-ppc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2015-03-24 17:37:57 +1030
committerAlan Modra <amodra@gmail.com>2015-03-24 17:42:36 +1030
commit8131c12209700f6e8cf16b09b5196da78a8066a3 (patch)
tree547c397906468ce0c106e6f85e9dc23eb234a972 /bfd/elf32-ppc.c
parent05f53ed611f0f7442f2b3a12b2829a18db6c2b59 (diff)
downloadfsf-binutils-gdb-8131c12209700f6e8cf16b09b5196da78a8066a3.zip
fsf-binutils-gdb-8131c12209700f6e8cf16b09b5196da78a8066a3.tar.gz
fsf-binutils-gdb-8131c12209700f6e8cf16b09b5196da78a8066a3.tar.bz2
Make powerpc bfd ld reloc overflow vs undefined symbols match gold
* elf64-ppc.c (ppc64_elf_relocate_section): Report overflow to stubs, even those for undefined weak symbols. Otherwise, don't report relocation overflow on branches to undefined strong symbols. Fix memory leak. * elf32-ppc.c (ppc_elf_relocate_section): Don't report relocation overflow on branches to undefined strong symbols.
Diffstat (limited to 'bfd/elf32-ppc.c')
-rw-r--r--bfd/elf32-ppc.c34
1 files changed, 12 insertions, 22 deletions
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index d61d75e..b96dbc8 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -9250,30 +9250,20 @@ ppc_elf_relocate_section (bfd *output_bfd,
if (r == bfd_reloc_overflow)
{
overflow:
- if (warned)
- continue;
- if (h != NULL
- && h->root.type == bfd_link_hash_undefweak
- && howto->pc_relative)
+ /* On code like "if (foo) foo();" don't report overflow
+ on a branch to zero when foo is undefined. */
+ if (!warned
+ && !(h != NULL
+ && (h->root.type == bfd_link_hash_undefweak
+ || h->root.type == bfd_link_hash_undefined)
+ && is_branch_reloc (r_type)))
{
- /* Assume this is a call protected by other code that
- detect the symbol is undefined. If this is the case,
- we can safely ignore the overflow. If not, the
- program is hosed anyway, and a little warning isn't
- going to help. */
-
- continue;
+ if (!((*info->callbacks->reloc_overflow)
+ (info, (h ? &h->root : NULL), sym_name,
+ howto->name, rel->r_addend,
+ input_bfd, input_section, rel->r_offset)))
+ return FALSE;
}
-
- if (! (*info->callbacks->reloc_overflow) (info,
- (h ? &h->root : NULL),
- sym_name,
- howto->name,
- rel->r_addend,
- input_bfd,
- input_section,
- rel->r_offset))
- return FALSE;
}
else
{