Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 1 | From 9d09ce14b4eef2b56f24660fd69a44acd45128b2 Mon Sep 17 00:00:00 2001 |
| 2 | From: Cupertino Miranda <cmiranda@synopsys.com> |
| 3 | Date: Fri, 2 Mar 2018 17:38:14 +0100 |
| 4 | Subject: [PATCH] Make sure global symbol is not an indirect or warning. |
| 5 | |
| 6 | Problem identified in the context of glibc with latest upstream binutils. |
| 7 | Dynamic symbol space was being reserved but, no actual information for the |
| 8 | symbol was being set. Data for the symbol was kept initialized with -1. |
| 9 | No easy test case was possible to be created. |
| 10 | |
| 11 | bfd/ |
| 12 | 2018-03-01 Cupertino Miranda <cmiranda@synopsys.com> |
| 13 | |
| 14 | * elf32-arc.c (elf_arc_check_relocs): Changed. |
| 15 | |
| 16 | Signed-off-by: Cupertino Miranda <cmiranda@synopsys.com> |
| 17 | Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> |
| 18 | [Romain: rebase on top of 2.31] |
| 19 | Signed-off-by: Romain Naour <romain.naour@gmail.com> |
| 20 | |
| 21 | Upstream-Status: Pending |
| 22 | --- |
| 23 | bfd/elf32-arc.c | 7 ++++++- |
| 24 | 1 file changed, 6 insertions(+), 1 deletion(-) |
| 25 | |
| 26 | diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c |
| 27 | index 33fc72cff6e..9b72c5b4f4f 100644 |
| 28 | --- a/bfd/elf32-arc.c |
| 29 | +++ b/bfd/elf32-arc.c |
| 30 | @@ -1960,7 +1960,12 @@ elf_arc_check_relocs (bfd * abfd, |
| 31 | if (r_symndx < symtab_hdr->sh_info) /* Is a local symbol. */ |
| 32 | h = NULL; |
| 33 | else /* Global one. */ |
| 34 | - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; |
| 35 | + { |
| 36 | + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; |
| 37 | + while (h->root.type == bfd_link_hash_indirect |
| 38 | + || h->root.type == bfd_link_hash_warning) |
| 39 | + h = (struct elf_link_hash_entry *) h->root.u.i.link; |
| 40 | + } |
| 41 | |
| 42 | |
| 43 | switch (r_type) |
| 44 | -- |
| 45 | 2.14.4 |
| 46 | |