diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2020-10-06 15:38:23 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2020-10-06 15:38:34 -0700 |
commit | 574df58f5295ef2728526e6a73b5f429b05f2a8c (patch) | |
tree | 6b9e44b9368a64b1e19ae96174a1e39c40c034b1 /ld/testsuite/ld-x86-64 | |
parent | 981b570a53f525ee1776524297a55eef9415d50d (diff) | |
download | gdb-574df58f5295ef2728526e6a73b5f429b05f2a8c.zip gdb-574df58f5295ef2728526e6a73b5f429b05f2a8c.tar.gz gdb-574df58f5295ef2728526e6a73b5f429b05f2a8c.tar.bz2 |
x86: Properly merge -z ibt and -z shstk
Merge -z ibt and -z shstk only with GNU_PROPERTY_X86_FEATURE_1_AND, not
any GNU_PROPERTY_X86_UINT32_AND_XXX properties.
bfd/
PR ld/26711
* elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Merge -z ibt
and -z shstk only with GNU_PROPERTY_X86_FEATURE_1_AND.
ld/
PR ld/26711
* testsuite/ld-i386/i386.exp: Run ld/26711 tests.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-i386/pr26711-1.d: Likewise.
* testsuite/ld-i386/pr26711-2.d: Likewise.
* testsuite/ld-i386/pr26711-3.d: Likewise.
* testsuite/ld-x86-64/pr26711-1-x32.d: Likewise.
* testsuite/ld-x86-64/pr26711-1.d: Likewise.
* testsuite/ld-x86-64/pr26711-2-x32.d: Likewise.
* testsuite/ld-x86-64/pr26711-2.d: Likewise.
* testsuite/ld-x86-64/pr26711-3-x32.d: Likewise.
* testsuite/ld-x86-64/pr26711-3.d: Likewise.
* testsuite/ld-x86-64/pr26711.s: Likewise.
Diffstat (limited to 'ld/testsuite/ld-x86-64')
-rw-r--r-- | ld/testsuite/ld-x86-64/pr26711-1-x32.d | 10 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/pr26711-1.d | 10 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/pr26711-2-x32.d | 10 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/pr26711-2.d | 10 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/pr26711-3-x32.d | 10 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/pr26711-3.d | 10 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/pr26711.s | 33 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/x86-64.exp | 6 |
8 files changed, 99 insertions, 0 deletions
diff --git a/ld/testsuite/ld-x86-64/pr26711-1-x32.d b/ld/testsuite/ld-x86-64/pr26711-1-x32.d new file mode 100644 index 0000000..6701319 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr26711-1-x32.d @@ -0,0 +1,10 @@ +#source: pr26711.s +#source: start.s +#as: --x32 -mx86-used-note=no +#ld: -m elf32_x86_64 -z ibt +#readelf: -n + +Displaying notes found in: .note.gnu.property +[ ]+Owner[ ]+Data size[ ]+Description + GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0 + Properties: x86 feature: IBT diff --git a/ld/testsuite/ld-x86-64/pr26711-1.d b/ld/testsuite/ld-x86-64/pr26711-1.d new file mode 100644 index 0000000..d8e3cbf --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr26711-1.d @@ -0,0 +1,10 @@ +#source: pr26711.s +#source: start.s +#as: --64 -defsym __64_bit__=1 -mx86-used-note=no +#ld: -m elf_x86_64 -z ibt +#readelf: -n + +Displaying notes found in: .note.gnu.property +[ ]+Owner[ ]+Data size[ ]+Description + GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0 + Properties: x86 feature: IBT diff --git a/ld/testsuite/ld-x86-64/pr26711-2-x32.d b/ld/testsuite/ld-x86-64/pr26711-2-x32.d new file mode 100644 index 0000000..9822f8d --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr26711-2-x32.d @@ -0,0 +1,10 @@ +#source: pr26711.s +#source: start.s +#as: --x32 -mx86-used-note=no +#ld: -m elf32_x86_64 -z shstk +#readelf: -n + +Displaying notes found in: .note.gnu.property +[ ]+Owner[ ]+Data size[ ]+Description + GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0 + Properties: x86 feature: SHSTK diff --git a/ld/testsuite/ld-x86-64/pr26711-2.d b/ld/testsuite/ld-x86-64/pr26711-2.d new file mode 100644 index 0000000..e24cfbf --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr26711-2.d @@ -0,0 +1,10 @@ +#source: pr26711.s +#source: start.s +#as: --64 -defsym __64_bit__=1 -mx86-used-note=no +#ld: -m elf_x86_64 -z shstk +#readelf: -n + +Displaying notes found in: .note.gnu.property +[ ]+Owner[ ]+Data size[ ]+Description + GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0 + Properties: x86 feature: SHSTK diff --git a/ld/testsuite/ld-x86-64/pr26711-3-x32.d b/ld/testsuite/ld-x86-64/pr26711-3-x32.d new file mode 100644 index 0000000..0661c7d --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr26711-3-x32.d @@ -0,0 +1,10 @@ +#source: pr26711.s +#source: start.s +#as: --x32 -mx86-used-note=no +#ld: -m elf32_x86_64 -z ibt -z shstk +#readelf: -n + +Displaying notes found in: .note.gnu.property +[ ]+Owner[ ]+Data size[ ]+Description + GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0 + Properties: x86 feature: IBT, SHSTK diff --git a/ld/testsuite/ld-x86-64/pr26711-3.d b/ld/testsuite/ld-x86-64/pr26711-3.d new file mode 100644 index 0000000..87bc3cc --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr26711-3.d @@ -0,0 +1,10 @@ +#source: pr26711.s +#source: start.s +#as: --64 -defsym __64_bit__=1 -mx86-used-note=no +#ld: -m elf_x86_64 -z ibt -z shstk +#readelf: -n + +Displaying notes found in: .note.gnu.property +[ ]+Owner[ ]+Data size[ ]+Description + GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0 + Properties: x86 feature: IBT, SHSTK diff --git a/ld/testsuite/ld-x86-64/pr26711.s b/ld/testsuite/ld-x86-64/pr26711.s new file mode 100644 index 0000000..8fa185d --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr26711.s @@ -0,0 +1,33 @@ + .section ".note.gnu.property", "a" +.ifdef __64_bit__ + .p2align 3 +.else + .p2align 2 +.endif + .long 1f - 0f /* name length */ + .long 5f - 2f /* data length */ + .long 5 /* note type */ +0: .asciz "GNU" /* vendor name */ +1: +.ifdef __64_bit__ + .p2align 3 +.else + .p2align 2 +.endif +2: .long 0xc0001002 /* pr_type. */ + .long 4f - 3f /* pr_datasz. */ +3: + .long 0x30 +4: +.ifdef __64_bit__ + .p2align 3 +.else + .p2align 2 +.endif +5: + + .text + .globl foo + .type foo, @function +foo: + ret diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp index 2c2551f..59cad54 100644 --- a/ld/testsuite/ld-x86-64/x86-64.exp +++ b/ld/testsuite/ld-x86-64/x86-64.exp @@ -432,6 +432,12 @@ run_dump_test "pr25416-3" run_dump_test "pr25416-4" run_dump_test "pr26018" run_dump_test "pr26263" +run_dump_test "pr26711-1" +run_dump_test "pr26711-1-x32" +run_dump_test "pr26711-2" +run_dump_test "pr26711-2-x32" +run_dump_test "pr26711-3" +run_dump_test "pr26711-3-x32" if ![istarget "x86_64-*-linux*"] { return |