diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2018-05-26 04:27:09 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2018-05-26 04:27:24 -0700 |
commit | 099bb8fb97d79d03a20926d6014a5fc27a5ca75e (patch) | |
tree | bb0da692186056971e42f952769ecf154378133e /ld/testsuite/ld-i386 | |
parent | d7460de3eadeb5b7665ad8569f54e59eccdef378 (diff) | |
download | gdb-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 'ld/testsuite/ld-i386')
-rw-r--r-- | ld/testsuite/ld-i386/pr23194.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/pr23194.map | 1 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/pr23194.s | 3 |
3 files changed, 4 insertions, 2 deletions
diff --git a/ld/testsuite/ld-i386/pr23194.d b/ld/testsuite/ld-i386/pr23194.d index b5e8c33..f6d2a03 100644 --- a/ld/testsuite/ld-i386/pr23194.d +++ b/ld/testsuite/ld-i386/pr23194.d @@ -4,4 +4,4 @@ Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 1 entry: Offset Info Type Sym. Value Symbol's Name -[0-9a-f]+ +[0-9a-f]+ +R_386_RELATIVE + +[0-9a-f]+ +[0-9a-f]+ +R_386_GLOB_DAT +[0-9a-f]+ +foobar@@FOO diff --git a/ld/testsuite/ld-i386/pr23194.map b/ld/testsuite/ld-i386/pr23194.map index 353c194..196dac9 100644 --- a/ld/testsuite/ld-i386/pr23194.map +++ b/ld/testsuite/ld-i386/pr23194.map @@ -1,6 +1,7 @@ FOO { global: bar; + foobar; local: *; }; diff --git a/ld/testsuite/ld-i386/pr23194.s b/ld/testsuite/ld-i386/pr23194.s index 32693fe..a64bae1 100644 --- a/ld/testsuite/ld-i386/pr23194.s +++ b/ld/testsuite/ld-i386/pr23194.s @@ -3,10 +3,11 @@ .globl foo .type foo, @function foo: - ret + movl foobar@GOT(%ebx), %eax .size foo, .-foo .globl bar .type bar, @function bar: jmp *foo@GOT(%eax) .size bar, .-bar + .comm foobar,30,4 |