]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Don't fail in elf32_hppa_set_gp
authorAlan Modra <amodra@gmail.com>
Sat, 5 Aug 2017 13:58:21 +0000 (23:28 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 23 Aug 2017 03:18:16 +0000 (12:48 +0930)
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.

bfd/ChangeLog
bfd/elf32-hppa.c
ld/ChangeLog
ld/testsuite/ld-unique/pr21529.d

index 71e285a85df51d82a99ac975a0025f45b4c5b6db..37c6665f17cbaf392dde83cee2943374b964de36 100644 (file)
@@ -1,3 +1,8 @@
+2017-08-05  Alan Modra  <amodra@gmail.com>
+
+       * elf32-hppa.c (elf32_hppa_set_gp): Don't require an
+       hppa_link_hash_table.
+
 2017-07-25  Alan Modra  <amodra@gmail.com>
 
        * elf64-ppc.c (struct map_stub): Add tls_get_addr_opt_bctrl.
index 0087c71a60672bdfd4f365cec960900761e1d5ee..0b7f43438d4f30c2de30b0b372ee58b673375c31 100644 (file)
@@ -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;
 }
 
index 28543722440107accbffec02b155bfc237131454..618a17253f6d27d7465cd3372cd36a8238f1d796 100644 (file)
@@ -1,3 +1,7 @@
+2017-08-05  Alan Modra  <amodra@gmail.com>
+
+       * testsuite/ld-unique/pr21529.d: Don't xfail hppa.
+
 2017-08-03  Nick Clifton  <nickc@redhat.com>
 
        PR ld/21884
index 5d3436badb654b5e4e60f686667013cbd6630d1b..ffc1a724406b47c39813fd167b3b826e1c3944c0 100644 (file)
@@ -1,6 +1,6 @@
 #ld: --oformat binary -T pr21529.ld -e main
 #objdump: -s -b binary
-#notarget: aarch64*-*-* arm*-*-* avr-*-* hppa-*-* ia64-*-* m68hc1*-*-* nds32*-*-* score-*-*
+#notarget: aarch64*-*-* arm*-*-* avr-*-* ia64-*-* m68hc1*-*-* nds32*-*-* score-*-*
 # Skip targets which can't change output format to binary.
 
 #pass