Skip to content

Commit e453ae0

Browse files
committed
[AArch64][Build Attributes] Add test files
Add test files
1 parent a126df1 commit e453ae0

9 files changed

+332
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// RUN: llvm-mc -triple=aarch64 %s -o - | FileCheck %s --check-prefix=ASM
2+
// RUN: llvm-mc -triple=aarch64 -filetype=obj %s -o - | llvm-readelf --hex-dump=.ARM.attributes - | FileCheck %s --check-prefix=ELF
3+
4+
// ASM: .aeabi_subsection aeabi_feature_and_bits, optional, uleb128
5+
// ASM: .aeabi_attribute 0, 1 @ Tag_Feature_BTI
6+
// ASM: .aeabi_attribute 1, 0 @ Tag_Feature_PAC
7+
// ASM: .aeabi_attribute 2, 0 @ Tag_Feature_GCS
8+
9+
// ELF: Hex dump of section '.ARM.attributes':
10+
// ELF-NEXT: 0x00000000 41230000 00616561 62695f66 65617475 A#...aeabi_featu
11+
// ELF-NEXT: 0x00000010 72655f61 6e645f62 69747300 01000001 re_and_bits.....
12+
// ELF-NEXT: 0x00000020 01000200
13+
14+
15+
.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
16+
.aeabi_attribute Tag_Feature_BTI, 1
17+
.aeabi_attribute Tag_Feature_PAC, 0
18+
.aeabi_attribute Tag_Feature_GCS, 0
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// RUN: not llvm-mc -triple=aarch64 %s 2>&1 | FileCheck --check-prefix=ERR %s
2+
3+
// Test logic and type mismatch
4+
.aeabi_attribute Tag_Feature_BTI, 1
5+
// ERR: error: no active subsection, build attribute can not be added
6+
// ERR-NEXT: .aeabi_attribute Tag_Feature_BTI, 1
7+
8+
.aeabi_subsection aeabi_pauthabi, required, uleb128
9+
.aeabi_attribute Tag_Feature_BTI, 1
10+
// ERR: error: unknown AArch64 build attribute 'Tag_Feature_BTI' for subsection 'aeabi_pauthabi'
11+
// ERR-NEXT: .aeabi_attribute Tag_Feature_BTI, 1
12+
13+
.aeabi_attribute a, 1
14+
// ERR: error: unknown AArch64 build attribute 'a' for subsection 'aeabi_pauthabi'
15+
// ERR-NEXT: .aeabi_attribute a, 1
16+
17+
.aeabi_attribute Tag_PAuth_Platform, Tag_PAuth_Platform
18+
// ERR: error: active subsection type is ULEB128 (unsigned), found NTBS (string)
19+
// ERR-NEXT: .aeabi_attribute Tag_PAuth_Platform, Tag_PAuth_Platform
20+
21+
.aeabi_attribute Tag_PAuth_Platform, a
22+
// ERR: error: active subsection type is ULEB128 (unsigned), found NTBS (string)
23+
// ERR-NEXT: .aeabi_attribute Tag_PAuth_Platform, a
24+
25+
26+
// Test syntax errors
27+
.aeabi_attribute Tag_PAuth_Platform,
28+
// ERR: error: AArch64 build attributes value not found
29+
// ERR-NEXT: .aeabi_attribute Tag_PAuth_Platform,
30+
31+
.aeabi_attribute Tag_PAuth_Platform
32+
// ERR: error: expected comma
33+
// ERR-NEXT: .aeabi_attribute Tag_PAuth_Platform
34+
35+
.aeabi_attribute
36+
// ERR: error: AArch64 build attributes tag not found
37+
// ERR-NEXT: .aeabi_attribute
38+
39+
.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
40+
.aeabi_attribute Tag_PAuth_Platform, 1
41+
// ERR: unknown AArch64 build attribute 'Tag_PAuth_Platform' for subsection 'aeabi_feature_and_bits'
42+
43+
.aeabi_attribute a, 1
44+
// ERR: error: unknown AArch64 build attribute 'a' for subsection 'aeabi_feature_and_bits'
45+
46+
.aeabi_attribute Tag_Feature_BTI, Tag_Feature_BTI
47+
// ERR: error: active subsection type is ULEB128 (unsigned), found NTBS (string)
48+
// ERR-NEXT: .aeabi_attribute Tag_Feature_BTI, Tag_Feature_BTI
49+
50+
.aeabi_attribute Tag_Feature_BTI, a
51+
// ERR: error: active subsection type is ULEB128 (unsigned), found NTBS (string)
52+
// ERR-NEXT: .aeabi_attribute Tag_Feature_BTI, a
53+
54+
.aeabi_attribute Tag_Feature_BTI,
55+
// ERR: error: AArch64 build attributes value not found
56+
// ERR-NEXT: .aeabi_attribute Tag_Feature_BTI,
57+
58+
.aeabi_attribute Tag_Feature_BTI
59+
// ERR: error: expected comma
60+
// ERR-NEXT: .aeabi_attribute Tag_Feature_BTI
61+
62+
.aeabi_attribute
63+
// ERR: error: AArch64 build attributes tag not found
64+
// ERR-NEXT: .aeabi_attribute
65+
66+
.aeabi_subsection aeabi_pauthabi, required, uleb128
67+
.aeabi_attribute Tag_PAuth_Platform, 1 some_text
68+
// ERR: error: unexpected token for AArch64 build attributes tag and value attribute directive
69+
// ERR-NEXT: .aeabi_attribute Tag_PAuth_Platform, 1 some_text
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// RUN: not llvm-mc -triple=aarch64 %s 2>&1 | FileCheck --check-prefix=ERR %s
2+
3+
// Test syntax errors
4+
.aeabi_subsection 1, required, uleb128
5+
// ERR: error: subsection name not found
6+
// ERR-NEXT: .aeabi_subsection 1, required, uleb128
7+
8+
.aeabi_subsection , required, uleb128
9+
// ERR: error: subsection name not found
10+
// ERR-NEXT: .aeabi_subsection , required, uleb128
11+
12+
.aeabi_subsection aeabi_pauthabi, a, uleb128
13+
// ERR: error: unknown AArch64 build attributes optionality, expected required|optional
14+
// ERR-NEXT: .aeabi_subsection aeabi_pauthabi, a, uleb128
15+
16+
.aeabi_subsection aeabi_pauthabi, 1, uleb128
17+
// ERR: error: optionality parameter not found, expected required|optional
18+
// ERR-NEXT: .aeabi_subsection aeabi_pauthabi, 1, uleb128
19+
20+
.aeabi_subsection aeabi_pauthabi, ,uleb128
21+
// ERR: error: optionality parameter not found, expected required|optional
22+
// ERR-NEXT: .aeabi_subsection aeabi_pauthabi, ,uleb128
23+
24+
.aeabi_subsection aeabi_pauthabi,uleb128
25+
// ERR: error: unknown AArch64 build attributes optionality, expected required|optional
26+
// ERR-NEXT: .aeabi_subsection aeabi_pauthabi,uleb128
27+
28+
.aeabi_subsection aeabi_pauthabi uleb128
29+
// ERR: expected comma
30+
// ERR-NEXT: .aeabi_subsection aeabi_pauthabi uleb128
31+
32+
.aeabi_subsection aeabi_pauthabi, required
33+
// ERR: error: expected comma
34+
// ERR-NEXT: .aeabi_subsection aeabi_pauthabi, required
35+
36+
.aeabi_subsection aeabi_pauthabi, required,
37+
// ERR: error: type parameter not found, expected uleb128|ntbs
38+
// ERR-NEXT: .aeabi_subsection aeabi_pauthabi, required,
39+
40+
.aeabi_subsection aeabi_pauthabi, required, a
41+
// ERR: error: unknown AArch64 build attributes type, expected uleb128|ntbs
42+
// ERR-NEXT: .aeabi_subsection aeabi_pauthabi, required, a
43+
44+
.aeabi_subsection aeabi_pauthabi, optional, uleb128
45+
// ERR: error: aeabi_pauthabi must be marked as required
46+
// ERR-NEXT: .aeabi_subsection aeabi_pauthabi, optional, uleb128
47+
48+
49+
// Test types mismatch
50+
.aeabi_subsection aeabi_pauthabi, optional, uleb128
51+
// ERR: error: aeabi_pauthabi must be marked as required
52+
// ERR-NEXT: .aeabi_subsection aeabi_pauthabi, optional, uleb128
53+
54+
.aeabi_subsection aeabi_pauthabi, required, ntbs
55+
// ERR: error: aeabi_pauthabi must be marked as ULEB128
56+
// ERR-NEXT: .aeabi_subsection aeabi_pauthabi, required, ntbs
57+
58+
.aeabi_subsection aeabi_feature_and_bits, required, uleb128
59+
// ERR: error: aeabi_feature_and_bits must be marked as optional
60+
// ERR-NEXT: .aeabi_subsection aeabi_feature_and_bits, required, uleb128
61+
62+
.aeabi_subsection aeabi_feature_and_bits, optional, ntbs
63+
// ERR: error: aeabi_feature_and_bits must be marked as ULEB128
64+
// ERR-NEXT: .aeabi_subsection aeabi_feature_and_bits, optional, ntbs
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// RUN: llvm-mc -triple=aarch64 %s -o - | FileCheck %s --check-prefix=ASM
2+
// RUN: llvm-mc -triple=aarch64 -filetype=obj %s -o - | llvm-readelf --hex-dump=.ARM.attributes - | FileCheck %s --check-prefix=ELF
3+
4+
// ASM: .aeabi_subsection aeabi_feature_and_bits, optional, uleb128
5+
// ASM: .aeabi_attribute 0, 0 @ Tag_Feature_BTI
6+
// ASM: .aeabi_attribute 1, 0 @ Tag_Feature_PAC
7+
// ASM: .aeabi_attribute 2, 1 @ Tag_Feature_GCS
8+
9+
// ELF: Hex dump of section '.ARM.attributes':
10+
// ELF-NEXT: 0x00000000 41230000 00616561 62695f66 65617475 A#...aeabi_featu
11+
// ELF-NEXT: 0x00000010 72655f61 6e645f62 69747300 01000000 re_and_bits.....
12+
// ELF-NEXT: 0x00000020 01000201
13+
14+
15+
.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
16+
.aeabi_attribute Tag_Feature_BTI, 0
17+
.aeabi_attribute Tag_Feature_PAC, 0
18+
.aeabi_attribute Tag_Feature_GCS, 1
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// RUN: llvm-mc -triple=aarch64 %s -o - | FileCheck %s --check-prefix=ASM
2+
// RUN: llvm-mc -triple=aarch64 -filetype=obj %s -o - | llvm-readelf --hex-dump=.ARM.attributes - | FileCheck %s --check-prefix=ELF
3+
4+
// ASM: .aeabi_subsection aeabi_pauthabi, required, uleb128
5+
// ASM: .aeabi_attribute 1, 0 @ Tag_PAuth_Platform
6+
// ASM: .aeabi_attribute 2, 0 @ Tag_PAuth_Schema
7+
// ASM: .aeabi_subsection aeabi_feature_and_bits, optional, uleb128
8+
// ASM: .aeabi_attribute 0, 0 @ Tag_Feature_BTI
9+
// ASM: .aeabi_attribute 1, 0 @ Tag_Feature_PAC
10+
// ASM: .aeabi_attribute 2, 0 @ Tag_Feature_GCS
11+
12+
// ELF: Hex dump of section '.ARM.attributes':
13+
// ELF-NEXT: 0x00000000 41190000 00616561 62695f70 61757468 A....aeabi_pauth
14+
// ELF-NEXT: 0x00000010 61626900 00000100 02002300 00006165 abi.......#...ae
15+
// ELF-NEXT: 0x00000020 6162695f 66656174 7572655f 616e645f abi_feature_and_
16+
// ELF-NEXT: 0x00000030 62697473 00010000 00010002 00
17+
18+
19+
.aeabi_subsection aeabi_pauthabi, required, uleb128
20+
.aeabi_attribute Tag_PAuth_Platform, 0
21+
.aeabi_attribute Tag_PAuth_Schema, 0
22+
.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
23+
.aeabi_attribute Tag_Feature_BTI, 0
24+
.aeabi_attribute Tag_Feature_PAC, 0
25+
.aeabi_attribute Tag_Feature_GCS, 0
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// RUN: llvm-mc -triple=aarch64 %s -o - | FileCheck %s --check-prefix=ASM
2+
3+
// ASM: .aeabi_subsection aeabi_pauthabi, required, uleb128
4+
// ASM: .aeabi_attribute 0, 1
5+
// ASM: .aeabi_attribute 1, 1 @ Tag_PAuth_Platform
6+
// ASM: .aeabi_attribute 2, 1 @ Tag_PAuth_Schema
7+
// ASM: .aeabi_attribute 3, 1
8+
// ASM: .aeabi_attribute 4, 1
9+
// ASM: .aeabi_attribute 5, 1
10+
// ASM: .aeabi_subsection aeabi_feature_and_bits, optional, uleb128
11+
// ASM: .aeabi_attribute 0, 1 @ Tag_Feature_BTI
12+
// ASM: .aeabi_attribute 1, 1 @ Tag_Feature_PAC
13+
// ASM: .aeabi_attribute 2, 1 @ Tag_Feature_GCS
14+
// ASM: .aeabi_attribute 3, 1
15+
// ASM: .aeabi_attribute 4, 1
16+
// ASM: .aeabi_attribute 5, 1
17+
18+
// ELF: Hex dump of section '.ARM.attributes':
19+
// ELF-NEXT: 0x00000000 41210000 00616561 62695f70 61757468 A!...aeabi_pauth
20+
// ELF-NEXT: 0x00000010 61626900 00000001 01010201 03010401 abi.............
21+
// ELF-NEXT: 0x00000020 05012900 00006165 6162695f 66656174 ..)...aeabi_feat
22+
// ELF-NEXT: 0x00000030 7572655f 616e645f 62697473 00010000 ure_and_bits....
23+
// ELF-NEXT: 0x00000040 01010102 01030104 010501
24+
25+
26+
.aeabi_subsection aeabi_pauthabi, required, uleb128
27+
.aeabi_attribute 0, 1
28+
.aeabi_attribute 1, 1
29+
.aeabi_attribute 2, 1
30+
.aeabi_attribute 3, 1
31+
.aeabi_attribute 4, 1
32+
.aeabi_attribute 5, 1
33+
.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
34+
.aeabi_attribute 0, 1
35+
.aeabi_attribute 1, 1
36+
.aeabi_attribute 2, 1
37+
.aeabi_attribute 3, 1
38+
.aeabi_attribute 4, 1
39+
.aeabi_attribute 5, 1
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// RUN: llvm-mc -triple=aarch64 %s -o - | FileCheck %s --check-prefix=ASM
2+
// RUN: llvm-mc -triple=aarch64 -filetype=obj %s -o - | llvm-readelf --hex-dump=.ARM.attributes - | FileCheck %s --check-prefix=ELF
3+
4+
// ASM: .aeabi_subsection aeabi_pauthabi, required, uleb128
5+
// ASM: .aeabi_subsection aeabi_feature_and_bits, optional, uleb128
6+
// ASM: .aeabi_attribute 0, 1 @ Tag_Feature_BTI
7+
// ASM: .aeabi_subsection aeabi_feature_and_bits, optional, uleb128
8+
// ASM: .aeabi_subsection aeabi_pauthabi, required, uleb128
9+
// ASM: .aeabi_attribute 2, 1 @ Tag_PAuth_Schema
10+
// ASM: .aeabi_subsection aeabi_pauthabi, required, uleb128
11+
// ASM: .aeabi_attribute 1, 1 @ Tag_PAuth_Platform
12+
// ASM: .aeabi_subsection aeabi_pauthabi, required, uleb128
13+
// ASM: .aeabi_subsection aeabi_feature_and_bits, optional, uleb128
14+
// ASM: .aeabi_attribute 2, 1 @ Tag_Feature_GCS
15+
// ASM: .aeabi_subsection aeabi_pauthabi, required, uleb128
16+
// ASM: .aeabi_subsection aeabi_feature_and_bits, optional, uleb128
17+
// ASM: .aeabi_attribute 1, 0 @ Tag_Feature_PAC
18+
// ASM: .aeabi_subsection aeabi_feature_and_bits, optional, uleb128
19+
// ASM: .aeabi_attribute 7, 1
20+
// ASM: .aeabi_subsection aeabi_pauthabi, required, uleb128
21+
// ASM: .aeabi_attribute 7, 0
22+
23+
// ELF: Hex dump of section '.ARM.attributes':
24+
// ELF-NEXT: 0x00000000 411b0000 00616561 62695f70 61757468 A....aeabi_pauth
25+
// ELF-NEXT: 0x00000010 61626900 00000201 01010700 25000000 abi.........%...
26+
// ELF-NEXT: 0x00000020 61656162 695f6665 61747572 655f616e aeabi_feature_an
27+
// ELF-NEXT: 0x00000030 645f6269 74730001 00000102 01010007 d_bits..........
28+
// ELF-NEXT: 0x00000040 01
29+
30+
31+
.aeabi_subsection aeabi_pauthabi, required, uleb128
32+
.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
33+
.aeabi_attribute Tag_Feature_BTI, 1
34+
.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
35+
.aeabi_subsection aeabi_pauthabi, required, uleb128
36+
.aeabi_attribute Tag_PAuth_Schema, 1
37+
.aeabi_subsection aeabi_pauthabi, required, uleb128
38+
.aeabi_attribute Tag_PAuth_Platform, 1
39+
.aeabi_subsection aeabi_pauthabi, required, uleb128
40+
.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
41+
.aeabi_attribute Tag_Feature_GCS, 1
42+
.aeabi_subsection aeabi_pauthabi, required, uleb128
43+
.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
44+
.aeabi_attribute Tag_Feature_PAC, 0
45+
.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
46+
.aeabi_attribute 7, 1
47+
.aeabi_subsection aeabi_pauthabi, required, uleb128
48+
.aeabi_attribute 7, 0
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// RUN: llvm-mc -triple=aarch64 %s -o - | FileCheck %s --check-prefix=ASM
2+
// RUN: llvm-mc -triple=aarch64 -filetype=obj %s -o - | llvm-readelf --hex-dump=.ARM.attributes - | FileCheck %s --check-prefix=ELF
3+
4+
// ASM: .aeabi_subsection aeabi_feature_and_bits, optional, uleb128
5+
// ASM: .aeabi_attribute 0, 0 @ Tag_Feature_BTI
6+
// ASM: .aeabi_attribute 1, 1 @ Tag_Feature_PAC
7+
// ASM: .aeabi_attribute 2, 0 @ Tag_Feature_GCS
8+
9+
// ELF: Hex dump of section '.ARM.attributes':
10+
// ELF-NEXT: 0x00000000 41230000 00616561 62695f66 65617475 A#...aeabi_featu
11+
// ELF-NEXT: 0x00000010 72655f61 6e645f62 69747300 01000000 re_and_bits.....
12+
// ELF-NEXT: 0x00000020 01010200
13+
14+
15+
.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
16+
.aeabi_attribute 0, 0 @ Tag_Feature_BTI
17+
.aeabi_attribute 1, 1 @ Tag_Feature_PAC
18+
.aeabi_attribute 2, 0 @ Tag_Feature_GCS
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// RUN: not llvm-mc -triple=aarch64 %s 2>&1 | FileCheck --check-prefix=ERR %s
2+
3+
.aeabi_subsection private_subsection, optional, uleb128
4+
5+
.aeabi_subsection private_subsection, required, uleb128
6+
// ERR: error: optionality mismatch! subsection 'private_subsection' already exists with optionality defined as 'optional' and not 'required'
7+
// ERR-NEXT: .aeabi_subsection private_subsection, required, uleb128
8+
9+
.aeabi_subsection private_subsection, optional, ntbs
10+
// ERR: error: type mismatch! subsection 'private_subsection' already exists with type defined as 'uleb128' and not 'ntbs'
11+
// ERR-NEXT: .aeabi_subsection private_subsection, optional, ntbs
12+
13+
.aeabi_subsection private_subsection_1, optional, ntbs
14+
.aeabi_attribute 324, 1
15+
// ERR: error: active subsection type is NTBS (string), found ULEB128 (unsigned)
16+
// ERR-NEXT: .aeabi_attribute 324, 1
17+
18+
.aeabi_attribute str_not_int, "1"
19+
// ERR: error: unrecognized Tag: 'str_not_int'
20+
// ERR-NEXT: Except for public subsections, tags have to be an unsigned int.
21+
// ERR-NEXT: .aeabi_attribute str_not_int, "1"
22+
23+
.aeabi_subsection foo, optional, uleb128
24+
.aeabi_subsection bar, optional, uleb128
25+
.aeabi_subsection foo, required, uleb128
26+
// ERR: error: optionality mismatch! subsection 'foo' already exists with optionality defined as 'optional' and not 'required'
27+
// ERR-NEXT: .aeabi_subsection foo, required, uleb128
28+
29+
.aeabi_subsection goo, optional, ntbs
30+
.aeabi_subsection zar, optional, ntbs
31+
.aeabi_subsection goo, optional, uleb128
32+
// ERR: error: type mismatch! subsection 'goo' already exists with type defined as 'ntbs' and not 'uleb128'
33+
// ERR-NEXT: .aeabi_subsection goo, optional, uleb128

0 commit comments

Comments
 (0)