[PATCH v5 2/3] aarch64: add tests to check the correct merge of the GCS feature with others.
Matthieu Longo
matthieu.longo@arm.com
Mon Dec 2 14:37:57 GMT 2024
---
.../gnu-note-properties-maskable-merged.inc | 4 ++++
.../gnu-note-properties-maskable-split.inc | 21 +++++++++++++++++++
.../gnu-note-properties-selectable-merged.inc | 4 ++++
.../gnu-note-properties-selectable-split.inc | 21 +++++++++++++++++++
.../protections/gnu-properties-1-all-merged.d | 2 +-
.../protections/gnu-properties-1-all-split.d | 2 +-
.../protections/gnu-properties-all.s | 3 ++-
.../gnu-properties-combine-2-all-all.d | 4 ++--
.../gnu-properties-combine-2-all-bti-pac.d | 12 +++++++++++
.../gnu-properties-combine-2-all-gcs.d | 12 +++++++++++
10 files changed, 80 insertions(+), 5 deletions(-)
create mode 100644 ld/testsuite/ld-aarch64/protections/gnu-properties-combine-2-all-bti-pac.d
create mode 100644 ld/testsuite/ld-aarch64/protections/gnu-properties-combine-2-all-gcs.d
diff --git a/ld/testsuite/ld-aarch64/protections/gnu-note-properties-maskable-merged.inc b/ld/testsuite/ld-aarch64/protections/gnu-note-properties-maskable-merged.inc
index 5d88a760529..ea3dd7f0513 100644
--- a/ld/testsuite/ld-aarch64/protections/gnu-note-properties-maskable-merged.inc
+++ b/ld/testsuite/ld-aarch64/protections/gnu-note-properties-maskable-merged.inc
@@ -2,6 +2,7 @@
.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 )
@@ -9,6 +10,9 @@
.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
diff --git a/ld/testsuite/ld-aarch64/protections/gnu-note-properties-maskable-split.inc b/ld/testsuite/ld-aarch64/protections/gnu-note-properties-maskable-split.inc
index d575bb56b62..fdbe9706fce 100644
--- a/ld/testsuite/ld-aarch64/protections/gnu-note-properties-maskable-split.inc
+++ b/ld/testsuite/ld-aarch64/protections/gnu-note-properties-maskable-split.inc
@@ -2,6 +2,7 @@
.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__
@@ -10,6 +11,9 @@
.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"
@@ -48,4 +52,21 @@
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/protections/gnu-note-properties-selectable-merged.inc b/ld/testsuite/ld-aarch64/protections/gnu-note-properties-selectable-merged.inc
index ad4c778a23c..783dde0c28c 100644
--- a/ld/testsuite/ld-aarch64/protections/gnu-note-properties-selectable-merged.inc
+++ b/ld/testsuite/ld-aarch64/protections/gnu-note-properties-selectable-merged.inc
@@ -2,6 +2,7 @@
.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 )
@@ -9,6 +10,9 @@
.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
diff --git a/ld/testsuite/ld-aarch64/protections/gnu-note-properties-selectable-split.inc b/ld/testsuite/ld-aarch64/protections/gnu-note-properties-selectable-split.inc
index 0bc37269cb9..a171471990a 100644
--- a/ld/testsuite/ld-aarch64/protections/gnu-note-properties-selectable-split.inc
+++ b/ld/testsuite/ld-aarch64/protections/gnu-note-properties-selectable-split.inc
@@ -2,6 +2,7 @@
.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__
@@ -10,6 +11,9 @@
.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"
@@ -48,4 +52,21 @@
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
diff --git a/ld/testsuite/ld-aarch64/protections/gnu-properties-1-all-merged.d b/ld/testsuite/ld-aarch64/protections/gnu-properties-1-all-merged.d
index cad64c4b184..adeaba33753 100644
--- a/ld/testsuite/ld-aarch64/protections/gnu-properties-1-all-merged.d
+++ b/ld/testsuite/ld-aarch64/protections/gnu-properties-1-all-merged.d
@@ -8,4 +8,4 @@
Displaying notes found in: .note.gnu.property
[ ]+Owner[ ]+Data size[ ]+Description
GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
- Properties: AArch64 feature: BTI, PAC
+ Properties: AArch64 feature: BTI, PAC, GCS
diff --git a/ld/testsuite/ld-aarch64/protections/gnu-properties-1-all-split.d b/ld/testsuite/ld-aarch64/protections/gnu-properties-1-all-split.d
index c9a447e9edd..57aaf921e70 100644
--- a/ld/testsuite/ld-aarch64/protections/gnu-properties-1-all-split.d
+++ b/ld/testsuite/ld-aarch64/protections/gnu-properties-1-all-split.d
@@ -8,4 +8,4 @@
Displaying notes found in: .note.gnu.property
[ ]+Owner[ ]+Data size[ ]+Description
GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
- Properties: AArch64 feature: BTI, PAC
+ Properties: AArch64 feature: BTI, PAC, GCS
diff --git a/ld/testsuite/ld-aarch64/protections/gnu-properties-all.s b/ld/testsuite/ld-aarch64/protections/gnu-properties-all.s
index 2b52eccf15e..0ae0410f628 100644
--- a/ld/testsuite/ld-aarch64/protections/gnu-properties-all.s
+++ b/ld/testsuite/ld-aarch64/protections/gnu-properties-all.s
@@ -9,7 +9,8 @@ _start:
.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_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_BTI | GNU_PROPERTY_AARCH64_FEATURE_1_PAC )
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_GCS, (0x1 << 2)
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_BTI | GNU_PROPERTY_AARCH64_FEATURE_1_PAC | GNU_PROPERTY_AARCH64_FEATURE_1_GCS )
.section ".note.gnu.property", "a"
.p2align 3
diff --git a/ld/testsuite/ld-aarch64/protections/gnu-properties-combine-2-all-all.d b/ld/testsuite/ld-aarch64/protections/gnu-properties-combine-2-all-all.d
index af95020d9b9..c18ec13e1b5 100644
--- a/ld/testsuite/ld-aarch64/protections/gnu-properties-combine-2-all-all.d
+++ b/ld/testsuite/ld-aarch64/protections/gnu-properties-combine-2-all-all.d
@@ -1,7 +1,7 @@
#name: GNU Property: readelf (combine 2 object files: all + all)
#source: gnu-properties-all.s
#source: gnu-properties-selectable.s
-#as: -mabi=lp64 -defsym __property_bti__=1 -defsym __property_pac__=1
+#as: -mabi=lp64 -defsym __property_bti__=1 -defsym __property_pac__=1 -defsym __property_gcs__=1
#ld: -e _start
#readelf: -n
#target: *linux*
@@ -9,4 +9,4 @@
Displaying notes found in: .note.gnu.property
[ ]+Owner[ ]+Data size[ ]+Description
GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
- Properties: AArch64 feature: BTI, PAC
+ Properties: AArch64 feature: BTI, PAC, GCS
diff --git a/ld/testsuite/ld-aarch64/protections/gnu-properties-combine-2-all-bti-pac.d b/ld/testsuite/ld-aarch64/protections/gnu-properties-combine-2-all-bti-pac.d
new file mode 100644
index 00000000000..1e96f6f73e7
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/protections/gnu-properties-combine-2-all-bti-pac.d
@@ -0,0 +1,12 @@
+#name: GNU Property: readelf (combine 2 object files: all + BTI + PAC)
+#source: gnu-properties-all.s
+#source: gnu-properties-selectable.s
+#as: -mabi=lp64 -defsym __property_bti__=1 -defsym __property_pac__=1
+#ld: -e _start
+#readelf: -n
+#target: *linux*
+
+Displaying notes found in: .note.gnu.property
+[ ]+Owner[ ]+Data size[ ]+Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: AArch64 feature: BTI, PAC
diff --git a/ld/testsuite/ld-aarch64/protections/gnu-properties-combine-2-all-gcs.d b/ld/testsuite/ld-aarch64/protections/gnu-properties-combine-2-all-gcs.d
new file mode 100644
index 00000000000..c05e920b6d9
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/protections/gnu-properties-combine-2-all-gcs.d
@@ -0,0 +1,12 @@
+#name: GNU Property: readelf (combine 2 object files: all + GCS only)
+#source: gnu-properties-all.s
+#source: gnu-properties-selectable.s
+#as: -mabi=lp64 -defsym __property_gcs__=1
+#ld: -e _start
+#readelf: -n
+#target: *linux*
+
+Displaying notes found in: .note.gnu.property
+[ ]+Owner[ ]+Data size[ ]+Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: AArch64 feature: GCS
--
2.47.0
More information about the Binutils
mailing list