Skip to content

Commit 31214b8

Browse files
committed
use split-file for testing
1 parent 572e5f4 commit 31214b8

9 files changed

+96
-86
lines changed

lld/test/ELF/Inputs/aarch64-func3-pac-replace.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file replace gnu properties with aarch64 build attributes.
1+
// Declare file properties exclusively with aarch64 build attributes.
22

33
.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
44
.aeabi_attribute Tag_Feature_PAC, 1

lld/test/ELF/Inputs/build-attributes-merged-2.s

Lines changed: 0 additions & 8 deletions
This file was deleted.

lld/test/ELF/Inputs/build-attributes-merged-3.s

Lines changed: 0 additions & 8 deletions
This file was deleted.

lld/test/ELF/Inputs/build-attributes-merged-mixed-2.s

Lines changed: 0 additions & 19 deletions
This file was deleted.

lld/test/ELF/Inputs/build-attributes-merged-mixed-3.s

Lines changed: 0 additions & 10 deletions
This file was deleted.

lld/test/ELF/aarch64-build-attributes-merged-1.s

Lines changed: 0 additions & 20 deletions
This file was deleted.

lld/test/ELF/aarch64-build-attributes-merged-mixed-1.s

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# RUN: rm -rf %t && split-file %s %t && cd %t
2+
3+
# RUN: llvm-mc -triple=aarch64 -filetype=obj %s -o %t1.o
4+
# RUN: llvm-mc -triple=aarch64 -filetype=obj merged-mixed-2.s -o %t2.o
5+
# RUN: llvm-mc -triple=aarch64 -filetype=obj merged-mixed-3.s -o %t3.o
6+
# RUN: ld.lld -r %t1.o %t2.o %t3.o -o %t.merged.o
7+
# RUN: llvm-readelf -n %t.merged.o | FileCheck %s
8+
9+
# CHECK: Displaying notes found in: .note.gnu.property
10+
# CHECK-NEXT: Owner Data size Description
11+
# CHECK-NEXT: GNU 0x00000028 NT_GNU_PROPERTY_TYPE_0 (property note)
12+
# CHECK-NEXT: Properties: aarch64 feature: BTI, PAC
13+
# CHECK-NEXT: AArch64 PAuth ABI core info: platform 0x31 (unknown), version 0x13
14+
15+
16+
.aeabi_subsection aeabi_pauthabi, required, uleb128
17+
.aeabi_attribute Tag_PAuth_Platform, 49
18+
.aeabi_attribute Tag_PAuth_Schema, 19
19+
.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
20+
.aeabi_attribute Tag_Feature_BTI, 1
21+
.aeabi_attribute Tag_Feature_PAC, 1
22+
.aeabi_attribute Tag_Feature_GCS, 1
23+
24+
#--- merged-mixed-2.s
25+
.section ".note.gnu.property", "a"
26+
.long 4 // Name length is always 4 ("GNU")
27+
.long end - begin // Data length
28+
.long 5 // Type: NT_GNU_PROPERTY_TYPE_0
29+
.asciz "GNU" // Name
30+
.p2align 3
31+
begin:
32+
.long 0xc0000000 // GNU_PROPERTY_AARCH64_FEATURE_1_AND
33+
.long 4
34+
.long 7 // GNU_PROPERTY_AARCH64_FEATURE_1_BTI, PAC and GCS
35+
.long 0
36+
# PAuth ABI property note
37+
.long 0xc0000001 // Type: GNU_PROPERTY_AARCH64_FEATURE_PAUTH
38+
.long 16 // Data size
39+
.quad 49 // PAuth ABI platform
40+
.quad 19 // PAuth ABI version
41+
.p2align 3 // Align to 8 byte for 64 bit
42+
end:
43+
44+
#--- merged-mixed-3.s
45+
.section ".note.gnu.property", "a"
46+
.long 4
47+
.long 0x10
48+
.long 0x5
49+
.asciz "GNU"
50+
.long 0xc0000000 // GNU_PROPERTY_AARCH64_FEATURE_1_AND
51+
.long 4
52+
.long 3 // GNU_PROPERTY_AARCH64_FEATURE_1_BTI and PAC
53+
.long 0
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# RUN: rm -rf %t && split-file %s %t && cd %t
2+
3+
# RUN: llvm-mc -triple=aarch64 -filetype=obj %s -o %t1.o
4+
# RUN: llvm-mc -triple=aarch64 -filetype=obj merged-2.s -o %t2.o
5+
# RUN: llvm-mc -triple=aarch64 -filetype=obj merged-3.s -o %t3.o
6+
# RUN: ld.lld -r %t1.o %t2.o %t3.o -o %t.merged.o
7+
# RUN: llvm-readelf -n %t.merged.o | FileCheck %s
8+
9+
# CHECK: Displaying notes found in: .note.gnu.property
10+
# CHECK-NEXT: Owner Data size Description
11+
# CHECK-NEXT: GNU 0x00000028 NT_GNU_PROPERTY_TYPE_0 (property note)
12+
# CHECK-NEXT: Properties: aarch64 feature: BTI
13+
# CHECK-NEXT: AArch64 PAuth ABI core info: platform 0x31 (unknown), version 0x13
14+
15+
16+
.aeabi_subsection aeabi_pauthabi, required, uleb128
17+
.aeabi_attribute Tag_PAuth_Platform, 49
18+
.aeabi_attribute Tag_PAuth_Schema, 19
19+
.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
20+
.aeabi_attribute Tag_Feature_BTI, 1
21+
.aeabi_attribute Tag_Feature_PAC, 1
22+
.aeabi_attribute Tag_Feature_GCS, 1
23+
24+
25+
#--- merged-2.s
26+
.aeabi_subsection aeabi_pauthabi, required, uleb128
27+
.aeabi_attribute Tag_PAuth_Platform, 49
28+
.aeabi_attribute Tag_PAuth_Schema, 19
29+
.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
30+
.aeabi_attribute Tag_Feature_BTI, 1
31+
.aeabi_attribute Tag_Feature_PAC, 0
32+
.aeabi_attribute Tag_Feature_GCS, 1
33+
34+
35+
#--- merged-3.s
36+
.aeabi_subsection aeabi_pauthabi, required, uleb128
37+
.aeabi_attribute Tag_PAuth_Platform, 49
38+
.aeabi_attribute Tag_PAuth_Schema, 19
39+
.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
40+
.aeabi_attribute Tag_Feature_BTI, 1
41+
.aeabi_attribute Tag_Feature_PAC, 1
42+
.aeabi_attribute Tag_Feature_GCS, 0

0 commit comments

Comments
 (0)