aarch64: adapt bti-far* tests to use selectable GNU properties
diff --git a/ld/testsuite/ld-aarch64/lib/aarch64-elf-lib.exp b/ld/testsuite/ld-aarch64/lib/aarch64-elf-lib.exp
index 4023da3..8a0cfbb 100644
--- a/ld/testsuite/ld-aarch64/lib/aarch64-elf-lib.exp
+++ b/ld/testsuite/ld-aarch64/lib/aarch64-elf-lib.exp
@@ -54,6 +54,6 @@
 
 proc run_dump_test_lp64 { testname } {
   run_dump_test $testname \
-    [list [list as "-mabi=lp64"] \
+    [list [list as "-mabi=lp64 -I\$srcdir/\$subdir"] \
 	  [list ld [concat "-m " [aarch64_choose_lp64_emul]]]]
 }
\ No newline at end of file
diff --git a/ld/testsuite/ld-aarch64/protections/bti-far-1.d b/ld/testsuite/ld-aarch64/protections/bti-far-1.d
index 3ca3f16..63fbb43 100644
--- a/ld/testsuite/ld-aarch64/protections/bti-far-1.d
+++ b/ld/testsuite/ld-aarch64/protections/bti-far-1.d
@@ -1,6 +1,7 @@
 #name: Check linker stubs with indirect calls handle BTI (shared lib).
 #source: bti-far.s
 #target: [check_shared_lib_support]
+#as: -defsym __property_bti__=1
 #ld: -shared -T bti-far.ld
 #objdump: -dr
 
@@ -49,34 +50,34 @@
 
 0000000000020020 <___veneer>:
    20020:	90091910 	adrp	x16, 12340000 <foo>
-   20024:	91012210 	add	x16, x16, #0x48
+   20024:	9100c210 	add	x16, x16, #0x30
    20028:	d61f0200 	br	x16
 	\.\.\.
 
 Disassembly of section \.far:
 
 0000000012340000 <foo>:
-    12340000:	9400000c 	bl	12340030 <___veneer>
+    12340000:	9400000e 	bl	12340038 <___veneer>
 
 0000000012340004 <bar>:
-    12340004:	9400000b 	bl	12340030 <___veneer>
+    12340004:	9400000d 	bl	12340038 <___veneer>
     12340008:	94000004 	bl	12340018 <__foo_veneer>
     1234000c:	00000000 	udf	#0
-    12340010:	14000010 	b	12340050 <___bti_veneer\+0x8>
+    12340010:	14000010 	b	12340050 <___veneer\+0x18>
     12340014:	d503201f 	nop
 
 0000000012340018 <__foo_veneer>:
-    12340018:	90f6e6d0 	adrp	x16, 18000 <\.plt>
+    12340018:	90f6e6d0 	adrp	x16, 18000 <.plt>
     1234001c:	9100e210 	add	x16, x16, #0x38
     12340020:	d61f0200 	br	x16
 	\.\.\.
 
-0000000012340030 <___veneer>:
-    12340030:	90f6e710 	adrp	x16, 20000 <_start>
-    12340034:	91006210 	add	x16, x16, #0x18
-    12340038:	d61f0200 	br	x16
-	\.\.\.
+0000000012340030 <___bti_veneer>:
+    12340030:	d503245f 	bti	c
+    12340034:	17fffff4 	b	12340004 <bar>
 
-0000000012340048 <___bti_veneer>:
-    12340048:	d503245f 	bti	c
-    1234004c:	17ffffee 	b	12340004 <bar>
+0000000012340038 <___veneer>:
+    12340038:	90f6e710 	adrp	x16, 20000 <_start>
+    1234003c:	91006210 	add	x16, x16, #0x18
+    12340040:	d61f0200 	br	x16
+	\.\.\.
diff --git a/ld/testsuite/ld-aarch64/protections/bti-far-2.d b/ld/testsuite/ld-aarch64/protections/bti-far-2.d
index ec26e36..cb59b37 100644
--- a/ld/testsuite/ld-aarch64/protections/bti-far-2.d
+++ b/ld/testsuite/ld-aarch64/protections/bti-far-2.d
@@ -1,5 +1,6 @@
 #name: Check linker stubs with indirect calls handle BTI (exe).
 #source: bti-far.s
+#as: -defsym __property_bti__=1
 #ld: -T bti-far.ld
 #objdump: -dr
 
@@ -24,7 +25,7 @@
 
 0000000000020020 <___veneer>:
    20020:	90091910 	adrp	x16, 12340000 <foo>
-   20024:	9100e210 	add	x16, x16, #0x38
+   20024:	91008210 	add	x16, x16, #0x20
    20028:	d61f0200 	br	x16
 	\.\.\.
 
@@ -37,25 +38,25 @@
 Disassembly of section \.far:
 
 0000000012340000 <foo>:
-    12340000:	94000008 	bl	12340020 <___veneer>
+    12340000:	9400000a 	bl	12340028 <___veneer>
 
 0000000012340004 <bar>:
-    12340004:	94000007 	bl	12340020 <___veneer>
+    12340004:	94000009 	bl	12340028 <___veneer>
     12340008:	97fffffe 	bl	12340000 <foo>
     1234000c:	00000000 	udf	#0
-    12340010:	1400000c 	b	12340040 <___bti_veneer\+0x8>
+    12340010:	1400000c 	b	12340040 <___veneer\+0x18>
     12340014:	d503201f 	nop
 
 0000000012340018 <__foo_bti_veneer>:
     12340018:	d503245f 	bti	c
     1234001c:	17fffff9 	b	12340000 <foo>
 
-0000000012340020 <___veneer>:
-    12340020:	90f6e710 	adrp	x16, 20000 <_start>
-    12340024:	91006210 	add	x16, x16, #0x18
-    12340028:	d61f0200 	br	x16
-	\.\.\.
+0000000012340020 <___bti_veneer>:
+    12340020:	d503245f 	bti	c
+    12340024:	17fffff8 	b	12340004 <bar>
 
-0000000012340038 <___bti_veneer>:
-    12340038:	d503245f 	bti	c
-    1234003c:	17fffff2 	b	12340004 <bar>
+0000000012340028 <___veneer>:
+    12340028:	90f6e710 	adrp	x16, 20000 <_start>
+    1234002c:	91006210 	add	x16, x16, #0x18
+    12340030:	d61f0200 	br	x16
+	\.\.\.
diff --git a/ld/testsuite/ld-aarch64/protections/bti-far-3.d b/ld/testsuite/ld-aarch64/protections/bti-far-3.d
index f04ce94..aadb684 100644
--- a/ld/testsuite/ld-aarch64/protections/bti-far-3.d
+++ b/ld/testsuite/ld-aarch64/protections/bti-far-3.d
@@ -2,6 +2,7 @@
 #source: bti-far-3a.s
 #source: bti-far-3b.s
 #source: bti-far-3c.s
+#as: -defsym __property_bti__=1
 #ld: -shared --hash-style=sysv -T bti-far-3.ld
 #objdump: -dr
 
diff --git a/ld/testsuite/ld-aarch64/protections/bti-far-3a.s b/ld/testsuite/ld-aarch64/protections/bti-far-3a.s
index ed53545..75b5945 100644
--- a/ld/testsuite/ld-aarch64/protections/bti-far-3a.s
+++ b/ld/testsuite/ld-aarch64/protections/bti-far-3a.s
@@ -11,13 +11,4 @@
 
 .zero	0x07000000
 
-	.section	.note.gnu.property,"a"
-	.align	3
-	.word	4
-	.word	16
-	.word	5
-	.string	"GNU"
-	.word	3221225472
-	.word	4
-	.word	1
-	.align	3
+.include "gnu-note-properties-selectable-merged.inc"
diff --git a/ld/testsuite/ld-aarch64/protections/bti-far-3b.s b/ld/testsuite/ld-aarch64/protections/bti-far-3b.s
index 1f3be3d..bbf9295 100644
--- a/ld/testsuite/ld-aarch64/protections/bti-far-3b.s
+++ b/ld/testsuite/ld-aarch64/protections/bti-far-3b.s
@@ -13,13 +13,4 @@
 
 .zero	0x07000000
 
-	.section	.note.gnu.property,"a"
-	.align	3
-	.word	4
-	.word	16
-	.word	5
-	.string	"GNU"
-	.word	3221225472
-	.word	4
-	.word	1
-	.align	3
+.include "gnu-note-properties-selectable-merged.inc"
diff --git a/ld/testsuite/ld-aarch64/protections/bti-far-3c.s b/ld/testsuite/ld-aarch64/protections/bti-far-3c.s
index 8e2361f..87b03a5 100644
--- a/ld/testsuite/ld-aarch64/protections/bti-far-3c.s
+++ b/ld/testsuite/ld-aarch64/protections/bti-far-3c.s
@@ -12,13 +12,4 @@
 	b	b_func
 	b	extern_func
 
-	.section	.note.gnu.property,"a"
-	.align	3
-	.word	4
-	.word	16
-	.word	5
-	.string	"GNU"
-	.word	3221225472
-	.word	4
-	.word	1
-	.align	3
+.include "gnu-note-properties-selectable-merged.inc"
diff --git a/ld/testsuite/ld-aarch64/protections/bti-far-opt.d b/ld/testsuite/ld-aarch64/protections/bti-far-opt.d
index d06532d..cb293b6 100644
--- a/ld/testsuite/ld-aarch64/protections/bti-far-opt.d
+++ b/ld/testsuite/ld-aarch64/protections/bti-far-opt.d
@@ -1,6 +1,7 @@
 #name: Check linker stubs with indirect calls handle BTI when target has BTI.
 #source: bti-far-opt.s
 #target: [check_shared_lib_support]
+#as: -defsym __property_bti__=1
 #ld: -shared -T bti-far.ld
 #objdump: -dr
 
@@ -35,7 +36,7 @@
 
 0000000000020000 <_start>:
    20000:	97ffe008 	bl	18020 <foo@plt>
-   20004:	9400000f 	bl	20040 <___veneer>
+   20004:	9400000d 	bl	20038 <___veneer>
    20008:	94000001 	bl	2000c <baz>
 
 000000000002000c <baz>:
@@ -58,95 +59,95 @@
 
 0000000000020024 <baz_pacibsp>:
    20024:	d503237f 	pacibsp
-   20028:	1400000c 	b	20058 <___veneer\+0x18>
+   20028:	1400000c 	b	20058 <___bti_veneer\+0x8>
    2002c:	d503201f 	nop
 
 0000000000020030 <___bti_veneer>:
    20030:	d503245f 	bti	c
    20034:	17fffff6 	b	2000c <baz>
 
-0000000000020038 <___bti_veneer>:
-   20038:	d503245f 	bti	c
-   2003c:	17fffff5 	b	20010 <baz_bti_>
-
-0000000000020040 <___veneer>:
-   20040:	90091910 	adrp	x16, 12340000 <foo>
-   20044:	9101e210 	add	x16, x16, #0x78
-   20048:	d61f0200 	br	x16
+0000000000020038 <___veneer>:
+   20038:	90091910 	adrp	x16, 12340000 <foo>
+   2003c:	9102a210 	add	x16, x16, #0xa8
+   20040:	d61f0200 	br	x16
 	\.\.\.
 
+0000000000020050 <___bti_veneer>:
+   20050:	d503245f 	bti	c
+   20054:	17ffffef 	b	20010 <baz_bti_>
+
 Disassembly of section \.far:
 
 0000000012340000 <foo>:
-    12340000:	94000018 	bl	12340060 <___veneer>
-    12340004:	9400003d 	bl	123400f8 <___veneer>
-    12340008:	9400002a 	bl	123400b0 <___veneer>
-    1234000c:	94000023 	bl	12340098 <___veneer>
-    12340010:	9400002e 	bl	123400c8 <___veneer>
-    12340014:	94000033 	bl	123400e0 <___veneer>
-    12340018:	9400001a 	bl	12340080 <___veneer>
+    12340000:	94000032 	bl	123400c8 <___veneer>
+    12340004:	9400001d 	bl	12340078 <___veneer>
+    12340008:	94000022 	bl	12340090 <___veneer>
+    1234000c:	94000035 	bl	123400e0 <___veneer>
+    12340010:	9400003a 	bl	123400f8 <___veneer>
+    12340014:	94000013 	bl	12340060 <___veneer>
+    12340018:	94000026 	bl	123400b0 <___veneer>
 
 000000001234001c <bar>:
     1234001c:	1400000b 	b	12340048 <__foo_veneer>
-    12340020:	14000010 	b	12340060 <___veneer>
-    12340024:	14000035 	b	123400f8 <___veneer>
-    12340028:	14000022 	b	123400b0 <___veneer>
-    1234002c:	1400001b 	b	12340098 <___veneer>
-    12340030:	14000026 	b	123400c8 <___veneer>
-    12340034:	1400002b 	b	123400e0 <___veneer>
-    12340038:	14000012 	b	12340080 <___veneer>
+    12340020:	1400002a 	b	123400c8 <___veneer>
+    12340024:	14000015 	b	12340078 <___veneer>
+    12340028:	1400001a 	b	12340090 <___veneer>
+    1234002c:	1400002d 	b	123400e0 <___veneer>
+    12340030:	14000032 	b	123400f8 <___veneer>
+    12340034:	1400000b 	b	12340060 <___veneer>
+    12340038:	1400001e 	b	123400b0 <___veneer>
     1234003c:	00000000 	udf	#0
     12340040:	14000034 	b	12340110 <___veneer\+0x18>
     12340044:	d503201f 	nop
 
 0000000012340048 <__foo_veneer>:
-    12340048:	90f6e6d0 	adrp	x16, 18000 <\.plt>
+    12340048:	90f6e6d0 	adrp	x16, 18000 <.plt>
     1234004c:	9100e210 	add	x16, x16, #0x38
     12340050:	d61f0200 	br	x16
 	\.\.\.
 
 0000000012340060 <___veneer>:
     12340060:	90f6e710 	adrp	x16, 20000 <_start>
-    12340064:	9100c210 	add	x16, x16, #0x30
+    12340064:	91008210 	add	x16, x16, #0x20
     12340068:	d61f0200 	br	x16
 	\.\.\.
 
-0000000012340078 <___bti_veneer>:
-    12340078:	d503245f 	bti	c
-    1234007c:	17ffffe8 	b	1234001c <bar>
-
-0000000012340080 <___veneer>:
-    12340080:	90f6e710 	adrp	x16, 20000 <_start>
-    12340084:	91009210 	add	x16, x16, #0x24
-    12340088:	d61f0200 	br	x16
+0000000012340078 <___veneer>:
+    12340078:	90f6e710 	adrp	x16, 20000 <_start>
+    1234007c:	91014210 	add	x16, x16, #0x50
+    12340080:	d61f0200 	br	x16
 	\.\.\.
 
-0000000012340098 <___veneer>:
-    12340098:	90f6e710 	adrp	x16, 20000 <_start>
-    1234009c:	91006210 	add	x16, x16, #0x18
-    123400a0:	d61f0200 	br	x16
+0000000012340090 <___veneer>:
+    12340090:	90f6e710 	adrp	x16, 20000 <_start>
+    12340094:	91005210 	add	x16, x16, #0x14
+    12340098:	d61f0200 	br	x16
 	\.\.\.
 
+00000000123400a8 <___bti_veneer>:
+    123400a8:	d503245f 	bti	c
+    123400ac:	17ffffdc 	b	1234001c <bar>
+
 00000000123400b0 <___veneer>:
     123400b0:	90f6e710 	adrp	x16, 20000 <_start>
-    123400b4:	91005210 	add	x16, x16, #0x14
+    123400b4:	91009210 	add	x16, x16, #0x24
     123400b8:	d61f0200 	br	x16
 	\.\.\.
 
 00000000123400c8 <___veneer>:
     123400c8:	90f6e710 	adrp	x16, 20000 <_start>
-    123400cc:	91007210 	add	x16, x16, #0x1c
+    123400cc:	9100c210 	add	x16, x16, #0x30
     123400d0:	d61f0200 	br	x16
 	\.\.\.
 
 00000000123400e0 <___veneer>:
     123400e0:	90f6e710 	adrp	x16, 20000 <_start>
-    123400e4:	91008210 	add	x16, x16, #0x20
+    123400e4:	91006210 	add	x16, x16, #0x18
     123400e8:	d61f0200 	br	x16
 	\.\.\.
 
 00000000123400f8 <___veneer>:
     123400f8:	90f6e710 	adrp	x16, 20000 <_start>
-    123400fc:	9100e210 	add	x16, x16, #0x38
+    123400fc:	91007210 	add	x16, x16, #0x1c
     12340100:	d61f0200 	br	x16
 	\.\.\.
diff --git a/ld/testsuite/ld-aarch64/protections/bti-far-opt.s b/ld/testsuite/ld-aarch64/protections/bti-far-opt.s
index 516b901..bed22e6 100644
--- a/ld/testsuite/ld-aarch64/protections/bti-far-opt.s
+++ b/ld/testsuite/ld-aarch64/protections/bti-far-opt.s
@@ -41,13 +41,4 @@
 	b baz_paciasp
 	b baz_pacibsp
 
-	.section	.note.gnu.property,"a"
-	.align	3
-	.word	4
-	.word	16
-	.word	5
-	.string	"GNU"
-	.word	0xc0000000
-	.word	4
-	.word	1
-	.align	3
+.include "gnu-note-properties-selectable-merged.inc"
diff --git a/ld/testsuite/ld-aarch64/protections/bti-far.s b/ld/testsuite/ld-aarch64/protections/bti-far.s
index 20cffd2..24284c6 100644
--- a/ld/testsuite/ld-aarch64/protections/bti-far.s
+++ b/ld/testsuite/ld-aarch64/protections/bti-far.s
@@ -17,13 +17,4 @@
 	bl baz
 	bl foo
 
-	.section	.note.gnu.property,"a"
-	.align	3
-	.word	4
-	.word	16
-	.word	5
-	.string	"GNU"
-	.word	0xc0000000
-	.word	4
-	.word	1
-	.align	3
+.include "gnu-note-properties-selectable-merged.inc"