diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2017-08-23 10:15:39 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2017-08-23 10:15:58 -0700 |
commit | 73784fa565bd66f1ac165816c03e5217b7d67bbc (patch) | |
tree | 00a650b903a28e8c12a40a7a836c5bf5baf9c92a /ld | |
parent | 6e41ddec97d402c6c150701da0f70d40bd6ed5ca (diff) | |
download | gdb-73784fa565bd66f1ac165816c03e5217b7d67bbc.zip gdb-73784fa565bd66f1ac165816c03e5217b7d67bbc.tar.gz gdb-73784fa565bd66f1ac165816c03e5217b7d67bbc.tar.bz2 |
x86: Clear extern_protected_data for GNU_PROPERTY_NO_COPY_ON_PROTECTED
When GNU_PROPERTY_NO_COPY_ON_PROTECTED is set, it indicates that there
are no copy relocations against protected data symbols. When linker
sees GNU_PROPERTY_NO_COPY_ON_PROTECTED on any input relocatable file,
it sets extern_protected_data to FALSE.
bfd/
* elf32-i386.c (elf_i386_link_setup_gnu_properties): Set
extern_protected_data to FALSE if GNU_PROPERTY_NO_COPY_ON_PROTECTED
is set on any input relocatable file.
* elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Likewise.
ld/
* testsuite/ld-i386/i386.exp: Run protected7.
* testsuite/ld-i386/protected7.d: New file.
* testsuite/ld-i386/protected7.s: Likewise.
* testsuite/ld-x86-64/protected8.d: Likewise.
* testsuite/ld-x86-64/protected8.s: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run protected8.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/i386.exp | 1 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/protected7.d | 13 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/protected7.s | 31 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/protected8.d | 13 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/protected8.s | 31 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/x86-64.exp | 1 |
7 files changed, 99 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 0859f70..c499de7 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,12 @@ +2017-08-23 H.J. Lu <hongjiu.lu@intel.com> + + * testsuite/ld-i386/i386.exp: Run protected7. + * testsuite/ld-i386/protected7.d: New file. + * testsuite/ld-i386/protected7.s: Likewise. + * testsuite/ld-x86-64/protected8.d: Likewise. + * testsuite/ld-x86-64/protected8.s: Likewise. + * testsuite/ld-x86-64/x86-64.exp: Run protected8. + 2017-08-23 Alan Modra <amodra@gmail.com> * testsuite/ld-gc/pr19161.d: Don't xfail hppa. diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp index 27d622e..3c5de02 100644 --- a/ld/testsuite/ld-i386/i386.exp +++ b/ld/testsuite/ld-i386/i386.exp @@ -308,6 +308,7 @@ run_dump_test "protected4" run_dump_test "protected5" run_dump_test "protected6a" run_dump_test "protected6b" +run_dump_test "protected7" run_dump_test "tlspie1" run_dump_test "tlspie2" run_dump_test "tlspie3a" diff --git a/ld/testsuite/ld-i386/protected7.d b/ld/testsuite/ld-i386/protected7.d new file mode 100644 index 0000000..aafa2d8 --- /dev/null +++ b/ld/testsuite/ld-i386/protected7.d @@ -0,0 +1,13 @@ +#as: --32 +#ld: -shared -melf_i386 +#objdump: -drw + +.*: +file format .* + + +Disassembly of section .text: + +0+[a-f0-9]+ <bar>: +[ ]*[a-f0-9]+: 8b 81 [a-f0-9][a-f0-9] [a-f0-9][a-f0-9] 00 00 mov 0x[a-f0-9]+\(%ecx\),%eax +[ ]*[a-f0-9]+: c3 ret +#pass diff --git a/ld/testsuite/ld-i386/protected7.s b/ld/testsuite/ld-i386/protected7.s new file mode 100644 index 0000000..bc2bc91 --- /dev/null +++ b/ld/testsuite/ld-i386/protected7.s @@ -0,0 +1,31 @@ + .protected foo +.globl foo + .data + .align 4 + .type foo, @object + .size foo, 4 +foo: + .long 1 + .text +.globl bar + .type bar, @function +bar: + movl foo@GOTOFF(%ecx), %eax + ret + .size bar, .-bar + + .section ".note.gnu.property", "a" + .p2align 2 + .long 1f - 0f /* name length. */ + .long 3f - 1f /* data length. */ + /* NT_GNU_PROPERTY_TYPE_0 */ + .long 5 /* note type. */ +0: + .asciz "GNU" /* vendor name. */ +1: + .p2align 2 + /* GNU_PROPERTY_NO_COPY_ON_PROTECTED */ + .long 2 /* pr_type. */ + .long 0 /* pr_datasz. */ + .p2align 2 +3: diff --git a/ld/testsuite/ld-x86-64/protected8.d b/ld/testsuite/ld-x86-64/protected8.d new file mode 100644 index 0000000..22a36ac --- /dev/null +++ b/ld/testsuite/ld-x86-64/protected8.d @@ -0,0 +1,13 @@ +#as: --64 +#ld: -shared -melf_x86_64 +#objdump: -drw + +.*: +file format .* + + +Disassembly of section .text: + +0+[a-f0-9]+ <bar>: +[ ]*[a-f0-9]+: 8b 05 ([0-9a-f]{2} ){4} * mov 0x[a-f0-9]+\(%rip\),%eax # [a-f0-9]+ <foo> +[ ]*[a-f0-9]+: c3 retq * +#pass diff --git a/ld/testsuite/ld-x86-64/protected8.s b/ld/testsuite/ld-x86-64/protected8.s new file mode 100644 index 0000000..314433d --- /dev/null +++ b/ld/testsuite/ld-x86-64/protected8.s @@ -0,0 +1,31 @@ + .protected foo +.globl foo + .data + .align 4 + .type foo, @object + .size foo, 4 +foo: + .long 1 + .text +.globl bar + .type bar, @function +bar: + movl foo(%rip), %eax + ret + .size bar, .-bar + + .section ".note.gnu.property", "a" + .p2align 3 + .long 1f - 0f /* name length. */ + .long 3f - 2f /* data length. */ + /* NT_GNU_PROPERTY_TYPE_0 */ + .long 5 /* note type. */ +0: .asciz "GNU" /* vendor name. */ +1: + .p2align 3 +2: + /* GNU_PROPERTY_NO_COPY_ON_PROTECTED */ + .long 2 /* pr_type. */ + .long 0 /* pr_datasz. */ + .p2align 3 +3: diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp index 4631157..0b795df 100644 --- a/ld/testsuite/ld-x86-64/x86-64.exp +++ b/ld/testsuite/ld-x86-64/x86-64.exp @@ -291,6 +291,7 @@ run_dump_test "protected6a" run_dump_test "protected6b" run_dump_test "protected7a" run_dump_test "protected7b" +run_dump_test "protected8" run_dump_test "tlsle1" run_dump_test "tlspie1" run_dump_test "tlspie2a" |