[lld] ccc4163 - [ELF,test] Clean up aarch64-feature-gcs.s
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 1 11:37:53 PDT 2025
Author: Fangrui Song
Date: 2025-06-01T11:37:48-07:00
New Revision: ccc416312ed72e92a885425d9cb9c01f9afa58eb
URL: https://github.com/llvm/llvm-project/commit/ccc416312ed72e92a885425d9cb9c01f9afa58eb
DIFF: https://github.com/llvm/llvm-project/commit/ccc416312ed72e92a885425d9cb9c01f9afa58eb.diff
LOG: [ELF,test] Clean up aarch64-feature-gcs.s
* Make filenames shorter, aligning with other tests
* Prefer out.* for ld.lld output when using split-file
* Remove redundant RUN: ld.lld lines
Added:
Modified:
lld/test/ELF/aarch64-feature-gcs.s
Removed:
################################################################################
diff --git a/lld/test/ELF/aarch64-feature-gcs.s b/lld/test/ELF/aarch64-feature-gcs.s
index 99407d0b2b095..795e4c943c31a 100644
--- a/lld/test/ELF/aarch64-feature-gcs.s
+++ b/lld/test/ELF/aarch64-feature-gcs.s
@@ -1,76 +1,69 @@
# REQUIRES: aarch64
+## Test the Guarded Control Stack (GCS) feature.
+## Naming convention: *-s.s files enable GCS.
# RUN: rm -rf %t && split-file %s %t && cd %t
-# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu func1-gcs.s -o func1-gcs.o
-# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu func2.s -o func2.o
-# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu func2-gcs.s -o func2-gcs.o
-# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu func3.s -o func3.o
-# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu func3-gcs.s -o func3-gcs.o
+# RUN: llvm-mc -filetype=obj -triple=aarch64 f1-s.s -o f1-s.o
+# RUN: llvm-mc -filetype=obj -triple=aarch64 f2.s -o f2.o
+# RUN: llvm-mc -filetype=obj -triple=aarch64 f2-s.s -o f2-s.o
+# RUN: llvm-mc -filetype=obj -triple=aarch64 f3.s -o f3.o
+# RUN: llvm-mc -filetype=obj -triple=aarch64 f3-s.s -o f3-s.o
## GCS should be enabled when it's enabled in all inputs or when it's forced on.
-# RUN: ld.lld func1-gcs.o func2-gcs.o func3-gcs.o -o gcs
-# RUN: llvm-readelf -n gcs | FileCheck --check-prefix GCS %s
-# RUN: ld.lld func1-gcs.o func3-gcs.o --shared -o gcs.so
-# RUN: llvm-readelf -n gcs.so | FileCheck --check-prefix GCS %s
-# RUN: ld.lld func1-gcs.o func2.o func3-gcs.o -o force-gcs -z gcs=always
-# RUN: llvm-readelf -n force-gcs | FileCheck --check-prefix GCS %s
-# RUN: ld.lld func2-gcs.o func3.o --shared -o force-gcs.so -z gcs=always
-# RUN: llvm-readelf -n force-gcs.so | FileCheck --check-prefix GCS %s
-# RUN: ld.lld func2-gcs.o func3.o --shared -o force-gcs2.so -z gcs=never -z gcs=always
-# RUN: llvm-readelf -n force-gcs2.so | FileCheck --check-prefix GCS %s
+# RUN: ld.lld f1-s.o f2-s.o f3-s.o -o out --fatal-warnings
+# RUN: llvm-readelf -n out | FileCheck --check-prefix GCS %s
+# RUN: ld.lld f1-s.o f2.o f3-s.o -o out.force -z gcs=always --fatal-warnings
+# RUN: llvm-readelf -n out.force | FileCheck --check-prefix GCS %s
+# RUN: ld.lld f2-s.o f3.o --shared -o out.force.so -z gcs=never -z gcs=always --fatal-warnings
+# RUN: llvm-readelf -n out.force.so | FileCheck --check-prefix GCS %s
# GCS: Properties: aarch64 feature: GCS
## GCS should not be enabled if it's not enabled in at least one input.
-# RUN: ld.lld func1-gcs.o func2.o func3-gcs.o -o no-gcs
-# RUN: llvm-readelf -n no-gcs | count 0
-# RUN: ld.lld func2-gcs.o func3.o --shared -o no-gcs.so
+# RUN: ld.lld f1-s.o f2.o f3-s.o -o out.no --fatal-warnings
+# RUN: llvm-readelf -n out.no | count 0
+# RUN: ld.lld f2-s.o f3.o --shared -o out.no.so
## GCS should be disabled with gcs=never, even if GCS is present in all inputs.
-# RUN: ld.lld func1-gcs.o func2-gcs.o func3-gcs.o -z gcs=never -o never-gcs
-# RUN: llvm-readelf -n never-gcs | count 0
-# RUN: ld.lld func1-gcs.o func2-gcs.o func3-gcs.o -z gcs=always -z gcs=never -o never-gcs2
-# RUN: llvm-readelf -n never-gcs2 | count 0
+# RUN: ld.lld f1-s.o f2-s.o f3-s.o -z gcs=always -z gcs=never -o out.never --fatal-warnings
+# RUN: llvm-readelf -n out.never | count 0
## gcs-report should report any input files that don't have the gcs property.
-# RUN: ld.lld func1-gcs.o func2.o func3-gcs.o -z gcs-report=warning 2>&1 | FileCheck --check-prefix=REPORT-WARN %s
-# RUN: ld.lld func1-gcs.o func2.o func3-gcs.o -z gcs-report=warning -z gcs=always 2>&1 | FileCheck --check-prefix=REPORT-WARN %s
-# RUN: ld.lld func1-gcs.o func2.o func3-gcs.o -z gcs-report=warning -z gcs=never 2>&1 | FileCheck --check-prefix=REPORT-WARN %s
-# RUN: not ld.lld func2-gcs.o func3.o --shared -z gcs-report=error 2>&1 | FileCheck --check-prefix=REPORT-ERROR %s
-# RUN: not ld.lld func2-gcs.o func3.o --shared -z gcs-report=error -z gcs=always 2>&1 | FileCheck --check-prefix=REPORT-ERROR %s
-# RUN: not ld.lld func2-gcs.o func3.o --shared -z gcs-report=error -z gcs=never 2>&1 | FileCheck --check-prefix=REPORT-ERROR %s
-# RUN: ld.lld func1-gcs.o func2-gcs.o func3-gcs.o -z gcs-report=warning 2>&1 | count 0
-# RUN: ld.lld func1-gcs.o func2-gcs.o func3-gcs.o -z gcs-report=warning -z gcs=always 2>&1 | count 0
-# RUN: ld.lld func1-gcs.o func2-gcs.o func3-gcs.o -z gcs-report=warning -z gcs=never 2>&1 | count 0
+# RUN: ld.lld f1-s.o f2.o f3-s.o -z gcs-report=warning 2>&1 | FileCheck --check-prefix=REPORT-WARN %s
+# RUN: ld.lld f1-s.o f2.o f3-s.o -z gcs-report=warning -z gcs=always 2>&1 | FileCheck --check-prefix=REPORT-WARN %s
+# RUN: ld.lld f1-s.o f2.o f3-s.o -z gcs-report=warning -z gcs=never 2>&1 | FileCheck --check-prefix=REPORT-WARN %s
+# RUN: not ld.lld f2-s.o f3.o --shared -z gcs-report=error 2>&1 | FileCheck --check-prefix=REPORT-ERROR %s
+# RUN: ld.lld f1-s.o f2-s.o f3-s.o -z gcs-report=warning -z gcs=always 2>&1 | count 0
-# REPORT-WARN: warning: func2.o: -z gcs-report: file does not have GNU_PROPERTY_AARCH64_FEATURE_1_GCS property
-# REPORT-ERROR: error: func3.o: -z gcs-report: file does not have GNU_PROPERTY_AARCH64_FEATURE_1_GCS property
+# REPORT-WARN: warning: f2.o: -z gcs-report: file does not have GNU_PROPERTY_AARCH64_FEATURE_1_GCS property
+# REPORT-WARN-NOT: {{.}}
+# REPORT-ERROR: error: f3.o: -z gcs-report: file does not have GNU_PROPERTY_AARCH64_FEATURE_1_GCS property
+# REPORT-ERROR-NOT: {{.}}
## gcs-report-dynamic should report any dynamic objects that does not have the gcs property. This also ensures the inhertance from gcs-report is working correctly.
-# RUN: ld.lld func1-gcs.o func3-gcs.o no-gcs.so force-gcs.so -z gcs-report=warning -z gcs=always 2>&1 | FileCheck --check-prefix=REPORT-WARN-DYNAMIC %s
-# RUN: ld.lld func1-gcs.o func3-gcs.o no-gcs.so force-gcs.so -z gcs-report=error -z gcs=always 2>&1 | FileCheck --check-prefix=REPORT-WARN-DYNAMIC %s
-# RUN: ld.lld func1-gcs.o func3-gcs.o no-gcs.so force-gcs.so -z gcs-report-dynamic=warning -z gcs=always 2>&1 | FileCheck --check-prefix=REPORT-WARN-DYNAMIC %s
-# RUN: not ld.lld func1-gcs.o func3-gcs.o no-gcs.so force-gcs.so -z gcs-report-dynamic=error -z gcs=always 2>&1 | FileCheck --check-prefix=REPORT-ERROR-DYNAMIC %s
-# RUN: ld.lld func1-gcs.o func3-gcs.o force-gcs.so -z gcs-report-dynamic=warning -z gcs=always 2>&1 | count 0
-# RUN: ld.lld func1-gcs.o func3-gcs.o force-gcs.so -z gcs-report-dynamic=error -z gcs=always 2>&1 | count 0
+# RUN: ld.lld f1-s.o f3-s.o out.no.so out.force.so -z gcs-report=warning -z gcs=always 2>&1 | FileCheck --check-prefix=REPORT-WARN-DYNAMIC %s
+# RUN: ld.lld f1-s.o f3-s.o out.no.so out.force.so -z gcs-report=error -z gcs=always 2>&1 | FileCheck --check-prefix=REPORT-WARN-DYNAMIC %s
+# RUN: ld.lld f1-s.o f3-s.o out.no.so out.force.so -z gcs-report-dynamic=warning -z gcs=always 2>&1 | FileCheck --check-prefix=REPORT-WARN-DYNAMIC %s
+# RUN: not ld.lld f1-s.o f3-s.o out.no.so out.force.so -z gcs-report-dynamic=error -z gcs=always 2>&1 | FileCheck --check-prefix=REPORT-ERROR-DYNAMIC %s
+# RUN: ld.lld f1-s.o f3-s.o out.force.so -z gcs-report-dynamic=error -z gcs=always 2>&1 | count 0
-# REPORT-WARN-DYNAMIC: warning: no-gcs.so: GCS is required by -z gcs, but this shared library lacks the necessary property note. The dynamic loader might not enable GCS or refuse to load the program unless all shared library dependencies have the GCS marking.
-# REPORT-WARN-DYNAMIC-NOT: warning:
-# REPORT-ERROR-DYNAMIC: error: no-gcs.so: GCS is required by -z gcs, but this shared library lacks the necessary property note. The dynamic loader might not enable GCS or refuse to load the program unless all shared library dependencies have the GCS marking.
+# REPORT-WARN-DYNAMIC: warning: out.no.so: GCS is required by -z gcs, but this shared library lacks the necessary property note. The dynamic loader might not enable GCS or refuse to load the program unless all shared library dependencies have the GCS marking.
+# REPORT-WARN-DYNAMIC-NOT: {{.}}
+# REPORT-ERROR-DYNAMIC: error: out.no.so: GCS is required by -z gcs, but this shared library lacks the necessary property note. The dynamic loader might not enable GCS or refuse to load the program unless all shared library dependencies have the GCS marking.
# REPORT-ERROR-DYNAMIC-NOT: error:
## An invalid gcs option should give an error
-# RUN: not ld.lld func1-gcs.o func2-gcs.o func3-gcs.o -z gcs=nonsense -z gcs-report=nonsense -z gcs-report-dynamic=nonsense 2>&1 | FileCheck --check-prefix=INVALID %s
+# RUN: not ld.lld f1-s.o -z gcs=x -z gcs-report=x -z gcs-report-dynamic=x 2>&1 | FileCheck --check-prefix=INVALID %s
-# INVALID: error: unknown -z gcs= value: nonsense
-# INVALID: error: unknown -z gcs-report= value: nonsense
-# INVALID: error: unknown -z gcs-report-dynamic= value: nonsense
+# INVALID: error: unknown -z gcs= value: x
+# INVALID: error: unknown -z gcs-report= value: x
+# INVALID: error: unknown -z gcs-report-dynamic= value: x
-#--- func1-gcs.s
+#--- f1-s.s
.section ".note.gnu.property", "a"
.long 4
.long 0x10
@@ -84,24 +77,22 @@
.text
.globl _start
-.type func1,%function
-func1:
- bl func2
+.type f1,%function
+f1:
+ bl f2
ret
-#--- func2.s
-
+#--- f2.s
.text
-.globl func2
-.type func2, at function
-func2:
- .globl func3
- .type func3, @function
- bl func3
+.globl f2
+.type f2, at function
+f2:
+ .globl f3
+ .type f3, @function
+ bl f3
ret
-#--- func2-gcs.s
-
+#--- f2-s.s
.section ".note.gnu.property", "a"
.long 4
.long 0x10
@@ -114,24 +105,22 @@ func2:
.long 0
.text
-.globl func2
-.type func2, at function
-func2:
- .globl func3
- .type func3, @function
- bl func3
+.globl f2
+.type f2, at function
+f2:
+ .globl f3
+ .type f3, @function
+ bl f3
ret
-#--- func3.s
-
+#--- f3.s
.text
-.globl func3
-.type func3, at function
-func3:
+.globl f3
+.type f3, at function
+f3:
ret
-#--- func3-gcs.s
-
+#--- f3-s.s
.section ".note.gnu.property", "a"
.long 4
.long 0x10
@@ -144,7 +133,7 @@ func3:
.long 0
.text
-.globl func3
-.type func3, at function
-func3:
+.globl f3
+.type f3, at function
+f3:
ret
More information about the llvm-commits
mailing list