[binutils-gdb] aarch64: adapt tests for PAC PLT to use selectable GNU properties

Matthieu Longo mlongo@sourceware.org
Mon Dec 2 15:21:06 GMT 2024


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a32bc164a6b74dcb3138c89226554eceec1b6555

commit a32bc164a6b74dcb3138c89226554eceec1b6555
Author: Matthieu Longo <matthieu.longo@arm.com>
Date:   Fri Nov 29 14:59:50 2024 +0000

    aarch64: adapt tests for PAC PLT to use selectable GNU properties

Diff:
---
 .../protections/{pac-plt-1.d => pac-plt-1-a.d}     |  5 +--
 ld/testsuite/ld-aarch64/protections/pac-plt-1-b.d  | 36 ++++++++++++++++++++++
 ld/testsuite/ld-aarch64/protections/pac-plt-2.d    |  6 ++--
 3 files changed, 43 insertions(+), 4 deletions(-)

diff --git a/ld/testsuite/ld-aarch64/protections/pac-plt-1.d b/ld/testsuite/ld-aarch64/protections/pac-plt-1-a.d
similarity index 87%
rename from ld/testsuite/ld-aarch64/protections/pac-plt-1.d
rename to ld/testsuite/ld-aarch64/protections/pac-plt-1-a.d
index ac9467035c8..fc10ec7070b 100644
--- a/ld/testsuite/ld-aarch64/protections/pac-plt-1.d
+++ b/ld/testsuite/ld-aarch64/protections/pac-plt-1-a.d
@@ -1,6 +1,7 @@
-#source: bti-plt-1.s
+#name: Specifying '-z pac-plt' forces the generation of a PAC PLT (shared)
+#source: bti-pac-plt.s
 #target: [check_shared_lib_support]
-#as: -mabi=lp64 --defsym __guard_property_bti__=1
+#as: -mabi=lp64
 #ld: -shared -z pac-plt -T bti-plt.ld
 #objdump: -dr -j .plt
 
diff --git a/ld/testsuite/ld-aarch64/protections/pac-plt-1-b.d b/ld/testsuite/ld-aarch64/protections/pac-plt-1-b.d
new file mode 100644
index 00000000000..7a0fd59718d
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/protections/pac-plt-1-b.d
@@ -0,0 +1,36 @@
+#name: No '-z pac-plt' with feature properties (PAC) does not force the generation of PAC PLT (shared)
+## Note: Use of PAC in PLT sequences is a contract between the dynamic loader
+## and the static linker, it is independent of whether the relocatable objects
+## use PAC. So it means that the PAC flag in the GNU property can be completely
+## ignored contrarily to BTI which is all or nothing property for a link unit.
+#source: bti-pac-plt.s
+#target: [check_shared_lib_support]
+#as: -mabi=lp64
+#ld: -shared -T bti-plt.ld
+#objdump: -dr -j .plt
+
+[^:]*: *file format elf64-.*aarch64
+
+Disassembly of section \.plt:
+
+[0-9a-f]+ <\.plt>:
+.*:	a9bf7bf0 	stp	x16, x30, \[sp, #-16\]!
+.*:	90000090 	adrp	x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*:	f9400e11 	ldr	x17, \[x16, #24\]
+.*:	91006210 	add	x16, x16, #0x18
+.*:	d61f0220 	br	x17
+.*:	d503201f 	nop
+.*:	d503201f 	nop
+.*:	d503201f 	nop
+
+[0-9a-f]+ <.*>:
+.*:	90000090 	adrp	x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*:	f9401211 	ldr	x17, \[x16, #32\]
+.*:	91008210 	add	x16, x16, #0x20
+.*:	d61f0220 	br	x17
+
+[0-9a-f]+ <.*>:
+.*:	90000090 	adrp	x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*:	f9401611 	ldr	x17, \[x16, #40\]
+.*:	9100a210 	add	x16, x16, #0x28
+.*:	d61f0220 	br	x17
diff --git a/ld/testsuite/ld-aarch64/protections/pac-plt-2.d b/ld/testsuite/ld-aarch64/protections/pac-plt-2.d
index f0d2710e82b..1c3d7f4b131 100644
--- a/ld/testsuite/ld-aarch64/protections/pac-plt-2.d
+++ b/ld/testsuite/ld-aarch64/protections/pac-plt-2.d
@@ -2,8 +2,10 @@
 #target: [check_shared_lib_support]
 #ld: -shared -z pac-plt -T bti-plt.ld
 #objdump: -dr -j .plt
-#...
-Disassembly of section .plt:
+
+[^:]*: *file format elf64-.*aarch64
+
+Disassembly of section \.plt:
 
 .* \<.plt\>:
 .*:	a9bf7bf0 	stp	x16, x30, \[sp, #-16\]!


More information about the Binutils-cvs mailing list