From 6f8bcf84a1bc7412dfee32328b370b6c4599a103 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 7 Apr 2010 02:41:35 +0000 Subject: [PATCH] Don't bind unique symbol locally. bfd/ 2010-04-06 H.J. Lu PR ld/11434 * elf-bfd.h (SYMBOLIC_BIND): Don't bind unique symbol locally. ld/testsuite/ 2010-04-06 H.J. Lu PR ld/11434 * ld/testsuite/ld-x86-64/unique1.d: New. * ld/testsuite/ld-x86-64/unique1.s: Likewise. * ld-x86-64/x86-64.exp: Run unique1. --- bfd/ChangeLog | 5 +++++ bfd/elf-bfd.h | 5 +++-- ld/ChangeLog | 8 ++++++++ ld/testsuite/ld-x86-64/unique1.d | 10 ++++++++++ ld/testsuite/ld-x86-64/unique1.s | 9 +++++++++ ld/testsuite/ld-x86-64/x86-64.exp | 1 + 6 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 ld/testsuite/ld-x86-64/unique1.d create mode 100644 ld/testsuite/ld-x86-64/unique1.s diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 6d425d1..1d4fecb 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2010-04-06 H.J. Lu + + PR ld/11434 + * elf-bfd.h (SYMBOLIC_BIND): Don't bind unique symbol locally. + 2010-04-06 Tristan Gingold * vms-lib.c (_bfd_vms_lib_write_archive_contents): Fix idd flags. diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 74348d3..05e17c8 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -2328,8 +2328,9 @@ extern asection _bfd_elf_large_com_section; while (0) /* Will a symbol be bound to the the definition within the shared - library, if any. */ + library, if any. A unique symbol can never be bound locally. */ #define SYMBOLIC_BIND(INFO, H) \ - ((INFO)->symbolic || ((INFO)->dynamic && !(H)->dynamic)) + (!(H)->unique_global \ + && ((INFO)->symbolic || ((INFO)->dynamic && !(H)->dynamic))) #endif /* _LIBELF_H_ */ diff --git a/ld/ChangeLog b/ld/ChangeLog index 1d8c9f6..3c3ef03 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,11 @@ +2010-04-06 H.J. Lu + + PR ld/11434 + * ld/testsuite/ld-x86-64/unique1.d: New. + * ld/testsuite/ld-x86-64/unique1.s: Likewise. + + * ld-x86-64/x86-64.exp: Run unique1. + 2010-04-05 Kai Tietz * emultempl/pep.em (U): Macro modified. diff --git a/ld/testsuite/ld-x86-64/unique1.d b/ld/testsuite/ld-x86-64/unique1.d new file mode 100644 index 0000000..00afd38 --- /dev/null +++ b/ld/testsuite/ld-x86-64/unique1.d @@ -0,0 +1,10 @@ +#name: STB_GNU_UNIQUE with -Bsymbolic +#as: --64 +#ld: -melf_x86_64 -shared -Bsymbolic +#readelf: -rs --wide + +#... +[0-9a-f]+ +[0-9a-f]+ +R_X86_64_GLOB_DAT +[0-9a-f]+ bar \+ 0 +#... + +[0-9]+: +[0-9a-f]+ +8 +OBJECT +UNIQUE +DEFAULT +[0-9]+ bar +#pass diff --git a/ld/testsuite/ld-x86-64/unique1.s b/ld/testsuite/ld-x86-64/unique1.s new file mode 100644 index 0000000..3def1b3 --- /dev/null +++ b/ld/testsuite/ld-x86-64/unique1.s @@ -0,0 +1,9 @@ + .text +foo: + movq bar@GOTPCREL(%rip), %rbp + .weak bar + .data + .type bar, @gnu_unique_object + .size bar, 8 +bar: + .quad 8 diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp index 89a2e14..a8ebd41 100644 --- a/ld/testsuite/ld-x86-64/x86-64.exp +++ b/ld/testsuite/ld-x86-64/x86-64.exp @@ -97,3 +97,4 @@ run_dump_test "protected3" run_dump_test "protected3-l1om" run_dump_test "tlsle1" run_dump_test "tlspie1" +run_dump_test "unique1" -- 2.7.4