diff options
author | Matthieu Longo <matthieu.longo@arm.com> | 2024-11-07 10:33:45 +0000 |
---|---|---|
committer | Matthieu Longo <matthieu.longo@arm.com> | 2024-12-02 15:18:41 +0000 |
commit | 9957996fa8b8b114ece97b74dc56e4ac8e3066b0 (patch) | |
tree | 99b8444f38cefca74c0ed0f77f2a8b9e4ab5b99d | |
parent | b75ce33f0cd3a4720c252969bfffdac4f3f998a7 (diff) | |
download | binutils-9957996fa8b8b114ece97b74dc56e4ac8e3066b0.zip binutils-9957996fa8b8b114ece97b74dc56e4ac8e3066b0.tar.gz binutils-9957996fa8b8b114ece97b74dc56e4ac8e3066b0.tar.bz2 |
aarch64: add tests to check the correct merge of the GCS feature with others.
10 files changed, 80 insertions, 5 deletions
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 5d88a76..ea3dd7f 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 d575bb5..fdbe970 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 ad4c778..783dde0 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 0bc3726..a171471 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 cad64c4..adeaba3 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 c9a447e..57aaf92 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 2b52ecc..0ae0410 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 af95020..c18ec13 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 0000000..1e96f6f --- /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 0000000..c05e920 --- /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 |