Skip to content

Commit ccc4163

Browse files
committed
[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
1 parent 2a19efe commit ccc4163

File tree

1 file changed

+65
-76
lines changed

1 file changed

+65
-76
lines changed

lld/test/ELF/aarch64-feature-gcs.s

Lines changed: 65 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,69 @@
11
# REQUIRES: aarch64
2+
## Test the Guarded Control Stack (GCS) feature.
3+
## Naming convention: *-s.s files enable GCS.
24
# RUN: rm -rf %t && split-file %s %t && cd %t
3-
# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu func1-gcs.s -o func1-gcs.o
4-
# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu func2.s -o func2.o
5-
# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu func2-gcs.s -o func2-gcs.o
6-
# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu func3.s -o func3.o
7-
# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu func3-gcs.s -o func3-gcs.o
5+
# RUN: llvm-mc -filetype=obj -triple=aarch64 f1-s.s -o f1-s.o
6+
# RUN: llvm-mc -filetype=obj -triple=aarch64 f2.s -o f2.o
7+
# RUN: llvm-mc -filetype=obj -triple=aarch64 f2-s.s -o f2-s.o
8+
# RUN: llvm-mc -filetype=obj -triple=aarch64 f3.s -o f3.o
9+
# RUN: llvm-mc -filetype=obj -triple=aarch64 f3-s.s -o f3-s.o
810

911
## GCS should be enabled when it's enabled in all inputs or when it's forced on.
1012

11-
# RUN: ld.lld func1-gcs.o func2-gcs.o func3-gcs.o -o gcs
12-
# RUN: llvm-readelf -n gcs | FileCheck --check-prefix GCS %s
13-
# RUN: ld.lld func1-gcs.o func3-gcs.o --shared -o gcs.so
14-
# RUN: llvm-readelf -n gcs.so | FileCheck --check-prefix GCS %s
15-
# RUN: ld.lld func1-gcs.o func2.o func3-gcs.o -o force-gcs -z gcs=always
16-
# RUN: llvm-readelf -n force-gcs | FileCheck --check-prefix GCS %s
17-
# RUN: ld.lld func2-gcs.o func3.o --shared -o force-gcs.so -z gcs=always
18-
# RUN: llvm-readelf -n force-gcs.so | FileCheck --check-prefix GCS %s
19-
# RUN: ld.lld func2-gcs.o func3.o --shared -o force-gcs2.so -z gcs=never -z gcs=always
20-
# RUN: llvm-readelf -n force-gcs2.so | FileCheck --check-prefix GCS %s
13+
# RUN: ld.lld f1-s.o f2-s.o f3-s.o -o out --fatal-warnings
14+
# RUN: llvm-readelf -n out | FileCheck --check-prefix GCS %s
15+
# RUN: ld.lld f1-s.o f2.o f3-s.o -o out.force -z gcs=always --fatal-warnings
16+
# RUN: llvm-readelf -n out.force | FileCheck --check-prefix GCS %s
17+
# RUN: ld.lld f2-s.o f3.o --shared -o out.force.so -z gcs=never -z gcs=always --fatal-warnings
18+
# RUN: llvm-readelf -n out.force.so | FileCheck --check-prefix GCS %s
2119

2220
# GCS: Properties: aarch64 feature: GCS
2321

2422
## GCS should not be enabled if it's not enabled in at least one input.
2523

26-
# RUN: ld.lld func1-gcs.o func2.o func3-gcs.o -o no-gcs
27-
# RUN: llvm-readelf -n no-gcs | count 0
28-
# RUN: ld.lld func2-gcs.o func3.o --shared -o no-gcs.so
24+
# RUN: ld.lld f1-s.o f2.o f3-s.o -o out.no --fatal-warnings
25+
# RUN: llvm-readelf -n out.no | count 0
26+
# RUN: ld.lld f2-s.o f3.o --shared -o out.no.so
2927

3028
## GCS should be disabled with gcs=never, even if GCS is present in all inputs.
3129

32-
# RUN: ld.lld func1-gcs.o func2-gcs.o func3-gcs.o -z gcs=never -o never-gcs
33-
# RUN: llvm-readelf -n never-gcs | count 0
34-
# RUN: ld.lld func1-gcs.o func2-gcs.o func3-gcs.o -z gcs=always -z gcs=never -o never-gcs2
35-
# RUN: llvm-readelf -n never-gcs2 | count 0
30+
# RUN: ld.lld f1-s.o f2-s.o f3-s.o -z gcs=always -z gcs=never -o out.never --fatal-warnings
31+
# RUN: llvm-readelf -n out.never | count 0
3632

3733
## gcs-report should report any input files that don't have the gcs property.
3834

39-
# RUN: ld.lld func1-gcs.o func2.o func3-gcs.o -z gcs-report=warning 2>&1 | FileCheck --check-prefix=REPORT-WARN %s
40-
# 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
41-
# 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
42-
# RUN: not ld.lld func2-gcs.o func3.o --shared -z gcs-report=error 2>&1 | FileCheck --check-prefix=REPORT-ERROR %s
43-
# 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
44-
# 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
45-
# RUN: ld.lld func1-gcs.o func2-gcs.o func3-gcs.o -z gcs-report=warning 2>&1 | count 0
46-
# RUN: ld.lld func1-gcs.o func2-gcs.o func3-gcs.o -z gcs-report=warning -z gcs=always 2>&1 | count 0
47-
# RUN: ld.lld func1-gcs.o func2-gcs.o func3-gcs.o -z gcs-report=warning -z gcs=never 2>&1 | count 0
35+
# RUN: ld.lld f1-s.o f2.o f3-s.o -z gcs-report=warning 2>&1 | FileCheck --check-prefix=REPORT-WARN %s
36+
# 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
37+
# 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
38+
# RUN: not ld.lld f2-s.o f3.o --shared -z gcs-report=error 2>&1 | FileCheck --check-prefix=REPORT-ERROR %s
39+
# RUN: ld.lld f1-s.o f2-s.o f3-s.o -z gcs-report=warning -z gcs=always 2>&1 | count 0
4840

49-
# REPORT-WARN: warning: func2.o: -z gcs-report: file does not have GNU_PROPERTY_AARCH64_FEATURE_1_GCS property
50-
# REPORT-ERROR: error: func3.o: -z gcs-report: file does not have GNU_PROPERTY_AARCH64_FEATURE_1_GCS property
41+
# REPORT-WARN: warning: f2.o: -z gcs-report: file does not have GNU_PROPERTY_AARCH64_FEATURE_1_GCS property
42+
# REPORT-WARN-NOT: {{.}}
43+
# REPORT-ERROR: error: f3.o: -z gcs-report: file does not have GNU_PROPERTY_AARCH64_FEATURE_1_GCS property
44+
# REPORT-ERROR-NOT: {{.}}
5145

5246
## 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.
5347

54-
# 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
55-
# 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
56-
# 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
57-
# 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
58-
# RUN: ld.lld func1-gcs.o func3-gcs.o force-gcs.so -z gcs-report-dynamic=warning -z gcs=always 2>&1 | count 0
59-
# RUN: ld.lld func1-gcs.o func3-gcs.o force-gcs.so -z gcs-report-dynamic=error -z gcs=always 2>&1 | count 0
48+
# 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
49+
# 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
50+
# 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
51+
# 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
52+
# RUN: ld.lld f1-s.o f3-s.o out.force.so -z gcs-report-dynamic=error -z gcs=always 2>&1 | count 0
6053

61-
# 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.
62-
# REPORT-WARN-DYNAMIC-NOT: warning:
63-
# 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.
54+
# 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.
55+
# REPORT-WARN-DYNAMIC-NOT: {{.}}
56+
# 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.
6457
# REPORT-ERROR-DYNAMIC-NOT: error:
6558

6659
## An invalid gcs option should give an error
67-
# 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
60+
# 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
6861

69-
# INVALID: error: unknown -z gcs= value: nonsense
70-
# INVALID: error: unknown -z gcs-report= value: nonsense
71-
# INVALID: error: unknown -z gcs-report-dynamic= value: nonsense
62+
# INVALID: error: unknown -z gcs= value: x
63+
# INVALID: error: unknown -z gcs-report= value: x
64+
# INVALID: error: unknown -z gcs-report-dynamic= value: x
7265

73-
#--- func1-gcs.s
66+
#--- f1-s.s
7467
.section ".note.gnu.property", "a"
7568
.long 4
7669
.long 0x10
@@ -84,24 +77,22 @@
8477

8578
.text
8679
.globl _start
87-
.type func1,%function
88-
func1:
89-
bl func2
80+
.type f1,%function
81+
f1:
82+
bl f2
9083
ret
9184

92-
#--- func2.s
93-
85+
#--- f2.s
9486
.text
95-
.globl func2
96-
.type func2,@function
97-
func2:
98-
.globl func3
99-
.type func3, @function
100-
bl func3
87+
.globl f2
88+
.type f2,@function
89+
f2:
90+
.globl f3
91+
.type f3, @function
92+
bl f3
10193
ret
10294

103-
#--- func2-gcs.s
104-
95+
#--- f2-s.s
10596
.section ".note.gnu.property", "a"
10697
.long 4
10798
.long 0x10
@@ -114,24 +105,22 @@ func2:
114105
.long 0
115106

116107
.text
117-
.globl func2
118-
.type func2,@function
119-
func2:
120-
.globl func3
121-
.type func3, @function
122-
bl func3
108+
.globl f2
109+
.type f2,@function
110+
f2:
111+
.globl f3
112+
.type f3, @function
113+
bl f3
123114
ret
124115

125-
#--- func3.s
126-
116+
#--- f3.s
127117
.text
128-
.globl func3
129-
.type func3,@function
130-
func3:
118+
.globl f3
119+
.type f3,@function
120+
f3:
131121
ret
132122

133-
#--- func3-gcs.s
134-
123+
#--- f3-s.s
135124
.section ".note.gnu.property", "a"
136125
.long 4
137126
.long 0x10
@@ -144,7 +133,7 @@ func3:
144133
.long 0
145134

146135
.text
147-
.globl func3
148-
.type func3,@function
149-
func3:
136+
.globl f3
137+
.type f3,@function
138+
f3:
150139
ret

0 commit comments

Comments
 (0)