]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
ld tests for AArch64-specific merge coverage for AEABI Build Attributes
authorMatthieu Longo <matthieu.longo@arm.com>
Tue, 25 Feb 2025 17:28:03 +0000 (17:28 +0000)
committerMatthieu Longo <matthieu.longo@arm.com>
Thu, 22 Jan 2026 10:11:17 +0000 (10:11 +0000)
Test cases:
- coverage of required subsection 'aeabi_pauthabi'.
- coverage for BTI, PAC, GCS used along GNU properties.
- warn on unknown attributes, and prune them from output.

49 files changed:
ld/testsuite/ld-aarch64/build-attributes/aarch64-build-attributes.exp
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-1.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-2.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-explicit-ok-objdump-dump.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-explicit-ok-readelf-dump.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-explicit-only-one-input-without-ba-or-gnu-props.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-gnu-props-only-implicit-ok-readelf-dump.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-implicit-nok-objdump-dump.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-implicit-nok-readelf-dump.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-implicit-ok-objdump-dump.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-implicit-ok-readelf-dump.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-via-gnu-props.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-with-mix-gnu-props-and-bas-implicit-ok-readelf-dump.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-1.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-2.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-explicit-ok-readelf-dump.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-gnu-props-only-implicit-ok-readelf-dump.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-implicit-nok-readelf-dump.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-implicit-ok-readelf-dump.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-via-gnu-props.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-no-bti.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-no-gcs.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-1.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-2.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-ba-with-pac-plt-objdump-dump.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-ba-with-pac-plt-readelf-dump.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-ba-without-pac-plt-objdump-dump.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-ba-without-pac-plt-readelf-dump.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-plt-but-no-pac-ba-objdump-dump.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-plt-but-no-pac-ba-readelf-dump.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-via-gnu-props.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-1.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-2.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-3.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-4.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-mismatch-1.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-mismatch-2.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-nok-1.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-nok-2.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-ok-1.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-ok-2.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-unknown-tag.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-unknown-tag.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-void.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/bti-plt.ld [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/gnu-note-properties-maskable-merged.inc [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/gnu-note-properties-maskable-split.inc [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/gnu-note-properties-selectable-merged.inc [new file with mode: 0644]
ld/testsuite/ld-aarch64/build-attributes/gnu-note-properties-selectable-split.inc [new file with mode: 0644]

index 655a6797145fae53d96e669f3fadc4c31ec36c74..2eaa6b58249fbb8a55df38e8335edf2522b763b6 100644 (file)
@@ -27,19 +27,6 @@ load_file $srcdir/$subdir/../lib/aarch64-elf-lib.exp
 
 set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
 
-# See definition of run_ld_link_tests in testsuite/lib/ld-lib.exp for more
-# details.
-# set aarch64elflinktests {
-#   {"Build bti-plt-so for PLT tests"
-#    "-shared" ""
-#    "-I$srcdir/$subdir -defsym __property_bti__=1"
-#    {bti-plt-so.s} {} "libbti-plt-so.so"}
-# }
-
-# if [check_shared_lib_support] {
-#   run_ld_link_tests $aarch64elflinktests
-# }
-
 foreach t $test_list {
   # We need to strip the ".d", but can leave the dirname.
   run_dump_test [file rootname $t] \
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-1.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-1.s
new file mode 100644 (file)
index 0000000..c5ad5e9
--- /dev/null
@@ -0,0 +1,9 @@
+.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
+.aeabi_attribute  Tag_Feature_BTI, 1
+
+       .text
+       .globl _start
+       .type _start,@function
+_start:
+       bl foo
+       bl bar
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-2.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-2.s
new file mode 100644 (file)
index 0000000..1347a66
--- /dev/null
@@ -0,0 +1,14 @@
+.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
+.aeabi_attribute  Tag_Feature_BTI, 1
+
+       .text
+       .globl foo2
+       .type foo2,@function
+foo2:
+       bl foo_2
+
+.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/build-attributes/ba-aarch64-1-bti-explicit-ok-objdump-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-explicit-ok-objdump-dump.d
new file mode 100644 (file)
index 0000000..4bf0ae0
--- /dev/null
@@ -0,0 +1,53 @@
+# name: EABI build attributes: some files missing Tag_Feature_BTI, but -z force-bti generates PLT with BTI.
+# source: ba-aarch64-1-bti-1.s
+# source: ba-aarch64-1-void.s
+# source: ba-aarch64-1-bti-via-gnu-props.s
+# source: ba-aarch64-1-bti-2.s
+# as: -defsym __property_bti__=1
+# ld: -shared -T bti-plt.ld -z force-bti -z bti-report=warning
+#warning: \A[^\n]*ba-aarch64-1-void\.o: warning: BTI is required by -z force-bti, but this input object file lacks the necessary property note\.
+# objdump: -dr -j .plt
+
+[^:]*: *file format elf64-.*aarch64
+
+Disassembly of section \.plt:
+
+[0-9]+ <\.plt>:
+.*:    d503245f        bti     c
+.*:    a9bf7bf0        stp     x16, x30, \[sp, #-16\]!
+.*:    [[:xdigit:]]{8}         adrp    x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
+.*:    f9400e11        ldr     x17, \[x16, #24\]
+.*:    91006210        add     x16, x16, #0x18
+.*:    d61f0220        br      x17
+.*:    d503201f        nop
+.*:    d503201f        nop
+
+[0-9]+ <foo_1@plt>:
+.*:    [[:xdigit:]]{8}         adrp    x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
+.*:    f9401211        ldr     x17, \[x16, #32\]
+.*:    91008210        add     x16, x16, #0x20
+.*:    d61f0220        br      x17
+
+[0-9]+ <foo_2@plt>:
+.*:    [[:xdigit:]]{8}         adrp    x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
+.*:    f9401611        ldr     x17, \[x16, #40\]
+.*:    9100a210        add     x16, x16, #0x28
+.*:    d61f0220        br      x17
+
+[0-9]+ <foo@plt>:
+.*:    [[:xdigit:]]{8}         adrp    x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
+.*:    f9401a11        ldr     x17, \[x16, #48\]
+.*:    9100c210        add     x16, x16, #0x30
+.*:    d61f0220        br      x17
+
+[0-9]+ <bar@plt>:
+.*:    [[:xdigit:]]{8}         adrp    x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
+.*:    f9401e11        ldr     x17, \[x16, #56\]
+.*:    9100e210        add     x16, x16, #0x38
+.*:    d61f0220        br      x17
+
+[0-9]+ <foo_3@plt>:
+.*:    [[:xdigit:]]{8}         adrp    x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
+.*:    f9402211        ldr     x17, \[x16, #64\]
+.*:    91010210        add     x16, x16, #0x40
+.*:    d61f0220        br      x17
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-explicit-ok-readelf-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-explicit-ok-readelf-dump.d
new file mode 100644 (file)
index 0000000..8a87503
--- /dev/null
@@ -0,0 +1,24 @@
+# name: EABI build attributes: some files missing Tag_Feature_BTI, but -z force-bti means that the output has Tag_Feature_BTI=0x1
+# source: ba-aarch64-1-bti-1.s
+# source: ba-aarch64-1-void.s
+# source: ba-aarch64-1-bti-via-gnu-props.s
+# source: ba-aarch64-1-bti-2.s
+# as: -defsym __property_bti__=1
+# ld: -shared -T bti-plt.ld -z force-bti -z bti-report=warning
+#warning: .*ba-aarch64-1-void\.o: warning: BTI is required by -z force-bti.*
+# readelf: --arch-specific --notes
+
+Displaying notes found in: \.note\.gnu\.property
+  Owner                Data size       Description
+  GNU                  0x00000010      NT_GNU_PROPERTY_TYPE_0
+      Properties:[      ]+AArch64 feature: BTI
+Subsections:
+ - Name:[       ]+aeabi_feature_and_bits
+   Scope:[      ]+public
+   Length:[     ]+35
+   Comprehension:[      ]+optional
+   Encoding:[   ]+ULEB128
+   Values:
+ +Tag_Feature_BTI:[     ]+1 .*
+ +Tag_Feature_PAC:[     ]+0 .*
+ +Tag_Feature_GCS:[     ]+0 .*
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-explicit-only-one-input-without-ba-or-gnu-props.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-explicit-only-one-input-without-ba-or-gnu-props.d
new file mode 100644 (file)
index 0000000..6bbacea
--- /dev/null
@@ -0,0 +1,19 @@
+# name: EABI build attributes: a input object without build attributes or GNU properties, but -z force-bti means that the output has Tag_Feature_BTI=0x1
+# source: ba-aarch64-1-void.s
+# as:
+# ld: -shared -T bti-plt.ld -z force-bti -z bti-report=warning
+#warning: .*ba-aarch64-1-void\.o: warning: BTI is required by -z force-bti.*
+# readelf: --arch-specific --notes
+
+Displaying notes found in: \.note\.gnu\.property
+  Owner                Data size       Description
+  GNU                  0x00000010      NT_GNU_PROPERTY_TYPE_0
+      Properties:[      ]+AArch64 feature: BTI
+Subsections:
+ - Name:[       ]+aeabi_feature_and_bits
+   Scope:[      ]+public
+   Length:[     ]+31
+   Comprehension:[      ]+optional
+   Encoding:[   ]+ULEB128
+   Values:
+ +Tag_Feature_BTI:[     ]+1 .*
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-gnu-props-only-implicit-ok-readelf-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-gnu-props-only-implicit-ok-readelf-dump.d
new file mode 100644 (file)
index 0000000..3eabbc1
--- /dev/null
@@ -0,0 +1,20 @@
+# name: EABI build attributes: all files with BTI GNU property means that output also has Tag_Feature_BTI=0x1
+# source: ba-aarch64-1-bti-via-gnu-props.s
+# as: -defsym __property_bti__=1
+# ld: -shared -T bti-plt.ld
+# readelf: --arch-specific --notes
+
+Displaying notes found in: \.note\.gnu\.property
+  Owner                Data size       Description
+  GNU                  0x00000010      NT_GNU_PROPERTY_TYPE_0
+      Properties:[      ]+AArch64 feature: BTI
+Subsections:
+ - Name:[       ]+aeabi_feature_and_bits
+   Scope:[      ]+public
+   Length:[     ]+35
+   Comprehension:[      ]+optional
+   Encoding:[   ]+ULEB128
+   Values:
+ +Tag_Feature_BTI:[     ]+1 .*
+ +Tag_Feature_PAC:[     ]+0 .*
+ +Tag_Feature_GCS:[     ]+0 .*
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-implicit-nok-objdump-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-implicit-nok-objdump-dump.d
new file mode 100644 (file)
index 0000000..d011b57
--- /dev/null
@@ -0,0 +1,45 @@
+# name: EABI build attributes: some files missing Tag_Feature_BTI does not trigger generation of PLT with BTI.
+# source: ba-aarch64-1-bti-1.s
+# source: ba-aarch64-1-void.s
+# source: ba-aarch64-1-bti-2.s
+# as:
+# ld: -shared -T bti-plt.ld
+# objdump: -dr -j .plt
+
+[^:]*: *file format elf64-.*aarch64
+
+Disassembly of section \.plt:
+
+[0-9]+ <\.plt>:
+.*:    a9bf7bf0        stp     x16, x30, \[sp, #-16\]!
+.*:    [[:xdigit:]]{8}         adrp    x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
+.*:    f9400e11        ldr     x17, \[x16, #24\]
+.*:    91006210        add     x16, x16, #0x18
+.*:    d61f0220        br      x17
+.*:    d503201f        nop
+.*:    d503201f        nop
+.*:    d503201f        nop
+
+[0-9]+ <foo_1@plt>:
+.*:    [[:xdigit:]]{8}         adrp    x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
+.*:    f9401211        ldr     x17, \[x16, #32\]
+.*:    91008210        add     x16, x16, #0x20
+.*:    d61f0220        br      x17
+
+[0-9]+ <foo_2@plt>:
+.*:    [[:xdigit:]]{8}         adrp    x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
+.*:    f9401611        ldr     x17, \[x16, #40\]
+.*:    9100a210        add     x16, x16, #0x28
+.*:    d61f0220        br      x17
+
+[0-9]+ <foo@plt>:
+.*:    [[:xdigit:]]{8}         adrp    x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
+.*:    f9401a11        ldr     x17, \[x16, #48\]
+.*:    9100c210        add     x16, x16, #0x30
+.*:    d61f0220        br      x17
+
+[0-9]+ <bar@plt>:
+.*:    [[:xdigit:]]{8}         adrp    x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
+.*:    f9401e11        ldr     x17, \[x16, #56\]
+.*:    9100e210        add     x16, x16, #0x38
+.*:    d61f0220        br      x17
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-implicit-nok-readelf-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-implicit-nok-readelf-dump.d
new file mode 100644 (file)
index 0000000..6b5d92e
--- /dev/null
@@ -0,0 +1,16 @@
+# name: EABI build attributes: some files missing Tag_Feature_BTI means that the output has Tag_Feature_BTI=0x0
+# source: ba-aarch64-1-bti-1.s
+# source: ba-aarch64-1-void.s
+# source: ba-aarch64-1-bti-2.s
+# as:
+# ld: -shared -T bti-plt.ld
+# readelf: --arch-specific --notes
+
+Subsections:
+ - Name:[       ]+aeabi_feature_and_bits
+   Scope:[      ]+public
+   Length:[     ]+31
+   Comprehension:[      ]+optional
+   Encoding:[   ]+ULEB128
+   Values:
+ +Tag_Feature_BTI:[     ]+0 .*
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-implicit-ok-objdump-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-implicit-ok-objdump-dump.d
new file mode 100644 (file)
index 0000000..2a4a044
--- /dev/null
@@ -0,0 +1,38 @@
+# name: EABI build attributes: all files with Tag_Feature_BTI=0x1 generates PLT with BTI.
+# source: ba-aarch64-1-bti-1.s
+# source: ba-aarch64-1-bti-2.s
+# as:
+# ld: -shared -T bti-plt.ld
+# objdump: -dr -j .plt
+
+[^:]*: *file format elf64-.*aarch64
+
+Disassembly of section \.plt:
+
+[0-9]+ <\.plt>:
+.*:    d503245f        bti     c
+.*:    a9bf7bf0        stp     x16, x30, \[sp, #-16\]!
+.*:    [[:xdigit:]]{8}         adrp    x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
+.*:    f9400e11        ldr     x17, \[x16, #24\]
+.*:    91006210        add     x16, x16, #0x18
+.*:    d61f0220        br      x17
+.*:    d503201f        nop
+.*:    d503201f        nop
+
+[0-9]+ <foo_2@plt>:
+.*:    [[:xdigit:]]{8}         adrp    x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
+.*:    f9401211        ldr     x17, \[x16, #32\]
+.*:    91008210        add     x16, x16, #0x20
+.*:    d61f0220        br      x17
+
+[0-9]+ <foo@plt>:
+.*:    [[:xdigit:]]{8}         adrp    x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
+.*:    f9401611        ldr     x17, \[x16, #40\]
+.*:    9100a210        add     x16, x16, #0x28
+.*:    d61f0220        br      x17
+
+[0-9]+ <bar@plt>:
+.*:    [[:xdigit:]]{8}         adrp    x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
+.*:    f9401a11        ldr     x17, \[x16, #48\]
+.*:    9100c210        add     x16, x16, #0x30
+.*:    d61f0220        br      x17
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-implicit-ok-readelf-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-implicit-ok-readelf-dump.d
new file mode 100644 (file)
index 0000000..6a81460
--- /dev/null
@@ -0,0 +1,19 @@
+# name: EABI build attributes: all files with Tag_Feature_BTI=0x1 means that output also has Tag_Feature_BTI=0x1
+# source: ba-aarch64-1-bti-1.s
+# source: ba-aarch64-1-bti-2.s
+# as:
+# ld: -shared -T bti-plt.ld
+# readelf: --arch-specific --notes
+
+Displaying notes found in: \.note\.gnu\.property
+  Owner                Data size       Description
+  GNU                  0x00000010      NT_GNU_PROPERTY_TYPE_0
+      Properties:[      ]+AArch64 feature: BTI
+Subsections:
+ - Name:[       ]+aeabi_feature_and_bits
+   Scope:[      ]+public
+   Length:[     ]+31
+   Comprehension:[      ]+optional
+   Encoding:[   ]+ULEB128
+   Values:
+ +Tag_Feature_BTI:[     ]+1 .*
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-via-gnu-props.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-via-gnu-props.s
new file mode 100644 (file)
index 0000000..b327f67
--- /dev/null
@@ -0,0 +1,11 @@
+       .text
+       .globl foo3
+       .type foo3,@function
+foo3:
+       bl foo_3
+
+.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/build-attributes/ba-aarch64-1-bti-with-mix-gnu-props-and-bas-implicit-ok-readelf-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-bti-with-mix-gnu-props-and-bas-implicit-ok-readelf-dump.d
new file mode 100644 (file)
index 0000000..f7fd853
--- /dev/null
@@ -0,0 +1,22 @@
+# name: EABI build attributes: EABI build attributes: some files with build attribute Tag_Feature_BTI=0x1 and others with equivalent GNU property means that output also has Tag_Feature_BTI=0x1
+# source: ba-aarch64-1-bti-1.s
+# source: ba-aarch64-1-bti-via-gnu-props.s
+# source: ba-aarch64-1-bti-2.s
+# as: -defsym __property_bti__=1
+# ld: -shared -T bti-plt.ld
+# readelf: --arch-specific --notes
+
+Displaying notes found in: \.note\.gnu\.property
+  Owner                Data size       Description
+  GNU                  0x00000010      NT_GNU_PROPERTY_TYPE_0
+      Properties:[      ]+AArch64 feature: BTI
+Subsections:
+ - Name:[       ]+aeabi_feature_and_bits
+   Scope:[      ]+public
+   Length:[     ]+35
+   Comprehension:[      ]+optional
+   Encoding:[   ]+ULEB128
+   Values:
+ +Tag_Feature_BTI:[     ]+1 .*
+ +Tag_Feature_PAC:[     ]+0 .*
+ +Tag_Feature_GCS:[     ]+0 .*
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-1.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-1.s
new file mode 100644 (file)
index 0000000..b7e54de
--- /dev/null
@@ -0,0 +1,9 @@
+.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
+.aeabi_attribute  Tag_Feature_GCS, 1
+
+       .text
+       .globl _start
+       .type _start,@function
+_start:
+       bl foo
+       bl bar
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-2.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-2.s
new file mode 100644 (file)
index 0000000..06bb389
--- /dev/null
@@ -0,0 +1,14 @@
+.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
+.aeabi_attribute  Tag_Feature_GCS, 1
+
+       .text
+       .globl foo2
+       .type foo2,@function
+foo2:
+       bl foo_2
+
+.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/build-attributes/ba-aarch64-1-gcs-explicit-ok-readelf-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-explicit-ok-readelf-dump.d
new file mode 100644 (file)
index 0000000..4f91949
--- /dev/null
@@ -0,0 +1,24 @@
+# name: EABI build attributes: some files missing Tag_Feature_GCS, but -z gcs=always means that GCS is required.
+# source: ba-aarch64-1-gcs-1.s
+# source: ba-aarch64-1-void.s
+# source: ba-aarch64-1-gcs-via-gnu-props.s
+# source: ba-aarch64-1-gcs-2.s
+# as: -defsym __property_gcs__=1
+# ld: -shared -z gcs=always -z gcs-report=warning
+#warning: .*ba-aarch64-1-void\.o: warning: GCS is required by -z gcs.*
+# readelf: --arch-specific --notes
+
+Displaying notes found in: \.note\.gnu\.property
+  Owner                Data size       Description
+  GNU                  0x00000010      NT_GNU_PROPERTY_TYPE_0
+      Properties:[      ]+AArch64 feature: GCS
+Subsections:
+ - Name:[       ]+aeabi_feature_and_bits
+   Scope:[      ]+public
+   Length:[     ]+35
+   Comprehension:[      ]+optional
+   Encoding:[   ]+ULEB128
+   Values:
+ +Tag_Feature_BTI:[     ]+0 .*
+ +Tag_Feature_PAC:[     ]+0 .*
+ +Tag_Feature_GCS:[     ]+1 .*
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-gnu-props-only-implicit-ok-readelf-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-gnu-props-only-implicit-ok-readelf-dump.d
new file mode 100644 (file)
index 0000000..4527f08
--- /dev/null
@@ -0,0 +1,20 @@
+# name: EABI build attributes: all files with GCS GNU property means that output also has Tag_Feature_GCS=0x1
+# source: ba-aarch64-1-gcs-via-gnu-props.s
+# as: -defsym __property_gcs__=1
+# ld: -shared
+# readelf: --arch-specific --notes
+
+Displaying notes found in: \.note\.gnu\.property
+  Owner                Data size       Description
+  GNU                  0x00000010      NT_GNU_PROPERTY_TYPE_0
+      Properties:[      ]+AArch64 feature: GCS
+Subsections:
+ - Name:[       ]+aeabi_feature_and_bits
+   Scope:[      ]+public
+   Length:[     ]+35
+   Comprehension:[      ]+optional
+   Encoding:[   ]+ULEB128
+   Values:
+ +Tag_Feature_BTI:[     ]+0 .*
+ +Tag_Feature_PAC:[     ]+0 .*
+ +Tag_Feature_GCS:[     ]+1 .*
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-implicit-nok-readelf-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-implicit-nok-readelf-dump.d
new file mode 100644 (file)
index 0000000..d40919a
--- /dev/null
@@ -0,0 +1,16 @@
+# name: EABI build attributes: some files missing Tag_Feature_GCS means that the output has Tag_Feature_GCS=0x0
+# source: ba-aarch64-1-gcs-1.s
+# source: ba-aarch64-1-void.s
+# source: ba-aarch64-1-gcs-2.s
+# as:
+# ld: -shared -z gcs=implicit -z gcs-report=warning
+# readelf: --arch-specific --notes
+
+Subsections:
+ - Name:[       ]+aeabi_feature_and_bits
+   Scope:[      ]+public
+   Length:[     ]+31
+   Comprehension:[      ]+optional
+   Encoding:[   ]+ULEB128
+   Values:
+ +Tag_Feature_GCS:[     ]+0 .*
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-implicit-ok-readelf-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-implicit-ok-readelf-dump.d
new file mode 100644 (file)
index 0000000..3186049
--- /dev/null
@@ -0,0 +1,19 @@
+# name: EABI build attributes: all files with Tag_Feature_GCS=0x1 means that output also has Tag_Feature_GCS=0x1
+# source: ba-aarch64-1-gcs-1.s
+# source: ba-aarch64-1-gcs-2.s
+# as:
+# ld: -shared
+# readelf: --arch-specific --notes
+
+Displaying notes found in: \.note\.gnu\.property
+  Owner                Data size       Description
+  GNU                  0x00000010      NT_GNU_PROPERTY_TYPE_0
+      Properties:[      ]+AArch64 feature: GCS
+Subsections:
+ - Name:[       ]+aeabi_feature_and_bits
+   Scope:[      ]+public
+   Length:[     ]+31
+   Comprehension:[      ]+optional
+   Encoding:[   ]+ULEB128
+   Values:
+ +Tag_Feature_GCS:[     ]+1 .*
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-via-gnu-props.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-gcs-via-gnu-props.s
new file mode 100644 (file)
index 0000000..b327f67
--- /dev/null
@@ -0,0 +1,11 @@
+       .text
+       .globl foo3
+       .type foo3,@function
+foo3:
+       bl foo_3
+
+.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/build-attributes/ba-aarch64-1-no-bti.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-no-bti.s
new file mode 100644 (file)
index 0000000..1093ccf
--- /dev/null
@@ -0,0 +1,2 @@
+.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
+.aeabi_attribute  Tag_Feature_BTI, 0
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-no-gcs.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-no-gcs.s
new file mode 100644 (file)
index 0000000..35b527f
--- /dev/null
@@ -0,0 +1,2 @@
+.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
+.aeabi_attribute  Tag_Feature_GCS, 0
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-1.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-1.s
new file mode 100644 (file)
index 0000000..773732f
--- /dev/null
@@ -0,0 +1,9 @@
+.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
+.aeabi_attribute  Tag_Feature_PAC, 1
+
+       .text
+       .globl _start
+       .type _start,@function
+_start:
+       bl foo
+       bl bar
\ No newline at end of file
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-2.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-2.s
new file mode 100644 (file)
index 0000000..4a7f805
--- /dev/null
@@ -0,0 +1,14 @@
+.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
+.aeabi_attribute  Tag_Feature_PAC, 1
+
+       .text
+       .globl foo2
+       .type foo2,@function
+foo2:
+       bl foo_2
+
+.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/build-attributes/ba-aarch64-1-pac-ba-with-pac-plt-objdump-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-ba-with-pac-plt-objdump-dump.d
new file mode 100644 (file)
index 0000000..fc4d144
--- /dev/null
@@ -0,0 +1,44 @@
+# name: EABI build attributes: all files with Tag_Feature_PAC=0x1 and '-z pac-plt' does generate PLT with PAC.
+# source: ba-aarch64-1-pac-1.s
+# source: ba-aarch64-1-pac-2.s
+# as: -defsym __property_pac__=1
+# ld: -shared -T bti-plt.ld -z pac-plt
+# objdump: -dr -j .plt
+
+[^:]*: *file format elf64-.*aarch64
+
+Disassembly of section \.plt:
+
+[0-9]+ <\.plt>:
+.*:    a9bf7bf0        stp     x16, x30, \[sp, #-16\]!
+.*:    [[:xdigit:]]{8}         adrp    x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
+.*:    f9400e11        ldr     x17, \[x16, #24\]
+.*:    91006210        add     x16, x16, #0x18
+.*:    d61f0220        br      x17
+.*:    d503201f        nop
+.*:    d503201f        nop
+.*:    d503201f        nop
+
+[0-9]+ <foo_2@plt>:
+.*:    [[:xdigit:]]{8}         adrp    x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
+.*:    f9401211        ldr     x17, \[x16, #32\]
+.*:    91008210        add     x16, x16, #0x20
+.*:    d503219f        autia1716
+.*:    d61f0220        br      x17
+.*:    d503201f        nop
+
+[0-9]+ <foo@plt>:
+.*:    [[:xdigit:]]{8}         adrp    x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
+.*:    f9401611        ldr     x17, \[x16, #40\]
+.*:    9100a210        add     x16, x16, #0x28
+.*:    d503219f        autia1716
+.*:    d61f0220        br      x17
+.*:    d503201f        nop
+
+[0-9]+ <bar@plt>:
+.*:    [[:xdigit:]]{8}         adrp    x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
+.*:    f9401a11        ldr     x17, \[x16, #48\]
+.*:    9100c210        add     x16, x16, #0x30
+.*:    d503219f        autia1716
+.*:    d61f0220        br      x17
+.*:    d503201f        nop
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-ba-with-pac-plt-readelf-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-ba-with-pac-plt-readelf-dump.d
new file mode 100644 (file)
index 0000000..4ae69a5
--- /dev/null
@@ -0,0 +1,21 @@
+# name: EABI build attributes: all files with Tag_Feature_PAC=0x1 and '-z pac-plt' means that output has Tag_Feature_PAC=0x1
+# source: ba-aarch64-1-pac-1.s
+# source: ba-aarch64-1-pac-2.s
+# as: -defsym __property_pac__=1
+# ld: -shared -T bti-plt.ld -z pac-plt
+# readelf: --arch-specific --notes
+
+Displaying notes found in: \.note\.gnu\.property
+  Owner                Data size       Description
+  GNU                  0x00000010      NT_GNU_PROPERTY_TYPE_0
+      Properties:[      ]+AArch64 feature: PAC
+Subsections:
+ - Name:[       ]+aeabi_feature_and_bits
+   Scope:[      ]+public
+   Length:[     ]+35
+   Comprehension:[      ]+optional
+   Encoding:[   ]+ULEB128
+   Values:
+ +Tag_Feature_BTI:[     ]+0 .*
+ +Tag_Feature_PAC:[     ]+1 .*
+ +Tag_Feature_GCS:[     ]+0 .*
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-ba-without-pac-plt-objdump-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-ba-without-pac-plt-objdump-dump.d
new file mode 100644 (file)
index 0000000..8abc585
--- /dev/null
@@ -0,0 +1,38 @@
+# name: EABI build attributes: all files with Tag_Feature_PAC=0x1 but no '-z pac-plt' does not generate PLT with PAC.
+# source: ba-aarch64-1-pac-1.s
+# source: ba-aarch64-1-pac-2.s
+# as: -defsym __property_pac__=1
+# ld: -shared -T bti-plt.ld
+# objdump: -dr -j .plt
+
+[^:]*: *file format elf64-.*aarch64
+
+Disassembly of section \.plt:
+
+[0-9]+ <\.plt>:
+.*:    a9bf7bf0        stp     x16, x30, \[sp, #-16\]!
+.*:    [[:xdigit:]]{8}         adrp    x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
+.*:    f9400e11        ldr     x17, \[x16, #24\]
+.*:    91006210        add     x16, x16, #0x18
+.*:    d61f0220        br      x17
+.*:    d503201f        nop
+.*:    d503201f        nop
+.*:    d503201f        nop
+
+[0-9]+ <foo_2@plt>:
+.*:    [[:xdigit:]]{8}         adrp    x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
+.*:    f9401211        ldr     x17, \[x16, #32\]
+.*:    91008210        add     x16, x16, #0x20
+.*:    d61f0220        br      x17
+
+[0-9]+ <foo@plt>:
+.*:    [[:xdigit:]]{8}         adrp    x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
+.*:    f9401611        ldr     x17, \[x16, #40\]
+.*:    9100a210        add     x16, x16, #0x28
+.*:    d61f0220        br      x17
+
+[0-9]+ <bar@plt>:
+.*:    [[:xdigit:]]{8}         adrp    x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
+.*:    f9401a11        ldr     x17, \[x16, #48\]
+.*:    9100c210        add     x16, x16, #0x30
+.*:    d61f0220        br      x17
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-ba-without-pac-plt-readelf-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-ba-without-pac-plt-readelf-dump.d
new file mode 100644 (file)
index 0000000..22ae709
--- /dev/null
@@ -0,0 +1,21 @@
+# name: EABI build attributes: all files with Tag_Feature_PAC=0x1 but no '-z pac-plt' means that output has Tag_Feature_PAC=0x1
+# source: ba-aarch64-1-pac-1.s
+# source: ba-aarch64-1-pac-2.s
+# as: -defsym __property_pac__=1
+# ld: -shared -T bti-plt.ld
+# readelf: --arch-specific --notes
+
+Displaying notes found in: \.note\.gnu\.property
+  Owner                Data size       Description
+  GNU                  0x00000010      NT_GNU_PROPERTY_TYPE_0
+      Properties:[      ]+AArch64 feature: PAC
+Subsections:
+ - Name:[       ]+aeabi_feature_and_bits
+   Scope:[      ]+public
+   Length:[     ]+35
+   Comprehension:[      ]+optional
+   Encoding:[   ]+ULEB128
+   Values:
+ +Tag_Feature_BTI:[     ]+0 .*
+ +Tag_Feature_PAC:[     ]+1 .*
+ +Tag_Feature_GCS:[     ]+0 .*
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-plt-but-no-pac-ba-objdump-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-plt-but-no-pac-ba-objdump-dump.d
new file mode 100644 (file)
index 0000000..0c150b9
--- /dev/null
@@ -0,0 +1,53 @@
+# name: EABI build attributes: '-z pac-plt' with some files without Tag_Feature_PAC=0x1 generates PLT with PAC.
+# source: ba-aarch64-1-pac-1.s
+# source: ba-aarch64-1-void.s
+# source: ba-aarch64-1-pac-2.s
+# as: -defsym __property_pac__=1
+# ld: -shared  -T bti-plt.ld -z pac-plt
+# objdump: -dr -j .plt
+
+[^:]*: *file format elf64-.*aarch64
+
+Disassembly of section \.plt:
+
+[0-9]+ <\.plt>:
+.*:    a9bf7bf0        stp     x16, x30, \[sp, #-16\]!
+.*:    [[:xdigit:]]{8}         adrp    x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
+.*:    f9400e11        ldr     x17, \[x16, #24\]
+.*:    91006210        add     x16, x16, #0x18
+.*:    d61f0220        br      x17
+.*:    d503201f        nop
+.*:    d503201f        nop
+.*:    d503201f        nop
+
+[0-9]+ <foo_1@plt>:
+.*:    [[:xdigit:]]{8}         adrp    x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
+.*:    f9401211        ldr     x17, \[x16, #32\]
+.*:    91008210        add     x16, x16, #0x20
+.*:    d503219f        autia1716
+.*:    d61f0220        br      x17
+.*:    d503201f        nop
+
+[0-9]+ <foo_2@plt>:
+.*:    [[:xdigit:]]{8}         adrp    x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
+.*:    f9401611        ldr     x17, \[x16, #40\]
+.*:    9100a210        add     x16, x16, #0x28
+.*:    d503219f        autia1716
+.*:    d61f0220        br      x17
+.*:    d503201f        nop
+
+[0-9]+ <foo@plt>:
+.*:    [[:xdigit:]]{8}         adrp    x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
+.*:    f9401a11        ldr     x17, \[x16, #48\]
+.*:    9100c210        add     x16, x16, #0x30
+.*:    d503219f        autia1716
+.*:    d61f0220        br      x17
+.*:    d503201f        nop
+
+[0-9]+ <bar@plt>:
+.*:    [[:xdigit:]]{8}         adrp    x16, [[:xdigit:]]+ <_GLOBAL_OFFSET_TABLE_>
+.*:    f9401e11        ldr     x17, \[x16, #56\]
+.*:    9100e210        add     x16, x16, #0x38
+.*:    d503219f        autia1716
+.*:    d61f0220        br      x17
+.*:    d503201f        nop
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-plt-but-no-pac-ba-readelf-dump.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-plt-but-no-pac-ba-readelf-dump.d
new file mode 100644 (file)
index 0000000..05da580
--- /dev/null
@@ -0,0 +1,18 @@
+# name: EABI build attributes: '-z pac-plt' with some files without Tag_Feature_PAC=0x1 does not set Tag_Feature_PAC=0x1.
+# source: ba-aarch64-1-pac-1.s
+# source: ba-aarch64-1-void.s
+# source: ba-aarch64-1-pac-2.s
+# as: -defsym __property_pac__=1
+# ld: -shared  -T bti-plt.ld -z pac-plt
+# readelf: --arch-specific --notes
+
+Subsections:
+ - Name:[       ]+aeabi_feature_and_bits
+   Scope:[      ]+public
+   Length:[     ]+35
+   Comprehension:[      ]+optional
+   Encoding:[   ]+ULEB128
+   Values:
+ +Tag_Feature_BTI:[     ]+0 .*
+ +Tag_Feature_PAC:[     ]+0 .*
+ +Tag_Feature_GCS:[     ]+0 .*
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-via-gnu-props.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-pac-via-gnu-props.s
new file mode 100644 (file)
index 0000000..b327f67
--- /dev/null
@@ -0,0 +1,11 @@
+       .text
+       .globl foo3
+       .type foo3,@function
+foo3:
+       bl foo_3
+
+.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/build-attributes/ba-aarch64-1-required-subsection-1.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-1.s
new file mode 100644 (file)
index 0000000..1d56899
--- /dev/null
@@ -0,0 +1,7 @@
+.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
+.aeabi_attribute  Tag_Feature_BTI, 1
+.aeabi_attribute  Tag_Feature_PAC, 1
+
+.aeabi_subsection aeabi_pauthabi, required, uleb128
+.aeabi_attribute  Tag_PAuth_Platform, 0x0
+.aeabi_attribute  Tag_PAuth_Schema, 0x1
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-2.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-2.s
new file mode 100644 (file)
index 0000000..9690634
--- /dev/null
@@ -0,0 +1,7 @@
+.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
+.aeabi_attribute  Tag_Feature_BTI, 1
+.aeabi_attribute  Tag_Feature_PAC, 0
+
+.aeabi_subsection aeabi_pauthabi, required, uleb128
+.aeabi_attribute  Tag_PAuth_Platform, 0x0
+.aeabi_attribute  Tag_PAuth_Schema, 0x1
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-3.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-3.s
new file mode 100644 (file)
index 0000000..5ff1b8c
--- /dev/null
@@ -0,0 +1,7 @@
+.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
+.aeabi_attribute  Tag_Feature_BTI, 1
+.aeabi_attribute  Tag_Feature_PAC, 1
+
+.aeabi_subsection aeabi_pauthabi, required, uleb128
+.aeabi_attribute  Tag_PAuth_Platform, 0x0
+.aeabi_attribute  Tag_PAuth_Schema, 0x0
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-4.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-4.s
new file mode 100644 (file)
index 0000000..5ff1b8c
--- /dev/null
@@ -0,0 +1,7 @@
+.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
+.aeabi_attribute  Tag_Feature_BTI, 1
+.aeabi_attribute  Tag_Feature_PAC, 1
+
+.aeabi_subsection aeabi_pauthabi, required, uleb128
+.aeabi_attribute  Tag_PAuth_Platform, 0x0
+.aeabi_attribute  Tag_PAuth_Schema, 0x0
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-mismatch-1.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-mismatch-1.s
new file mode 100644 (file)
index 0000000..edaf78f
--- /dev/null
@@ -0,0 +1,7 @@
+.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
+.aeabi_attribute  Tag_Feature_BTI, 1
+.aeabi_attribute  Tag_Feature_PAC, 1
+
+.aeabi_subsection aeabi_pauthabi, required, uleb128
+.aeabi_attribute  Tag_PAuth_Platform, 0xdead
+.aeabi_attribute  Tag_PAuth_Schema, 0xbeef
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-mismatch-2.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-mismatch-2.s
new file mode 100644 (file)
index 0000000..dbbb30e
--- /dev/null
@@ -0,0 +1,7 @@
+.aeabi_subsection aeabi_feature_and_bits, required, uleb128
+.aeabi_attribute  Tag_Feature_BTI, 1
+.aeabi_attribute  Tag_Feature_PAC, 1
+
+.aeabi_subsection aeabi_pauthabi, optional, ntbs
+.aeabi_attribute  Tag_PAuth_Platform, "hello"
+.aeabi_attribute  Tag_PAuth_Schema, "world"
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-nok-1.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-nok-1.d
new file mode 100644 (file)
index 0000000..042b364
--- /dev/null
@@ -0,0 +1,10 @@
+# name: EABI build attributes: combine non-matching aeabi_pauthabi subsections
+# source: ba-aarch64-1-required-subsection-1.s
+# source: ba-aarch64-1-required-subsection-mismatch-1.s
+# source: ba-aarch64-1-required-subsection-2.s
+# as:
+# ld: -shared
+#error: \A[^\n]*ba-aarch64-1-required-subsection-mismatch-1\.o: error: mismatching value for required object attribute 'Tag_PAuth_Platform' in subsection 'aeabi_pauthabi': 0xdead
+#error: \n[^\n]*ba-aarch64-1-required-subsection-1\.o: info: conflicting value '0' lives here
+#error: \n[^\n]*ba-aarch64-1-required-subsection-mismatch-1\.o: error: mismatching value for required object attribute 'Tag_PAuth_Schema' in subsection 'aeabi_pauthabi': 0xbeef
+#error: \n[^\n]*ba-aarch64-1-required-subsection-1\.o: info: conflicting value '0x1' lives here\Z
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-nok-2.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-nok-2.d
new file mode 100644 (file)
index 0000000..edf43b5
--- /dev/null
@@ -0,0 +1,9 @@
+# name: EABI build attributes: subsections have different properties from the expected ones
+# source: ba-aarch64-1-required-subsection-1.s
+# source: ba-aarch64-1-required-subsection-mismatch-2.s
+# source: ba-aarch64-1-required-subsection-2.s
+# as:
+# ld: -shared
+#error: \A[^\n]*ba-aarch64-1-required-subsection-mismatch-2\.o: error: <comprehension> property of subsection 'aeabi_feature_and_bits' was incorrectly set.  Got 'required', expected 'optional'
+#error: \n[^\n]*ba-aarch64-1-required-subsection-mismatch-2\.o: error: <encoding> property of subsection 'aeabi_pauthabi' was incorrectly set\.  Got 'NTBS', expected 'ULEB128'
+#error: \n[^\n]*ba-aarch64-1-required-subsection-mismatch-2\.o: error: <comprehension> property of subsection 'aeabi_pauthabi' was incorrectly set\.  Got 'optional', expected 'required'\Z
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-ok-1.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-ok-1.d
new file mode 100644 (file)
index 0000000..f9d3ba0
--- /dev/null
@@ -0,0 +1,25 @@
+# name: EABI build attributes: combine matching aeabi_pauthabi subsections, and (platform=0x0, schema=0x1) is accepted.
+# source: ba-aarch64-1-required-subsection-1.s
+# source: ba-aarch64-1-required-subsection-2.s
+# as:
+# ld: -shared
+# readelf: --arch-specific
+
+Subsections:
+ - Name:[       ]+aeabi_feature_and_bits
+   Scope:[      ]+public
+   Length:[     ]+33
+   Comprehension:[      ]+optional
+   Encoding:[   ]+ULEB128
+   Values:
+ +Tag_Feature_BTI:[     ]+1 .*
+ +Tag_Feature_PAC:[     ]+0 .*
+
+ - Name:[       ]+aeabi_pauthabi
+   Scope:[      ]+public
+   Length:[     ]+25
+   Comprehension:[      ]+required
+   Encoding:[   ]+ULEB128
+   Values:
+ +Tag_PAuth_Platform:[  ]+0 .*
+ +Tag_PAuth_Schema:[    ]+1 .*
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-ok-2.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-required-subsection-ok-2.d
new file mode 100644 (file)
index 0000000..cc551a2
--- /dev/null
@@ -0,0 +1,25 @@
+# name: EABI build attributes: combine matching aeabi_pauthabi subsections, and (platform=0x0, schema=0x0) is accepted.
+# source: ba-aarch64-1-required-subsection-3.s
+# source: ba-aarch64-1-required-subsection-4.s
+# as:
+# ld: -shared
+# readelf: --arch-specific
+
+Subsections:
+ - Name:[       ]+aeabi_feature_and_bits
+   Scope:[      ]+public
+   Length:[     ]+33
+   Comprehension:[      ]+optional
+   Encoding:[   ]+ULEB128
+   Values:
+ +Tag_Feature_BTI:[     ]+1 .*
+ +Tag_Feature_PAC:[     ]+1 .*
+
+ - Name:[       ]+aeabi_pauthabi
+   Scope:[      ]+public
+   Length:[     ]+25
+   Comprehension:[      ]+required
+   Encoding:[   ]+ULEB128
+   Values:
+ +Tag_PAuth_Platform:[  ]+0 .*
+ +Tag_PAuth_Schema:[    ]+0 .*
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-unknown-tag.d b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-unknown-tag.d
new file mode 100644 (file)
index 0000000..8d35287
--- /dev/null
@@ -0,0 +1,20 @@
+# name: EABI build attributes: some files missing Tag_Feature_BTI, but -z force-bti means that the output has Tag_Feature_BTI=0x1
+# source: ba-aarch64-1-bti-1.s
+# source: ba-aarch64-1-unknown-tag.s
+# source: ba-aarch64-1-bti-via-gnu-props.s
+# source: ba-aarch64-1-bti-2.s
+# as: -defsym __property_bti__=1
+# ld: -shared -T bti-plt.ld
+#warning: \A[^\n]*ba-aarch64-1-unknown-tag\.o: warning: cannot merge unknown tag 'Tag_unknown_4' \(=0x1\) in subsection 'aeabi_feature_and_bits'\.
+# readelf: --arch-specific
+
+Subsections:
+ - Name:[       ]+aeabi_feature_and_bits
+   Scope:[      ]+public
+   Length:[     ]+35
+   Comprehension:[      ]+optional
+   Encoding:[   ]+ULEB128
+   Values:
+ +Tag_Feature_BTI:[     ]+1 .*
+ +Tag_Feature_PAC:[     ]+0 .*
+ +Tag_Feature_GCS:[     ]+0 .*
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-unknown-tag.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-unknown-tag.s
new file mode 100644 (file)
index 0000000..7d4f172
--- /dev/null
@@ -0,0 +1,3 @@
+.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
+.aeabi_attribute Tag_Feature_BTI, 1
+.aeabi_attribute 4, 1
diff --git a/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-void.s b/ld/testsuite/ld-aarch64/build-attributes/ba-aarch64-1-void.s
new file mode 100644 (file)
index 0000000..4e1896c
--- /dev/null
@@ -0,0 +1,5 @@
+       .text
+       .globl foo1
+       .type foo1,@function
+foo1:
+       bl foo_1
diff --git a/ld/testsuite/ld-aarch64/build-attributes/bti-plt.ld b/ld/testsuite/ld-aarch64/build-attributes/bti-plt.ld
new file mode 100644 (file)
index 0000000..fffb8a9
--- /dev/null
@@ -0,0 +1,27 @@
+OUTPUT_ARCH(aarch64)
+ENTRY(_start)
+SECTIONS
+{
+  PROVIDE(__executable_start = 0x8000);
+  . = SEGMENT_START("text-segment", 0x8000) + SIZEOF_HEADERS;
+  /* Start of the executable code region.  */
+  .hash              : { *(.hash) }
+  .gnu.hash          : { *(.gnu.hash) }
+  .dynsym            : { *(.dynsym) }
+  .dynstr            : { *(.dynstr) }
+  . = 0x10000;
+  .rela.dyn          : { *(.rela.ifunc) }
+  .rela.plt          : { *(.rela.plt) *(.rela.iplt) }
+  . = 0x18000;
+  .plt               : { *(.plt) *(.iplt) }
+  . = 0x20000;
+  .text              : { *(.text) }
+  /* Start of the Read Only Data region.  */
+  .note.gnu.property : { *(.note.gnu.property) }
+
+  /* Start of the Read Write Data region.  */
+  . = ALIGN (CONSTANT (MAXPAGESIZE));
+  .got               : { *(.got) *(.got.plt) }
+  /* Start of the metadata region.  */
+  .ARM.attributes 0  : { KEEP (*(.ARM.attributes)) }
+}
diff --git a/ld/testsuite/ld-aarch64/build-attributes/gnu-note-properties-maskable-merged.inc b/ld/testsuite/ld-aarch64/build-attributes/gnu-note-properties-maskable-merged.inc
new file mode 100644 (file)
index 0000000..ea3dd7f
--- /dev/null
@@ -0,0 +1,32 @@
+       .set NT_GNU_PROPERTY_TYPE_0,             5
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_AND, 0xc0000000
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_BTI, (0x1 << 0)
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_PAC, (0x1 << 1)
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_GCS, (0x1 << 2)
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, 0x0
+.ifndef __mask_property_bti__
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_BTI )
+.endif
+.ifndef __mask_property_pac__
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_PAC )
+.endif
+.ifndef __mask_property_gcs__
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_GCS )
+.endif
+.if GNU_PROPERTY_AARCH64_FEATURE_1_VALUE
+       .section ".note.gnu.property", "a"
+       .p2align 3
+       .long 1f - 0f                   /* name length */
+       .long 5f - 2f                   /* data length */
+       .long NT_GNU_PROPERTY_TYPE_0    /* note type */
+0:     .asciz "GNU"                    /* vendor name */
+1:
+       .p2align 3
+2:     .long GNU_PROPERTY_AARCH64_FEATURE_1_AND /* pr_type.  */
+       .long 4f - 3f                            /* pr_datasz.  */
+3:
+       .long GNU_PROPERTY_AARCH64_FEATURE_1_VALUE
+4:
+       .p2align 3
+5:
+.endif
diff --git a/ld/testsuite/ld-aarch64/build-attributes/gnu-note-properties-maskable-split.inc b/ld/testsuite/ld-aarch64/build-attributes/gnu-note-properties-maskable-split.inc
new file mode 100644 (file)
index 0000000..fdbe970
--- /dev/null
@@ -0,0 +1,72 @@
+       .set NT_GNU_PROPERTY_TYPE_0,             5
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_AND, 0xc0000000
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_BTI, (0x1 << 0)
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_PAC, (0x1 << 1)
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_GCS, (0x1 << 2)
+
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, 0x0
+.ifndef __mask_property_bti__
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_BTI )
+.endif
+.ifndef __mask_property_pac__
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_PAC )
+.endif
+.ifndef __mask_property_gcs__
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_GCS )
+.endif
+
+.if GNU_PROPERTY_AARCH64_FEATURE_1_VALUE
+       .section ".note.gnu.property", "a"
+
+.ifndef __mask_property_bti__
+       .p2align 3
+       .long 1f - 0f                   /* name length */
+       .long 5f - 2f                   /* data length */
+       .long NT_GNU_PROPERTY_TYPE_0    /* note type */
+0:     .asciz "GNU"                    /* vendor name */
+1:
+       .p2align 3
+2:     .long GNU_PROPERTY_AARCH64_FEATURE_1_AND /* pr_type.  */
+       .long 4f - 3f                            /* pr_datasz.  */
+3:
+       .long GNU_PROPERTY_AARCH64_FEATURE_1_BTI
+4:
+       .p2align 3
+5:
+.endif
+
+.ifndef __mask_property_pac__
+       .p2align 3
+       .long 1f - 0f                   /* name length */
+       .long 5f - 2f                   /* data length */
+       .long NT_GNU_PROPERTY_TYPE_0    /* note type */
+0:     .asciz "GNU"                    /* vendor name */
+1:
+       .p2align 3
+2:     .long GNU_PROPERTY_AARCH64_FEATURE_1_AND /* pr_type.  */
+       .long 4f - 3f                            /* pr_datasz.  */
+3:
+       .long GNU_PROPERTY_AARCH64_FEATURE_1_PAC
+4:
+       .p2align 3
+5:
+.endif
+
+.ifndef __mask_property_gcs__
+       .p2align 3
+       .long 1f - 0f                   /* name length */
+       .long 5f - 2f                   /* data length */
+       .long NT_GNU_PROPERTY_TYPE_0    /* note type */
+0:     .asciz "GNU"                    /* vendor name */
+1:
+       .p2align 3
+2:     .long GNU_PROPERTY_AARCH64_FEATURE_1_AND /* pr_type.  */
+       .long 4f - 3f                            /* pr_datasz.  */
+3:
+       .long GNU_PROPERTY_AARCH64_FEATURE_1_GCS
+4:
+       .p2align 3
+5:
+.endif
+
+.endif
diff --git a/ld/testsuite/ld-aarch64/build-attributes/gnu-note-properties-selectable-merged.inc b/ld/testsuite/ld-aarch64/build-attributes/gnu-note-properties-selectable-merged.inc
new file mode 100644 (file)
index 0000000..783dde0
--- /dev/null
@@ -0,0 +1,32 @@
+       .set NT_GNU_PROPERTY_TYPE_0,             5
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_AND, 0xc0000000
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_BTI, (0x1 << 0)
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_PAC, (0x1 << 1)
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_GCS, (0x1 << 2)
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, 0x0
+.ifdef __property_bti__
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_BTI )
+.endif
+.ifdef __property_pac__
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_PAC )
+.endif
+.ifdef __property_gcs__
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_GCS )
+.endif
+.if GNU_PROPERTY_AARCH64_FEATURE_1_VALUE
+       .section ".note.gnu.property", "a"
+       .p2align 3
+       .long 1f - 0f                   /* name length */
+       .long 5f - 2f                   /* data length */
+       .long NT_GNU_PROPERTY_TYPE_0    /* note type */
+0:     .asciz "GNU"                    /* vendor name */
+1:
+       .p2align 3
+2:     .long GNU_PROPERTY_AARCH64_FEATURE_1_AND /* pr_type.  */
+       .long 4f - 3f                            /* pr_datasz.  */
+3:
+       .long GNU_PROPERTY_AARCH64_FEATURE_1_VALUE
+4:
+       .p2align 3
+5:
+.endif
diff --git a/ld/testsuite/ld-aarch64/build-attributes/gnu-note-properties-selectable-split.inc b/ld/testsuite/ld-aarch64/build-attributes/gnu-note-properties-selectable-split.inc
new file mode 100644 (file)
index 0000000..a171471
--- /dev/null
@@ -0,0 +1,72 @@
+       .set NT_GNU_PROPERTY_TYPE_0,             5
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_AND, 0xc0000000
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_BTI, (0x1 << 0)
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_PAC, (0x1 << 1)
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_GCS, (0x1 << 2)
+
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, 0x0
+.ifndef __mask_property_bti__
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_BTI )
+.endif
+.ifndef __mask_property_pac__
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_PAC )
+.endif
+.ifndef __mask_property_gcs__
+       .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_GCS )
+.endif
+
+.if GNU_PROPERTY_AARCH64_FEATURE_1_VALUE
+       .section ".note.gnu.property", "a"
+
+.ifdef __property_bti__
+       .p2align 3
+       .long 1f - 0f                   /* name length */
+       .long 5f - 2f                   /* data length */
+       .long NT_GNU_PROPERTY_TYPE_0    /* note type */
+0:     .asciz "GNU"                    /* vendor name */
+1:
+       .p2align 3
+2:     .long GNU_PROPERTY_AARCH64_FEATURE_1_AND /* pr_type.  */
+       .long 4f - 3f                            /* pr_datasz.  */
+3:
+       .long GNU_PROPERTY_AARCH64_FEATURE_1_BTI
+4:
+       .p2align 3
+5:
+.endif
+
+.ifdef __property_pac__
+       .p2align 3
+       .long 1f - 0f                   /* name length */
+       .long 5f - 2f                   /* data length */
+       .long NT_GNU_PROPERTY_TYPE_0    /* note type */
+0:     .asciz "GNU"                    /* vendor name */
+1:
+       .p2align 3
+2:     .long GNU_PROPERTY_AARCH64_FEATURE_1_AND /* pr_type.  */
+       .long 4f - 3f                            /* pr_datasz.  */
+3:
+       .long GNU_PROPERTY_AARCH64_FEATURE_1_PAC
+4:
+       .p2align 3
+5:
+.endif
+
+.ifdef __property_gcs__
+       .p2align 3
+       .long 1f - 0f                   /* name length */
+       .long 5f - 2f                   /* data length */
+       .long NT_GNU_PROPERTY_TYPE_0    /* note type */
+0:     .asciz "GNU"                    /* vendor name */
+1:
+       .p2align 3
+2:     .long GNU_PROPERTY_AARCH64_FEATURE_1_AND /* pr_type.  */
+       .long 4f - 3f                            /* pr_datasz.  */
+3:
+       .long GNU_PROPERTY_AARCH64_FEATURE_1_GCS
+4:
+       .p2align 3
+5:
+.endif
+
+.endif