diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2018-08-27 15:41:09 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2018-08-27 15:42:14 -0700 |
commit | 90c745dc545408a6a3115ff97485672826649ade (patch) | |
tree | 852cc043ddd5910306b2530acdc72bfb718fb926 /ld | |
parent | 3bf9c013e4a7b72aaa7e242e163a776ad7347c26 (diff) | |
download | gdb-90c745dc545408a6a3115ff97485672826649ade.zip gdb-90c745dc545408a6a3115ff97485672826649ade.tar.gz gdb-90c745dc545408a6a3115ff97485672826649ade.tar.bz2 |
x86: Don't mask out the GNU_PROPERTY_X86_UINT32_VALID bit
Since only the GNU_PROPERTY_X86_UINT32_VALID bit may be set in data-only
relocatable objects which don't contain any instructions, linker
shouldn't mask out the GNU_PROPERTY_X86_UINT32_VALID bit when merging
GNU_PROPERTY_X86_XXX bits. Otherwise, linker output doesn't contain
GNU_PROPERTY_X86_XXX property with any data-only relocatable inputs.
This patch keeps the GNU_PROPERTY_X86_UINT32_VALID bit and updates
readelf to print "<None>" if GNU_PROPERTY_X86_XXX property only has
the GNU_PROPERTY_X86_UINT32_VALID bit.
bfd/
* elfxx-x86.c (_bfd_x86_elf_parse_gnu_properties): Don't mask
out the GNU_PROPERTY_X86_UINT32_VALID bit.
binutils/
* readelf.c (decode_x86_isa): Print <None> if bitmask only
contains the GNU_PROPERTY_X86_UINT32_VALID bit.
(decode_x86_feature_1): Likewise.
(decode_x86_feature_2): Likewise.
(print_gnu_property_note): Don't mask out the
GNU_PROPERTY_X86_UINT32_VALID bit.
* testsuite/binutils-all/i386/pr21231b.d: Updated.
* testsuite/binutils-all/x86-64/pr21231b.d: Likewise.
gas/
* testsuite/gas/i386/i386.exp: Run property-1 and
x86-64-property-1.
* testsuite/gas/i386/property-1.d: New file.
* testsuite/gas/i386/property-1.s: Likewise.
* testsuite/gas/i386/x86-64-property-1.d: Likewise.
ld/
* testsuite/ld-i386/i386.exp: Run property-x86-5.
* testsuite/ld-i386/property-x86-5.d: New file.
* testsuite/ld-x86-64/property-x86-5-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-5.d: Likewise.
* testsuite/ld-x86-64/property-x86-5a.s: Likewise.
* testsuite/ld-x86-64/property-x86-5b.s: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run property-x86-5 and
property-x86-5-x32.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 11 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/i386.exp | 1 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/property-x86-5.d | 11 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/property-x86-5-x32.d | 11 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/property-x86-5.d | 11 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/property-x86-5a.s | 52 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/property-x86-5b.s | 31 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/x86-64.exp | 2 |
8 files changed, 130 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 96232df..0cf02ab 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,14 @@ +2018-08-27 H.J. Lu <hongjiu.lu@intel.com> + + * testsuite/ld-i386/i386.exp: Run property-x86-5. + * testsuite/ld-i386/property-x86-5.d: New file. + * testsuite/ld-x86-64/property-x86-5-x32.d: Likewise. + * testsuite/ld-x86-64/property-x86-5.d: Likewise. + * testsuite/ld-x86-64/property-x86-5a.s: Likewise. + * testsuite/ld-x86-64/property-x86-5b.s: Likewise. + * testsuite/ld-x86-64/x86-64.exp: Run property-x86-5 and + property-x86-5-x32. + 2018-08-26 Alan Modra <amodra@gmail.com> PR 23571 diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp index d1aa350..8a5bdf0 100644 --- a/ld/testsuite/ld-i386/i386.exp +++ b/ld/testsuite/ld-i386/i386.exp @@ -433,6 +433,7 @@ run_dump_test "pr20515" run_dump_test "property-x86-3" run_dump_test "property-x86-4a" run_dump_test "property-x86-4b" +run_dump_test "property-x86-5" run_dump_test "property-x86-ibt1a" run_dump_test "property-x86-ibt1b" run_dump_test "property-x86-ibt2" diff --git a/ld/testsuite/ld-i386/property-x86-5.d b/ld/testsuite/ld-i386/property-x86-5.d new file mode 100644 index 0000000..e1b3a5b --- /dev/null +++ b/ld/testsuite/ld-i386/property-x86-5.d @@ -0,0 +1,11 @@ +#source: ../ld-x86-64/property-x86-5a.s +#source: ../ld-x86-64/property-x86-5b.s +#as: --32 +#ld: -m elf_i386 +#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 ISA needed: CMOV + x86 ISA used: <None> diff --git a/ld/testsuite/ld-x86-64/property-x86-5-x32.d b/ld/testsuite/ld-x86-64/property-x86-5-x32.d new file mode 100644 index 0000000..4a60736 --- /dev/null +++ b/ld/testsuite/ld-x86-64/property-x86-5-x32.d @@ -0,0 +1,11 @@ +#source: property-x86-5a.s +#source: property-x86-5b.s +#as: --x32 +#ld: -m elf32_x86_64 +#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 ISA needed: CMOV + x86 ISA used: <None> diff --git a/ld/testsuite/ld-x86-64/property-x86-5.d b/ld/testsuite/ld-x86-64/property-x86-5.d new file mode 100644 index 0000000..b7f8cbd --- /dev/null +++ b/ld/testsuite/ld-x86-64/property-x86-5.d @@ -0,0 +1,11 @@ +#source: property-x86-5a.s +#source: property-x86-5b.s +#as: --64 -defsym __64_bit__=1 +#ld: -m elf_x86_64 +#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 ISA needed: CMOV + x86 ISA used: <None> diff --git a/ld/testsuite/ld-x86-64/property-x86-5a.s b/ld/testsuite/ld-x86-64/property-x86-5a.s new file mode 100644 index 0000000..7b5b823 --- /dev/null +++ b/ld/testsuite/ld-x86-64/property-x86-5a.s @@ -0,0 +1,52 @@ + .text + .globl _start +_start: + .byte 0 + + .section ".note.gnu.property", "a" +.ifdef __64_bit__ + .p2align 3 +.else + .p2align 2 +.endif + .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: +.ifdef __64_bit__ + .p2align 3 +.else + .p2align 2 +.endif + /* GNU_PROPERTY_X86_ISA_1_NEEDED */ + .long 0xc0008000 /* pr_type. */ + .long 5f - 4f /* pr_datasz. */ +4: + .long 0x1 +5: +.ifdef __64_bit__ + .p2align 3 +.else + .p2align 2 +.endif +.ifdef __64_bit__ + .p2align 3 +.else + .p2align 2 +.endif + /* GNU_PROPERTY_X86_ISA_1_USED */ + .long 0xc0010000 /* pr_type. */ + .long 5f - 4f /* pr_datasz. */ +4: + /* GNU_PROPERTY_X86_UINT32_VALID */ + .long 0x80000000 +5: +.ifdef __64_bit__ + .p2align 3 +.else + .p2align 2 +.endif +3: diff --git a/ld/testsuite/ld-x86-64/property-x86-5b.s b/ld/testsuite/ld-x86-64/property-x86-5b.s new file mode 100644 index 0000000..8857c11 --- /dev/null +++ b/ld/testsuite/ld-x86-64/property-x86-5b.s @@ -0,0 +1,31 @@ + .section ".note.gnu.property", "a" +.ifdef __64_bit__ + .p2align 3 +.else + .p2align 2 +.endif + .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: +.ifdef __64_bit__ + .p2align 3 +.else + .p2align 2 +.endif + /* GNU_PROPERTY_X86_ISA_1_USED */ + .long 0xc0010000 /* pr_type. */ + .long 5f - 4f /* pr_datasz. */ +4: + /* GNU_PROPERTY_X86_UINT32_VALID */ + .long 0x80000000 +5: +.ifdef __64_bit__ + .p2align 3 +.else + .p2align 2 +.endif +3: diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp index 41f40e7..5c1f90c 100644 --- a/ld/testsuite/ld-x86-64/x86-64.exp +++ b/ld/testsuite/ld-x86-64/x86-64.exp @@ -353,6 +353,8 @@ run_dump_test "property-x86-4b" run_dump_test "property-x86-3-x32" run_dump_test "property-x86-4a-x32" run_dump_test "property-x86-4b-x32" +run_dump_test "property-x86-5" +run_dump_test "property-x86-5-x32" run_dump_test "property-x86-ibt1a" run_dump_test "property-x86-ibt1b" run_dump_test "property-x86-ibt1a-x32" |