diff options
author | Alan Modra <amodra@gmail.com> | 2022-05-31 20:59:04 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2022-05-31 21:14:00 +0930 |
commit | 30596893ab5c82081bfdf81cebe0b973f4e7c516 (patch) | |
tree | c7a3a87248e9b90a06caf544f2ddfaefcd52f252 /bfd/elfxx-sparc.c | |
parent | e953510c3bfda9a39f1da76e00ab810917e32b78 (diff) | |
download | gdb-30596893ab5c82081bfdf81cebe0b973f4e7c516.zip gdb-30596893ab5c82081bfdf81cebe0b973f4e7c516.tar.gz gdb-30596893ab5c82081bfdf81cebe0b973f4e7c516.tar.bz2 |
sparc64 segfault in finish_dynamic_symbol
SYMBOL_REFERENCES_LOCAL can return true for undefined symbols. This
can result in a segfault when running sparc64 ld/testsuite/ld-vsb
tests that expect a failure.
* elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Don't
access u.def.section on non-default visibility undefined symbol.
Diffstat (limited to 'bfd/elfxx-sparc.c')
-rw-r--r-- | bfd/elfxx-sparc.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c index 618b885..514db1e 100644 --- a/bfd/elfxx-sparc.c +++ b/bfd/elfxx-sparc.c @@ -4416,7 +4416,10 @@ _bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd, return true; } - if (bfd_link_pic (info) && SYMBOL_REFERENCES_LOCAL (info, h)) + if (bfd_link_pic (info) + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && SYMBOL_REFERENCES_LOCAL (info, h)) { asection *sec = h->root.u.def.section; if (h->type == STT_GNU_IFUNC) |