This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Don't fail in elf32_hppa_set_gp


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=55ef6584ca8466e293e9f1b310c0bf44500c11b6

commit 55ef6584ca8466e293e9f1b310c0bf44500c11b6
Author: Alan Modra <amodra@gmail.com>
Date:   Sat Aug 5 23:28:21 2017 +0930

    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.

Diff:
---
 bfd/ChangeLog                    |  5 +++++
 bfd/elf32-hppa.c                 | 16 +++++++---------
 ld/ChangeLog                     |  4 ++++
 ld/testsuite/ld-unique/pr21529.d |  2 +-
 4 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index fd93c30..63813e47 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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-08-02  Max Filippov  <jcmvbkbc@gmail.com>
 
 	* xtensa-isa.c (xtensa_isa_init): Don't update lookup table
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;
 }
 
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 2cf0d49..eb002e9 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,7 @@
+2017-08-05  Alan Modra  <amodra@gmail.com>
+
+	* testsuite/ld-unique/pr21529.d: Don't xfail hppa.
+
 2017-08-04  H.J. Lu  <hongjiu.lu@intel.com>
 
 	PR ld/21904
diff --git a/ld/testsuite/ld-unique/pr21529.d b/ld/testsuite/ld-unique/pr21529.d
index 5d3436b..ffc1a72 100644
--- a/ld/testsuite/ld-unique/pr21529.d
+++ b/ld/testsuite/ld-unique/pr21529.d
@@ -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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]