diff options
author | Matthieu Longo <matthieu.longo@arm.com> | 2024-11-30 10:27:41 +0000 |
---|---|---|
committer | Matthieu Longo <matthieu.longo@arm.com> | 2024-12-02 15:18:40 +0000 |
commit | 79aff6ea0e8766a72c70679ae04767b6e57e192b (patch) | |
tree | a2ab5bf503e44d9e907a692a3694827b1d11ca10 | |
parent | 8949929a511a08928ce633561a6b5330a2270ee6 (diff) | |
download | gdb-79aff6ea0e8766a72c70679ae04767b6e57e192b.zip gdb-79aff6ea0e8766a72c70679ae04767b6e57e192b.tar.gz gdb-79aff6ea0e8766a72c70679ae04767b6e57e192b.tar.bz2 |
aarch64: adapt BTI tests to use selectable GNU properties
-rw-r--r-- | ld/testsuite/ld-aarch64/protections/bti-plt-1.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/protections/bti-plt-1.s | 38 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/protections/bti-plt-2.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/protections/bti-plt-2.s | 27 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/protections/bti-plt-3.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/protections/bti-plt-4.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/protections/bti-plt-5.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/protections/bti-warn.d | 10 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/protections/property-bti-pac1.s | 35 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/protections/property-bti-pac2.s | 40 |
10 files changed, 35 insertions, 125 deletions
diff --git a/ld/testsuite/ld-aarch64/protections/bti-plt-1.d b/ld/testsuite/ld-aarch64/protections/bti-plt-1.d index 9fd7c6b..b7d5f51 100644 --- a/ld/testsuite/ld-aarch64/protections/bti-plt-1.d +++ b/ld/testsuite/ld-aarch64/protections/bti-plt-1.d @@ -1,7 +1,7 @@ #name: Check -z force-bti emits BTI PLT (shared) #source: bti-plt-1.s #target: [check_shared_lib_support] -#as: -mabi=lp64 +#as: -mabi=lp64 -defsym __property_bti__=1 #ld: -shared -z force-bti -T bti-plt.ld #objdump: -dr -j .plt diff --git a/ld/testsuite/ld-aarch64/protections/bti-plt-1.s b/ld/testsuite/ld-aarch64/protections/bti-plt-1.s index 8bb39c4..413e24b 100644 --- a/ld/testsuite/ld-aarch64/protections/bti-plt-1.s +++ b/ld/testsuite/ld-aarch64/protections/bti-plt-1.s @@ -4,37 +4,9 @@ _start: bl foo bl bar -.ifndef __guard_property_bti__ - .section ".note.gnu.property", "a" - .p2align 3 - .long 1f - 0f /* name length */ - .long 5f - 2f /* data length */ - .long 5 /* note type */ -0: .asciz "GNU" /* vendor name */ -1: - .p2align 3 -2: .long 0xc0000000 /* pr_type. */ - .long 4f - 3f /* pr_datasz. */ -3: - .long 0x1 /* BTI. */ -4: - .p2align 3 -5: -.endif -.ifdef __property_pac__ - .section ".note.gnu.property", "a" - .p2align 3 - .long 1f - 0f /* name length */ - .long 5f - 2f /* data length */ - .long 5 /* note type */ -0: .asciz "GNU" /* vendor name */ -1: - .p2align 3 -2: .long 0xc0000000 /* pr_type. */ - .long 4f - 3f /* pr_datasz. */ -3: - .long 0x2 /* PAC. */ -4: - .p2align 3 -5: + +.ifdef __split_gnu_properties__ +.include "gnu-note-properties-selectable-split.inc" +.else +.include "gnu-note-properties-selectable-merged.inc" .endif diff --git a/ld/testsuite/ld-aarch64/protections/bti-plt-2.d b/ld/testsuite/ld-aarch64/protections/bti-plt-2.d index c34ab47..e404d53 100644 --- a/ld/testsuite/ld-aarch64/protections/bti-plt-2.d +++ b/ld/testsuite/ld-aarch64/protections/bti-plt-2.d @@ -2,7 +2,7 @@ #source: bti-plt-1.s #source: bti-plt-2.s #target: [check_shared_lib_support] -#as: -mabi=lp64 +#as: -mabi=lp64 -defsym __property_bti__=1 #ld: -shared -z force-bti -T bti-plt.ld #readelf: -n diff --git a/ld/testsuite/ld-aarch64/protections/bti-plt-2.s b/ld/testsuite/ld-aarch64/protections/bti-plt-2.s index fff945c..db06621 100644 --- a/ld/testsuite/ld-aarch64/protections/bti-plt-2.s +++ b/ld/testsuite/ld-aarch64/protections/bti-plt-2.s @@ -1,21 +1,14 @@ .text - .globl _start - .type _start,@function + .globl func2 + .type func2,@function func2: bl foo2 bl bar2 - .section ".note.gnu.property", "a" - .p2align 3 - .long 1f - 0f /* name length */ - .long 5f - 2f /* data length */ - .long 5 /* note type */ -0: .asciz "GNU" /* vendor name */ -1: - .p2align 3 -2: .long 0xc0000000 /* pr_type. */ - .long 4f - 3f /* pr_datasz. */ -3: - .long 0x1 /* BTI. */ -4: - .p2align 3 -5: + ret + .size func2, .-func2 + +.ifdef __split_gnu_properties__ +.include "gnu-note-properties-selectable-split.inc" +.else +.include "gnu-note-properties-selectable-merged.inc" +.endif diff --git a/ld/testsuite/ld-aarch64/protections/bti-plt-3.d b/ld/testsuite/ld-aarch64/protections/bti-plt-3.d index c82878e..80dbcec 100644 --- a/ld/testsuite/ld-aarch64/protections/bti-plt-3.d +++ b/ld/testsuite/ld-aarch64/protections/bti-plt-3.d @@ -1,7 +1,7 @@ #name: Check -z force-bti emits BTI PLT (exec) #source: bti-plt-1.s #target: [check_shared_lib_support] -#as: -mabi=lp64 +#as: -mabi=lp64 -defsym __property_bti__=1 #ld: -z force-bti -e _start -T bti-plt.ld -L./tmpdir -lbti-plt-so #objdump: -dr -j .plt diff --git a/ld/testsuite/ld-aarch64/protections/bti-plt-4.d b/ld/testsuite/ld-aarch64/protections/bti-plt-4.d index 04d3c7d..24a213b 100644 --- a/ld/testsuite/ld-aarch64/protections/bti-plt-4.d +++ b/ld/testsuite/ld-aarch64/protections/bti-plt-4.d @@ -1,7 +1,7 @@ #name: Check -z force-bti emits BTI feature (exec) #source: bti-plt-1.s #target: [check_shared_lib_support] -#as: -mabi=lp64 +#as: -mabi=lp64 -defsym __property_bti__=1 #ld: -z force-bti -e _start -T bti-plt.ld -L./tmpdir -lbti-plt-so #readelf: -n diff --git a/ld/testsuite/ld-aarch64/protections/bti-plt-5.d b/ld/testsuite/ld-aarch64/protections/bti-plt-5.d index ed0029b..b26fe5b 100644 --- a/ld/testsuite/ld-aarch64/protections/bti-plt-5.d +++ b/ld/testsuite/ld-aarch64/protections/bti-plt-5.d @@ -1,6 +1,6 @@ #name: BTI PLT with only GNU PROP #source: property-bti-pac1.s -#as: -mabi=lp64 -defsym __property_bti__=1 +#as: -mabi=lp64 #ld: -e _start -L./tmpdir -lbti-plt-so #objdump: -dr -j .plt #target: *linux* diff --git a/ld/testsuite/ld-aarch64/protections/bti-warn.d b/ld/testsuite/ld-aarch64/protections/bti-warn.d index d10cd10..9ec6e12 100644 --- a/ld/testsuite/ld-aarch64/protections/bti-warn.d +++ b/ld/testsuite/ld-aarch64/protections/bti-warn.d @@ -1,11 +1,11 @@ #name: Warn when both have GNU prop but neither BTI -#source: property-bti-pac2.s -#source: bti-plt-1.s +#source: property-bti-pac1.s +#source: bti-plt-2.s #target: [check_shared_lib_support] -#as: -mabi=lp64 --defsym __guard_property_bti__=1 --defsym __property_pac__=1 +#as: -mabi=lp64 --defsym __mask_property_bti__=1 --defsym __property_pac__=1 #ld: -shared -z force-bti -#warning: .*property-bti-pac2.*: warning: BTI turned on by -z force-bti.* -#warning: .*bti-plt-1.*: warning: BTI turned on by -z force-bti.* +#warning: .*property-bti-pac1.*: warning: BTI turned on by -z force-bti.* +#warning: .*bti-plt-2.*: warning: BTI turned on by -z force-bti.* #readelf: -n # Should warn about the missing input BTI NOTE but should diff --git a/ld/testsuite/ld-aarch64/protections/property-bti-pac1.s b/ld/testsuite/ld-aarch64/protections/property-bti-pac1.s index 414c927..17568c9 100644 --- a/ld/testsuite/ld-aarch64/protections/property-bti-pac1.s +++ b/ld/testsuite/ld-aarch64/protections/property-bti-pac1.s @@ -3,35 +3,10 @@ .type _start,@function _start: mov x1, #2 -.ifndef __mult__ bl foo + +.ifdef __split_gnu_properties__ +.include "gnu-note-properties-maskable-split.inc" +.else +.include "gnu-note-properties-maskable-merged.inc" .endif - .section ".note.gnu.property", "a" - .p2align 3 - .long 1f - 0f /* name length */ - .long 5f - 2f /* data length */ - .long 5 /* note type */ -0: .asciz "GNU" /* vendor name */ -1: - .p2align 3 -2: .long 0xc0000000 /* pr_type. */ - .long 4f - 3f /* pr_datasz. */ -3: - .long 0x2 /* PAC. */ -4: - .p2align 3 -5: - .p2align 3 - .long 1f - 0f /* name length */ - .long 5f - 2f /* data length */ - .long 5 /* note type */ -0: .asciz "GNU" /* vendor name */ -1: - .p2align 3 -2: .long 0xc0000000 /* pr_type. */ - .long 4f - 3f /* pr_datasz. */ -3: - .long 0x1 /* BTI. */ -4: - .p2align 3 -5: diff --git a/ld/testsuite/ld-aarch64/protections/property-bti-pac2.s b/ld/testsuite/ld-aarch64/protections/property-bti-pac2.s index cdec8d9..071640c 100644 --- a/ld/testsuite/ld-aarch64/protections/property-bti-pac2.s +++ b/ld/testsuite/ld-aarch64/protections/property-bti-pac2.s @@ -12,39 +12,9 @@ foo: add sp, sp, 16 ret .size foo, .-foo - .global bar - .type bar, %function -.ifdef __property_bti__ - .section ".note.gnu.property", "a" - .p2align 3 - .long 1f - 0f /* name length */ - .long 5f - 2f /* data length */ - .long 5 /* note type */ -0: .asciz "GNU" /* vendor name */ -1: - .p2align 3 -2: .long 0xc0000000 /* pr_type. */ - .long 4f - 3f /* pr_datasz. */ -3: - .long 0x1 /* BTI. */ -4: - .p2align 3 -5: -.endif -.ifdef __property_pac__ - .section ".note.gnu.property", "a" - .p2align 3 - .long 1f - 0f /* name length */ - .long 5f - 2f /* data length */ - .long 5 /* note type */ -0: .asciz "GNU" /* vendor name */ -1: - .p2align 3 -2: .long 0xc0000000 /* pr_type. */ - .long 4f - 3f /* pr_datasz. */ -3: - .long 0x2 /* PAC. */ -4: - .p2align 3 -5: + +.ifdef __split_gnu_properties__ +.include "gnu-note-properties-selectable-split.inc" +.else +.include "gnu-note-properties-selectable-merged.inc" .endif |