aboutsummaryrefslogtreecommitdiff
path: root/ld
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 /ld
parentd7460de3eadeb5b7665ad8569f54e59eccdef378 (diff)
downloadfsf-binutils-gdb-099bb8fb97d79d03a20926d6014a5fc27a5ca75e.zip
fsf-binutils-gdb-099bb8fb97d79d03a20926d6014a5fc27a5ca75e.tar.gz
fsf-binutils-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')
-rw-r--r--ld/ChangeLog12
-rw-r--r--ld/testsuite/ld-i386/pr23194.d2
-rw-r--r--ld/testsuite/ld-i386/pr23194.map1
-rw-r--r--ld/testsuite/ld-i386/pr23194.s3
-rw-r--r--ld/testsuite/ld-x86-64/pr23194.d2
-rw-r--r--ld/testsuite/ld-x86-64/pr23194.map1
-rw-r--r--ld/testsuite/ld-x86-64/pr23194.s3
7 files changed, 20 insertions, 4 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index d418b20..fa5f222 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,15 @@
+2018-05-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ 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.
+
2018-05-25 Alan Modra <amodra@gmail.com>
* po/BLD-POTFILES.in: Regenerate.
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
diff --git a/ld/testsuite/ld-x86-64/pr23194.d b/ld/testsuite/ld-x86-64/pr23194.d
index 6b12060..b907afb 100644
--- a/ld/testsuite/ld-x86-64/pr23194.d
+++ b/ld/testsuite/ld-x86-64/pr23194.d
@@ -4,4 +4,4 @@
Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entry:
Offset Info Type Symbol's Value Symbol's Name \+ Addend
-[0-9a-f]+ +[0-9a-f]+ +R_X86_64_RELATIVE +[0-9a-f]+
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_GLOB_DAT +[0-9a-f]+ +foobar@@FOO \+ 0
diff --git a/ld/testsuite/ld-x86-64/pr23194.map b/ld/testsuite/ld-x86-64/pr23194.map
index 353c194..196dac9 100644
--- a/ld/testsuite/ld-x86-64/pr23194.map
+++ b/ld/testsuite/ld-x86-64/pr23194.map
@@ -1,6 +1,7 @@
FOO {
global:
bar;
+ foobar;
local:
*;
};
diff --git a/ld/testsuite/ld-x86-64/pr23194.s b/ld/testsuite/ld-x86-64/pr23194.s
index 277c19d..34517bc 100644
--- a/ld/testsuite/ld-x86-64/pr23194.s
+++ b/ld/testsuite/ld-x86-64/pr23194.s
@@ -3,10 +3,11 @@
.globl foo
.type foo, @function
foo:
- ret
+ movq foobar@GOTPCREL(%rip), %rax
.size foo, .-foo
.globl bar
.type bar, @function
bar:
jmp *foo@GOTPCREL(%rip)
.size bar, .-bar
+ .comm foobar,30,4