[1/6,ARC] Make sure global symbol is not an indirect or warning.

Message ID 20181115154430.23071-2-claziss@gmail.com
State New
Headers show
Series
  • Backports from mainline.
Related show

Commit Message

Claudiu Zissulescu Nov. 15, 2018, 3:44 p.m.
From: Cupertino Miranda <cmiranda@synopsys.com>


Problem identified in the context of glibc with latest upstream binutils.
Dynamic symbol space was being reserved but, no actual information for the
symbol was being set. Data for the symbol was kept initialized with -1.
No easy test case was possible to be created.

bfd/
2018-03-01  Cupertino Miranda <cmiranda@synopsys.com>

	* elf32-arc.c (elf_arc_check_relocs): Changed.
---
 bfd/ChangeLog   | 9 ++++++++-
 bfd/elf32-arc.c | 7 ++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

-- 
2.19.1

Patch

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 318bf9412c..c01914fe27 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,7 +1,14 @@ 
 2018-11-15  Claudiu Zissulescu  <claziss@synopsys.com>
 
 	Backport from mainline
-	2018-03-01  Cupertino Miranda <cmiranda@synopsys.com>
+	2018-03-02  Cupertino Miranda <cmiranda@synopsys.com>
+	* elf32-arc.c (elf_arc_check_relocs): Changed.
+
+
+2018-11-15  Claudiu Zissulescu  <claziss@synopsys.com>
+
+	Backport from mainline
+	2018-03-02  Cupertino Miranda <cmiranda@synopsys.com>
 	* elf32-arc.c (elf_arc_finish_dynamic_symbol) Return FALSE in case
 	arc_htab is NULL.
 
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index 1d0b6b8abe..8c1434a8cd 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -1960,7 +1960,12 @@  elf_arc_check_relocs (bfd *			 abfd,
       if (r_symndx < symtab_hdr->sh_info) /* Is a local symbol.  */
 	h = NULL;
       else /* Global one.  */
-	h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+	{
+	  h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+	  while (h->root.type == bfd_link_hash_indirect
+		 || h->root.type == bfd_link_hash_warning)
+	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+	}
 
 
       switch (r_type)