aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-ppc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-04-12 17:16:58 +0930
committerAlan Modra <amodra@gmail.com>2021-04-12 21:19:02 +0930
commitb585e899960202fbe3c137cbf765f75b088592fe (patch)
treefe63d180fe988f6a6cd54eea6706eac2ae792328 /bfd/elf64-ppc.c
parentf5b10973531cdda7e1aba7496f70476b5146fcf8 (diff)
downloadgdb-b585e899960202fbe3c137cbf765f75b088592fe.zip
gdb-b585e899960202fbe3c137cbf765f75b088592fe.tar.gz
gdb-b585e899960202fbe3c137cbf765f75b088592fe.tar.bz2
elf_backend_archive_symbol_lookup
elf_backend_archive_symbol_lookup might be called when the linker hash table has entries of type generic_link_hash_entry. This happens for instance when running the mmix target linker testsuite where the output is mmo but input is elf64-mmix. * elf-bfd.h (struct elf_backend_data): Return bfd_link_hash_entry* from elf_backend_archive_symbol_lookup. (_bfd_elf_archive_symbol_lookup): Return bfd_link_hash_entry*. * elf64-ppc.c (ppc64_elf_archive_symbol_lookup): Likewise. Check we have a ppc_hash_table before accessing ppc_link_hash_entry fields. * elflink.c (_bfd_elf_archive_symbol_lookup): Return bfd_link_hash_entry*. (elf_link_add_archive_symbols): Adjust to suit.
Diffstat (limited to 'bfd/elf64-ppc.c')
-rw-r--r--bfd/elf64-ppc.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index c306954..7873f97 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -4196,20 +4196,21 @@ ppc64_elf_merge_symbol (struct elf_link_hash_entry *h,
NAME is a symbol defined in an archive. Return a symbol in the hash
table that might be satisfied by the archive symbols. */
-static struct elf_link_hash_entry *
+static struct bfd_link_hash_entry *
ppc64_elf_archive_symbol_lookup (bfd *abfd,
struct bfd_link_info *info,
const char *name)
{
- struct elf_link_hash_entry *h;
+ struct bfd_link_hash_entry *h;
char *dot_name;
size_t len;
h = _bfd_elf_archive_symbol_lookup (abfd, info, name);
if (h != NULL
+ && ppc_hash_table (info) != NULL
/* Don't return this sym if it is a fake function descriptor
created by add_symbol_adjust. */
- && !ppc_elf_hash_entry (h)->fake)
+ && !((struct ppc_link_hash_entry *) h)->fake)
return h;
if (name[0] == '.')
@@ -4218,7 +4219,7 @@ ppc64_elf_archive_symbol_lookup (bfd *abfd,
len = strlen (name);
dot_name = bfd_alloc (abfd, len + 2);
if (dot_name == NULL)
- return (struct elf_link_hash_entry *) -1;
+ return (struct bfd_link_hash_entry *) -1;
dot_name[0] = '.';
memcpy (dot_name + 1, name, len + 1);
h = _bfd_elf_archive_symbol_lookup (abfd, info, dot_name);