From e3c0e327923e27c7d96e6e44e22e10998ff158d7 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Sat, 11 Apr 2015 07:34:49 -0700 Subject: Replace SYMBOLIC_BIND with SYMBOL_REFERENCES_LOCAL When checking R_386_GOTOFF/R_X86_64_GOTOFF64 for building shared library, we should check SYMBOL_REFERENCES_LOCAL instead of SYMBOLIC_BIND to cover more cases. bfd/ * elf32-i386.c (elf_i386_relocate_section): Replace SYMBOLIC_BIND with SYMBOL_REFERENCES_LOCAL when checking R_386_GOTOFF against protected data symbol when building shared library. * elf64-x86-64.c (elf_x86_64_relocate_section): Check R_X86_64_GOTOFF64 against undefined symbol and replace SYMBOLIC_BIND with SYMBOL_REFERENCES_LOCAL when checking R_X86_64_GOTOFF64 against protected data symbol when building shared library. ld/testsuite/ * ld-i386/i386.exp: Run protected6a. * ld-i386/protected6.d: Renamed to ... * ld-i386/protected6a.d: This. * ld-x86-64/hidden4.d: New file. * ld-x86-64/hidden4.s: Likewise. * ld-x86-64/hidden5.d: Likewise. * ld-x86-64/hidden5.s: Likewise. * ld-x86-64/protected6.d: Renamed to ... * ld-x86-64/protected6a.d: This. * ld-x86-64/x86-64.exp: Run hidden4, hidden5, protected6a, protected7a and protected7b. --- ld/testsuite/ChangeLog | 14 ++++++++++++++ ld/testsuite/ld-i386/i386.exp | 2 +- ld/testsuite/ld-i386/protected6.d | 3 --- ld/testsuite/ld-i386/protected6a.d | 4 ++++ ld/testsuite/ld-x86-64/hidden4.d | 3 +++ ld/testsuite/ld-x86-64/hidden4.s | 8 ++++++++ ld/testsuite/ld-x86-64/hidden5.d | 3 +++ ld/testsuite/ld-x86-64/hidden5.s | 7 +++++++ ld/testsuite/ld-x86-64/protected6.d | 3 --- ld/testsuite/ld-x86-64/protected6a.d | 4 ++++ ld/testsuite/ld-x86-64/x86-64.exp | 4 +++- 11 files changed, 47 insertions(+), 8 deletions(-) delete mode 100644 ld/testsuite/ld-i386/protected6.d create mode 100644 ld/testsuite/ld-i386/protected6a.d create mode 100644 ld/testsuite/ld-x86-64/hidden4.d create mode 100644 ld/testsuite/ld-x86-64/hidden4.s create mode 100644 ld/testsuite/ld-x86-64/hidden5.d create mode 100644 ld/testsuite/ld-x86-64/hidden5.s delete mode 100644 ld/testsuite/ld-x86-64/protected6.d create mode 100644 ld/testsuite/ld-x86-64/protected6a.d (limited to 'ld') diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index c4bc387..8b45279 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,17 @@ +2015-04-11 H.J. Lu + + * ld-i386/i386.exp: Run protected6a. + * ld-i386/protected6.d: Renamed to ... + * ld-i386/protected6a.d: This. + * ld-x86-64/hidden4.d: New file. + * ld-x86-64/hidden4.s: Likewise. + * ld-x86-64/hidden5.d: Likewise. + * ld-x86-64/hidden5.s: Likewise. + * ld-x86-64/protected6.d: Renamed to ... + * ld-x86-64/protected6a.d: This. + * ld-x86-64/x86-64.exp: Run hidden4, hidden5, protected6a, + protected7a and protected7b. + 2015-04-10 H.J. Lu PR ld/pr17709 diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp index 3dd1139..0c0fd96 100644 --- a/ld/testsuite/ld-i386/i386.exp +++ b/ld/testsuite/ld-i386/i386.exp @@ -236,7 +236,7 @@ run_dump_test "protected2" run_dump_test "protected3" run_dump_test "protected4" run_dump_test "protected5" -run_dump_test "protected6" +run_dump_test "protected6a" run_dump_test "tlspie1" run_dump_test "tlspie2" run_dump_test "nogot1" diff --git a/ld/testsuite/ld-i386/protected6.d b/ld/testsuite/ld-i386/protected6.d deleted file mode 100644 index 37d5132..0000000 --- a/ld/testsuite/ld-i386/protected6.d +++ /dev/null @@ -1,3 +0,0 @@ -#as: --32 -#ld: -shared -melf_i386 -#error: .*relocation R_386_GOTOFF against protected data `foo' can not be used when making a shared object diff --git a/ld/testsuite/ld-i386/protected6a.d b/ld/testsuite/ld-i386/protected6a.d new file mode 100644 index 0000000..7dc3504 --- /dev/null +++ b/ld/testsuite/ld-i386/protected6a.d @@ -0,0 +1,4 @@ +#source: protected6.s +#as: --32 +#ld: -shared -melf_i386 +#error: .*relocation R_386_GOTOFF against protected data `foo' can not be used when making a shared object diff --git a/ld/testsuite/ld-x86-64/hidden4.d b/ld/testsuite/ld-x86-64/hidden4.d new file mode 100644 index 0000000..2f36d008 --- /dev/null +++ b/ld/testsuite/ld-x86-64/hidden4.d @@ -0,0 +1,3 @@ +#as: --64 +#ld: -shared -melf_x86_64 +#error: .*relocation R_X86_64_GOTOFF64 against undefined hidden symbol `foo' can not be used when making a shared object diff --git a/ld/testsuite/ld-x86-64/hidden4.s b/ld/testsuite/ld-x86-64/hidden4.s new file mode 100644 index 0000000..3e6a2a1 --- /dev/null +++ b/ld/testsuite/ld-x86-64/hidden4.s @@ -0,0 +1,8 @@ + .text +.globl bar + .type bar, @function +bar: + movabsq $foo@GOTOFF, %rax + .size bar, .-bar + .weak foo + .hidden foo diff --git a/ld/testsuite/ld-x86-64/hidden5.d b/ld/testsuite/ld-x86-64/hidden5.d new file mode 100644 index 0000000..2f36d008 --- /dev/null +++ b/ld/testsuite/ld-x86-64/hidden5.d @@ -0,0 +1,3 @@ +#as: --64 +#ld: -shared -melf_x86_64 +#error: .*relocation R_X86_64_GOTOFF64 against undefined hidden symbol `foo' can not be used when making a shared object diff --git a/ld/testsuite/ld-x86-64/hidden5.s b/ld/testsuite/ld-x86-64/hidden5.s new file mode 100644 index 0000000..f356076 --- /dev/null +++ b/ld/testsuite/ld-x86-64/hidden5.s @@ -0,0 +1,7 @@ + .text +.globl bar + .type bar, @function +bar: + movabsq $foo@GOTOFF, %rax + .size bar, .-bar + .hidden foo diff --git a/ld/testsuite/ld-x86-64/protected6.d b/ld/testsuite/ld-x86-64/protected6.d deleted file mode 100644 index 872a9f6..0000000 --- a/ld/testsuite/ld-x86-64/protected6.d +++ /dev/null @@ -1,3 +0,0 @@ -#as: --64 -#ld: -shared -melf_x86_64 -#error: .*relocation R_X86_64_GOTOFF64 against protected data `foo' can not be used when making a shared object diff --git a/ld/testsuite/ld-x86-64/protected6a.d b/ld/testsuite/ld-x86-64/protected6a.d new file mode 100644 index 0000000..3a7963f --- /dev/null +++ b/ld/testsuite/ld-x86-64/protected6a.d @@ -0,0 +1,4 @@ +#source: protected6.s +#as: --64 +#ld: -shared -melf_x86_64 +#error: .*relocation R_X86_64_GOTOFF64 against protected data `foo' can not be used when making a shared object diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp index 63754ef..213a4c0 100644 --- a/ld/testsuite/ld-x86-64/x86-64.exp +++ b/ld/testsuite/ld-x86-64/x86-64.exp @@ -211,6 +211,8 @@ run_dump_test "tlsie3" run_dump_test "hidden1" run_dump_test "hidden2" run_dump_test "hidden3" +run_dump_test "hidden4" +run_dump_test "hidden5" run_dump_test "protected1" run_dump_test "protected2" run_dump_test "protected2-l1om" @@ -218,7 +220,7 @@ run_dump_test "protected3" run_dump_test "protected3-l1om" run_dump_test "protected4" run_dump_test "protected5" -run_dump_test "protected6" +run_dump_test "protected6a" run_dump_test "protected7a" run_dump_test "protected7b" run_dump_test "tlsle1" -- cgit v1.1