aboutsummaryrefslogtreecommitdiff
path: root/bfd/elfxx-x86.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2018-05-26 04:27:09 -0700
committerH.J. Lu <hjl.tools@gmail.com>2018-05-26 04:27:24 -0700
commit099bb8fb97d79d03a20926d6014a5fc27a5ca75e (patch)
treebb0da692186056971e42f952769ecf154378133e /bfd/elfxx-x86.c
parentd7460de3eadeb5b7665ad8569f54e59eccdef378 (diff)
downloadgdb-099bb8fb97d79d03a20926d6014a5fc27a5ca75e.zip
gdb-099bb8fb97d79d03a20926d6014a5fc27a5ca75e.tar.gz
gdb-099bb8fb97d79d03a20926d6014a5fc27a5ca75e.tar.bz2
ld: Add _bfd_elf_link_hide_sym_by_version
bfd_hide_sym_by_version can't be used to check if a versioned symbol is hidden. This patch adds _bfd_elf_link_hide_sym_by_version to support both versioned and unversioned symbols by extracting versioned symbol check from _bfd_elf_link_assign_sym_version. bfd/ PR ld/23194 * elf-bfd.h (_bfd_elf_link_hide_sym_by_version): New. * elflink.c (_bfd_elf_link_hide_versioned_symbol): New function. Extracted from _bfd_elf_link_assign_sym_version. (_bfd_elf_link_hide_sym_by_version): New function. (_bfd_elf_link_assign_sym_version): Use _bfd_elf_link_hide_versioned_symbol. * elfxx-x86.c (_bfd_x86_elf_link_symbol_references_local): Call _bfd_elf_link_hide_sym_by_version instead of bfd_hide_sym_by_version. Don't check unversioned symbol. ld/ PR ld/23194 * testsuite/ld-i386/pr23194.d: Expect only R_386_GLOB_DAT against foobar. * testsuite/ld-i386/pr23194.map: Add foobar. * testsuite/ld-x86-64/pr23194.map: Likewise. * testsuite/ld-i386/pr23194.s: Add a common foobar symbol. * testsuite/ld-x86-64/pr23194.s: Likewise. * testsuite/ld-x86-64/pr23194.d: Expect only R_X86_64_GLOB_DAT against foobar.
Diffstat (limited to 'bfd/elfxx-x86.c')
-rw-r--r--bfd/elfxx-x86.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c
index 710417f..3a7573f 100644
--- a/bfd/elfxx-x86.c
+++ b/bfd/elfxx-x86.c
@@ -2038,21 +2038,14 @@ _bfd_x86_elf_link_symbol_references_local (struct bfd_link_info *info,
&& htab->interp == NULL)
|| info->dynamic_undefined_weak == 0))
|| ((h->def_regular || ELF_COMMON_DEF_P (h))
- && h->versioned == unversioned
&& info->version_info != NULL
- && bfd_hide_sym_by_version (info->version_info,
- h->root.root.string)))
+ && _bfd_elf_link_hide_sym_by_version (info, h)))
{
eh->local_ref = 2;
return TRUE;
}
- /* bfd_hide_sym_by_version can't be used to check if a versioned symbol
- is hidden. It has to be syncd with _bfd_elf_link_assign_sym_version
- to get the correct answer. */
- if (h->versioned == unversioned)
- eh->local_ref = 1;
-
+ eh->local_ref = 1;
return FALSE;
}