]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
aarch64: add tests for combinations of GCS options and marked/unmarked inputs
authorMatthieu Longo <matthieu.longo@arm.com>
Thu, 7 Nov 2024 13:13:20 +0000 (13:13 +0000)
committerMatthieu Longo <matthieu.longo@arm.com>
Mon, 2 Dec 2024 15:18:41 +0000 (15:18 +0000)
25 files changed:
ld/testsuite/ld-aarch64/protections/gcs-1-a.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/protections/gcs-1-b.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/protections/gcs-1-c.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/protections/gcs-1-d.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/protections/gcs-2-a-i.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/protections/gcs-2-a-ii.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/protections/gcs-2-b-i.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/protections/gcs-2-b-ii.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/protections/gcs-2-b-iii.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/protections/gcs-2-b-iv.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/protections/gcs-2-c-i.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/protections/gcs-2-c-ii.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/protections/gcs-3-a-i.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/protections/gcs-3-a-ii.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/protections/gcs-3-a-iii.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/protections/gcs-3-a-iv.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/protections/gcs-3-b-i.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/protections/gcs-3-b-ii.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/protections/gcs-3-b-iii.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/protections/gcs-3-c-i.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/protections/gcs-3-c-ii.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/protections/gcs-3-c-iii.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/protections/gcs.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/protections/gcs2.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/protections/nogcs.s [new file with mode: 0644]

diff --git a/ld/testsuite/ld-aarch64/protections/gcs-1-a.d b/ld/testsuite/ld-aarch64/protections/gcs-1-a.d
new file mode 100644 (file)
index 0000000..d65bcb9
--- /dev/null
@@ -0,0 +1,9 @@
+#name: No GCS option (equivalent to -z gcs=implicit) and empty GNU note property in input emits no GCS attribute [shared]
+#source: gcs.s
+#source: gcs2.s
+#alltargets: [check_shared_lib_support] *linux*
+#as: -march=armv9.4-a+gcs
+#ld: -shared
+#readelf: -n
+
+# Expect no GNU section at all, so readelf output should be empty.
\ No newline at end of file
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-1-b.d b/ld/testsuite/ld-aarch64/protections/gcs-1-b.d
new file mode 100644 (file)
index 0000000..9edcd3b
--- /dev/null
@@ -0,0 +1,12 @@
+#name: No GCS option (equivalent to -z gcs=implicit) and GCS GNU note property in input emits GCS attribute [shared]
+#source: gcs.s
+#source: gcs2.s
+#alltargets: [check_shared_lib_support] *linux*
+#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
+#ld: -shared
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[      ]+Owner[        ]+Data size[    ]+Description
+  GNU                  0x00000010      NT_GNU_PROPERTY_TYPE_0
+      Properties: AArch64 feature: GCS
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-1-c.d b/ld/testsuite/ld-aarch64/protections/gcs-1-c.d
new file mode 100644 (file)
index 0000000..8205832
--- /dev/null
@@ -0,0 +1,7 @@
+#name: Specifying '-z gcs' without value raise an error
+#source: gcs.s
+#source: gcs2.s
+#alltargets: [check_shared_lib_support] *linux*
+#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
+#ld: -shared -z gcs
+#error: .*: error: unrecognized value '-z gcs'
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-1-d.d b/ld/testsuite/ld-aarch64/protections/gcs-1-d.d
new file mode 100644 (file)
index 0000000..7363303
--- /dev/null
@@ -0,0 +1,7 @@
+#name: Specifying invalid value for '-z gcs' raise an error
+#source: gcs.s
+#source: gcs2.s
+#alltargets: [check_shared_lib_support] *linux*
+#as: -march=armv9.4-a+gcs
+#ld: -shared -z gcs=foo
+#error: .*: error: unrecognized value '-z gcs=foo'
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-2-a-i.d b/ld/testsuite/ld-aarch64/protections/gcs-2-a-i.d
new file mode 100644 (file)
index 0000000..77711ea
--- /dev/null
@@ -0,0 +1,12 @@
+#name: Specifying only '-z gcs=always' with GCS marked inputs emits GCS feature without warnings for inputs with GCS feature [shared]
+#source: gcs.s
+#source: gcs2.s
+#alltargets: [check_shared_lib_support] *linux*
+#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
+#ld: -shared -z gcs=always
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[      ]+Owner[        ]+Data size[    ]+Description
+  GNU                  0x00000010      NT_GNU_PROPERTY_TYPE_0
+      Properties: AArch64 feature: GCS
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-2-a-ii.d b/ld/testsuite/ld-aarch64/protections/gcs-2-a-ii.d
new file mode 100644 (file)
index 0000000..04094a9
--- /dev/null
@@ -0,0 +1,14 @@
+#name: Specifying only '-z gcs=always' emits GCS feature with warnings for missing GCS feature on inputs [shared]
+#source: gcs.s
+#source: gcs2.s
+#alltargets: [check_shared_lib_support] *linux*
+#as: -march=armv9.4-a+gcs
+#ld: -shared -z gcs=always
+#warning: \A[^\n]*gcs2\.o: warning: GCS is required by -z gcs[^\n]*\n
+#warning:   [^\n]*gcs\.o: warning: GCS is required by -z gcs[^\n]*
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[      ]+Owner[        ]+Data size[    ]+Description
+  GNU                  0x00000010      NT_GNU_PROPERTY_TYPE_0
+      Properties: AArch64 feature: GCS
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-2-b-i.d b/ld/testsuite/ld-aarch64/protections/gcs-2-b-i.d
new file mode 100644 (file)
index 0000000..cecf274
--- /dev/null
@@ -0,0 +1,12 @@
+#name: Specifying only '-z gcs=implicit' and GCS-marked inputs emits GCS feature [shared]
+#source: gcs.s
+#source: gcs2.s
+#alltargets: [check_shared_lib_support] *linux*
+#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
+#ld: -shared -z gcs=implicit
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[      ]+Owner[        ]+Data size[    ]+Description
+  GNU                  0x00000010      NT_GNU_PROPERTY_TYPE_0
+      Properties: AArch64 feature: GCS
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-2-b-ii.d b/ld/testsuite/ld-aarch64/protections/gcs-2-b-ii.d
new file mode 100644 (file)
index 0000000..8536299
--- /dev/null
@@ -0,0 +1,7 @@
+#name: Specifying only '-z gcs=implicit' and GCS-unmarked inputs emits no GCS feature without warnings [shared]
+#source: gcs.s
+#source: gcs2.s
+#alltargets: [check_shared_lib_support] *linux*
+#as: -march=armv9.4-a+gcs
+#ld: -shared -z gcs=implicit
+#readelf: -n
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-2-b-iii.d b/ld/testsuite/ld-aarch64/protections/gcs-2-b-iii.d
new file mode 100644 (file)
index 0000000..b49e7c4
--- /dev/null
@@ -0,0 +1,12 @@
+#name: Specifying only '-z gcs=implicit -z gcs-report=warning' and GCS-marked inputs emits GCS feature [shared]
+#source: gcs.s
+#source: gcs2.s
+#alltargets: [check_shared_lib_support] *linux*
+#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
+#ld: -shared -z gcs=implicit -z gcs-report=warning
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[      ]+Owner[        ]+Data size[    ]+Description
+  GNU                  0x00000010      NT_GNU_PROPERTY_TYPE_0
+      Properties: AArch64 feature: GCS
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-2-b-iv.d b/ld/testsuite/ld-aarch64/protections/gcs-2-b-iv.d
new file mode 100644 (file)
index 0000000..c98f3e0
--- /dev/null
@@ -0,0 +1,7 @@
+#name: Specifying only '-z gcs=implicit -z gcs-report=warning' and GCS-unmarked inputs emits no GCS feature without warnings [shared]
+#source: gcs.s
+#source: gcs2.s
+#alltargets: [check_shared_lib_support] *linux*
+#as: -march=armv9.4-a+gcs
+#ld: -shared -z gcs=implicit -z gcs-report=warning
+#readelf: -n
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-2-c-i.d b/ld/testsuite/ld-aarch64/protections/gcs-2-c-i.d
new file mode 100644 (file)
index 0000000..4bf8f6c
--- /dev/null
@@ -0,0 +1,7 @@
+#name: Specifying only '-z gcs=never' and GCS-marked inputs emits no GCS feature [shared]
+#source: gcs.s
+#source: gcs2.s
+#alltargets: [check_shared_lib_support] *linux*
+#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
+#ld: -shared -z gcs=never
+#readelf: -n
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-2-c-ii.d b/ld/testsuite/ld-aarch64/protections/gcs-2-c-ii.d
new file mode 100644 (file)
index 0000000..6941233
--- /dev/null
@@ -0,0 +1,7 @@
+#name: Specifying only '-z gcs=never' and GCS-unmarked inputs emits no GCS feature [shared]
+#source: gcs.s
+#source: gcs2.s
+#alltargets: [check_shared_lib_support] *linux*
+#as: -march=armv9.4-a+gcs
+#ld: -shared -z gcs=never
+#readelf: -n
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-3-a-i.d b/ld/testsuite/ld-aarch64/protections/gcs-3-a-i.d
new file mode 100644 (file)
index 0000000..c1c5ba3
--- /dev/null
@@ -0,0 +1,8 @@
+#name: Specifying only '-z gcs=always -z gcs-report=error' with mixed inputs emits errors [shared]
+#source: gcs.s
+#source: gcs2.s
+#source: nogcs.s
+#alltargets: [check_shared_lib_support] *linux*
+#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
+#ld: -shared -z gcs=always -z gcs-report=error
+#error: \A[^\n]*nogcs\.o: error: GCS is required by -z gcs[^\n]*$
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-3-a-ii.d b/ld/testsuite/ld-aarch64/protections/gcs-3-a-ii.d
new file mode 100644 (file)
index 0000000..d7289be
--- /dev/null
@@ -0,0 +1,14 @@
+#name: Specifying only '-z gcs=always -z gcs-report=warning' with mixed inputs emits GCS feature and warnings [shared]
+#source: gcs.s
+#source: gcs2.s
+#source: nogcs.s
+#alltargets: [check_shared_lib_support] *linux*
+#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
+#ld: -shared -z gcs=always -z gcs-report=warning
+#warning: \A[^\n]*nogcs\.o: warning: GCS is required by -z gcs[^\n]*$
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[      ]+Owner[        ]+Data size[    ]+Description
+  GNU                  0x00000010      NT_GNU_PROPERTY_TYPE_0
+      Properties: AArch64 feature: GCS
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-3-a-iii.d b/ld/testsuite/ld-aarch64/protections/gcs-3-a-iii.d
new file mode 100644 (file)
index 0000000..5f55e2f
--- /dev/null
@@ -0,0 +1,13 @@
+#name: Specifying only '-z gcs=always -z gcs-report=none' with mixed inputs emits GCS feature and no error/warning [shared]
+#source: gcs.s
+#source: gcs2.s
+#source: nogcs.s
+#alltargets: [check_shared_lib_support] *linux*
+#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
+#ld: -shared -z gcs=always -z gcs-report=none
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[      ]+Owner[        ]+Data size[    ]+Description
+  GNU                  0x00000010      NT_GNU_PROPERTY_TYPE_0
+      Properties: AArch64 feature: GCS
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-3-a-iv.d b/ld/testsuite/ld-aarch64/protections/gcs-3-a-iv.d
new file mode 100644 (file)
index 0000000..5c340c4
--- /dev/null
@@ -0,0 +1,14 @@
+#name: Specifying only '-z gcs=always -z gcs-report' with mixed inputs emits GCS feature and warnings [shared]
+#source: gcs.s
+#source: gcs2.s
+#source: nogcs.s
+#alltargets: [check_shared_lib_support] *linux*
+#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
+#ld: -shared -z gcs=always -z gcs-report
+#warning: \A[^\n]*nogcs\.o: warning: GCS is required by -z gcs[^\n]*$
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[      ]+Owner[        ]+Data size[    ]+Description
+  GNU                  0x00000010      NT_GNU_PROPERTY_TYPE_0
+      Properties: AArch64 feature: GCS
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-3-b-i.d b/ld/testsuite/ld-aarch64/protections/gcs-3-b-i.d
new file mode 100644 (file)
index 0000000..70cc1bd
--- /dev/null
@@ -0,0 +1,8 @@
+#name: Specifying only '-z gcs=implicit -z gcs-report=error' with mixed inputs emits no error/warning, and no GCS feature [shared]
+#source: gcs.s
+#source: gcs2.s
+#source: nogcs.s
+#alltargets: [check_shared_lib_support] *linux*
+#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
+#ld: -shared -z gcs=implicit -z gcs-report=error
+#readelf: -n
\ No newline at end of file
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-3-b-ii.d b/ld/testsuite/ld-aarch64/protections/gcs-3-b-ii.d
new file mode 100644 (file)
index 0000000..f03e7ef
--- /dev/null
@@ -0,0 +1,8 @@
+#name: Specifying only '-z gcs=implicit -z gcs-report=warning' with mixed inputs emits no warning, and no GCS feature [shared]
+#source: gcs.s
+#source: gcs2.s
+#source: nogcs.s
+#alltargets: [check_shared_lib_support] *linux*
+#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
+#ld: -shared -z gcs=implicit -z gcs-report=warning
+#readelf: -n
\ No newline at end of file
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-3-b-iii.d b/ld/testsuite/ld-aarch64/protections/gcs-3-b-iii.d
new file mode 100644 (file)
index 0000000..3d3e07c
--- /dev/null
@@ -0,0 +1,8 @@
+#name: Specifying only '-z gcs=implicit -z gcs-report=none' with mixed inputs emits no warning, and no GCS feature [shared]
+#source: gcs.s
+#source: gcs2.s
+#source: nogcs.s
+#alltargets: [check_shared_lib_support] *linux*
+#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
+#ld: -shared -z gcs=implicit -z gcs-report=none
+#readelf: -n
\ No newline at end of file
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-3-c-i.d b/ld/testsuite/ld-aarch64/protections/gcs-3-c-i.d
new file mode 100644 (file)
index 0000000..472bb65
--- /dev/null
@@ -0,0 +1,8 @@
+#name: Specifying only '-z gcs=never -z gcs-report=error' with mixed inputs emits no error/warning, and no GCS feature [shared]
+#source: gcs.s
+#source: gcs2.s
+#source: nogcs.s
+#alltargets: [check_shared_lib_support] *linux*
+#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
+#ld: -shared -z gcs=never -z gcs-report=error
+#readelf: -n
\ No newline at end of file
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-3-c-ii.d b/ld/testsuite/ld-aarch64/protections/gcs-3-c-ii.d
new file mode 100644 (file)
index 0000000..bbe5e10
--- /dev/null
@@ -0,0 +1,8 @@
+#name: Specifying only '-z gcs=never -z gcs-report=warning' with mixed inputs emits no error/warning, and no GCS feature [shared]
+#source: gcs.s
+#source: gcs2.s
+#source: nogcs.s
+#alltargets: [check_shared_lib_support] *linux*
+#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
+#ld: -shared -z gcs=never -z gcs-report=warning
+#readelf: -n
\ No newline at end of file
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-3-c-iii.d b/ld/testsuite/ld-aarch64/protections/gcs-3-c-iii.d
new file mode 100644 (file)
index 0000000..6bf96bc
--- /dev/null
@@ -0,0 +1,8 @@
+#name: Specifying only '-z gcs=never -z gcs-report=none' with mixed inputs emits no error/warning, and no GCS feature [shared]
+#source: gcs.s
+#source: gcs2.s
+#source: nogcs.s
+#alltargets: [check_shared_lib_support] *linux*
+#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
+#ld: -shared -z gcs=never -z gcs-report=none
+#readelf: -n
\ No newline at end of file
diff --git a/ld/testsuite/ld-aarch64/protections/gcs.s b/ld/testsuite/ld-aarch64/protections/gcs.s
new file mode 100644 (file)
index 0000000..3a4ce00
--- /dev/null
@@ -0,0 +1,12 @@
+       .text
+       .globl _start
+       .type _start,@function
+_start:
+       mov x1, #2
+       bl foo
+
+.ifdef __splitted_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/protections/gcs2.s b/ld/testsuite/ld-aarch64/protections/gcs2.s
new file mode 100644 (file)
index 0000000..1e770cc
--- /dev/null
@@ -0,0 +1,32 @@
+       .text
+       .global foo
+       .type   foo, %function
+foo:
+       sub     sp, sp, #16
+       mov     w0, 9
+       str     w0, [sp, 12]
+       ldr     w0, [sp, 12]
+       add     w0, w0, 4
+       str     w0, [sp, 12]
+       nop
+       add     sp, sp, 16
+       ret
+       .size   foo, .-foo
+
+.ifdef __property_gcs__
+       .section ".note.gnu.property", "a"
+       .p2align 3
+       .long 1f - 0f           /* name length */
+       .long 5f - 2f           /* data length */
+       .long 5                 /* note type */
+0:     .asciz "GNU"            /* vendor name */
+1:
+       .p2align 3
+2:     .long 0xc0000000        /* pr_type.  */
+       .long 4f - 3f           /* pr_datasz.  */
+3:
+       .long 0x4               /* GCS.  */
+4:
+       .p2align 3
+5:
+.endif
diff --git a/ld/testsuite/ld-aarch64/protections/nogcs.s b/ld/testsuite/ld-aarch64/protections/nogcs.s
new file mode 100644 (file)
index 0000000..f3079af
--- /dev/null
@@ -0,0 +1,14 @@
+       .text
+       .global foo3
+       .type   foo3, %function
+foo3:
+       sub     sp, sp, #16
+       mov     w0, 9
+       str     w0, [sp, 12]
+       ldr     w0, [sp, 12]
+       add     w0, w0, 4
+       str     w0, [sp, 12]
+       nop
+       add     sp, sp, 16
+       ret
+       .size   foo3, .-foo3