diff options
author | Alan Modra <amodra@gmail.com> | 2017-08-05 23:28:21 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2017-08-05 23:28:21 +0930 |
commit | 55ef6584ca8466e293e9f1b310c0bf44500c11b6 (patch) | |
tree | 37d7eb5cfee1e66726d710f9f10130b9b8ada260 /bfd/elf32-hppa.c | |
parent | a66930b357fee4ae716bfc8816e78c0f9c024005 (diff) | |
download | gdb-55ef6584ca8466e293e9f1b310c0bf44500c11b6.zip gdb-55ef6584ca8466e293e9f1b310c0bf44500c11b6.tar.gz gdb-55ef6584ca8466e293e9f1b310c0bf44500c11b6.tar.bz2 |
Don't fail in elf32_hppa_set_gp
The base bfd_link_hash_table works fine here, the only thing to watch
out for is to only set elf_gp if the output is ELF.
bfd/
* elf32-hppa.c (elf32_hppa_set_gp): Don't require an
hppa_link_hash_table.
ld/
* testsuite/ld-unique/pr21529.d: Don't xfail hppa.
Diffstat (limited to 'bfd/elf32-hppa.c')
-rw-r--r-- | bfd/elf32-hppa.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index 1f2466e..f63ff3f 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -3090,13 +3090,8 @@ elf32_hppa_set_gp (bfd *abfd, struct bfd_link_info *info) struct bfd_link_hash_entry *h; asection *sec = NULL; bfd_vma gp_val = 0; - struct elf32_hppa_link_hash_table *htab; - htab = hppa_link_hash_table (info); - if (htab == NULL) - return FALSE; - - h = bfd_link_hash_lookup (&htab->etab.root, "$global$", FALSE, FALSE, FALSE); + h = bfd_link_hash_lookup (info->hash, "$global$", FALSE, FALSE, FALSE); if (h != NULL && (h->type == bfd_link_hash_defined @@ -3159,10 +3154,13 @@ elf32_hppa_set_gp (bfd *abfd, struct bfd_link_info *info) } } - if (sec != NULL && sec->output_section != NULL) - gp_val += sec->output_section->vma + sec->output_offset; + if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) + { + if (sec != NULL && sec->output_section != NULL) + gp_val += sec->output_section->vma + sec->output_offset; - elf_gp (abfd) = gp_val; + elf_gp (abfd) = gp_val; + } return TRUE; } |