diff options
author | Cupertino Miranda <cmiranda@synopsys.com> | 2016-07-22 15:10:31 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2016-07-22 15:10:31 +0100 |
commit | c02d11a585398734a2178d65a17411cd3050b9d2 (patch) | |
tree | c65e3f91740c6c214a9c03d5c15388093da7589b /bfd/arc-got.h | |
parent | 70ad8739d8ec7a79ef28305c0975df503535b88a (diff) | |
download | gdb-c02d11a585398734a2178d65a17411cd3050b9d2.zip gdb-c02d11a585398734a2178d65a17411cd3050b9d2.tar.gz gdb-c02d11a585398734a2178d65a17411cd3050b9d2.tar.bz2 |
Fix segfault in ARC linker when generating got entries for local symbols.
bfd * arc-got.h (relocate_fix_got_relocs_for_got_info): Handle the case
where there's no elf_link_hash_entry while processing GOT_NORMAL got
entries.
ld * testsuite/ld-arc/got-01.d: New file.
* testsuite/ld-arc/got-01.s: New file.
Diffstat (limited to 'bfd/arc-got.h')
-rw-r--r-- | bfd/arc-got.h | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/bfd/arc-got.h b/bfd/arc-got.h index 00deb01..7c3cfd9 100644 --- a/bfd/arc-got.h +++ b/bfd/arc-got.h @@ -369,12 +369,21 @@ relocate_fix_got_relocs_for_got_info (struct got_entry ** list_p, = reloc_data->sym_section->output_section->vma + reloc_data->sym_section->output_offset; - if (h->root.type != bfd_link_hash_undefweak) + if (h != NULL + && h->root.type == bfd_link_hash_undefweak) + ARC_DEBUG ("arc_info: PATCHED: NOT_PATCHED " + "@ %#08lx for sym %s in got offset %#lx " + "(is undefweak)\n", + (long) (htab->sgot->output_section->vma + + htab->sgot->output_offset + + entry->offset), + symbol_name, + (long) entry->offset); + else { bfd_put_32 (output_bfd, reloc_data->sym_value + sec_vma, htab->sgot->contents + entry->offset); - ARC_DEBUG ("arc_info: PATCHED: %#08lx " "@ %#08lx for sym %s in got offset %#lx\n", (long) (reloc_data->sym_value + sec_vma), @@ -383,17 +392,6 @@ relocate_fix_got_relocs_for_got_info (struct got_entry ** list_p, symbol_name, (long) entry->offset); } - else - { - ARC_DEBUG ("arc_info: PATCHED: NOT_PATCHED " - "@ %#08lx for sym %s in got offset %#lx " - "(is undefweak)\n", - (long) (htab->sgot->output_section->vma - + htab->sgot->output_offset - + entry->offset), - symbol_name, - (long) entry->offset); - } } break; default: |