Skip to content

Commit 1751320

Browse files
Merge pull request #69060 from kateinoigakukun/pr-0aedcead5c2
2 parents 229398c + 34359eb commit 1751320

File tree

3 files changed

+83
-20
lines changed

3 files changed

+83
-20
lines changed

test/IRGen/section.swift

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// RUN: %target-swift-frontend -enable-experimental-feature SymbolLinkageMarkers -primary-file %s -emit-sil -parse-as-library | %FileCheck %s --check-prefix=SIL
22
// RUN: %target-swift-frontend -enable-experimental-feature SymbolLinkageMarkers -primary-file %s -emit-ir -parse-as-library | %FileCheck %s --check-prefix=IR
3-
// RUN: %target-swift-frontend -enable-experimental-feature SymbolLinkageMarkers -primary-file %s -S -parse-as-library | %FileCheck %s --check-prefix=ASM --check-prefix ASM-%target-os
43

54
// REQUIRES: swift_in_compiler
65

@@ -46,22 +45,3 @@
4645
// IR: @"$s7section2g5_Wz" = internal global {{i64|i32}} 0
4746
// IR: @"$s7section2g5SpySiGSgvp" = hidden global {{i64|i32}} 1111638594, section "__TEXT,__mysection"
4847
// IR: define {{.*}}@"$s7section3fooyyF"(){{.*}} section "__TEXT,__mysection"
49-
50-
// ASM: .section{{.*}}__TEXT,__mysection
51-
// ASM-NOT: .section
52-
// ASM: $s7section3fooyyF:
53-
// ASM-linux-gnu: .section{{.*}}__TEXT,__mysection
54-
// ASM-linux-android: .section{{.*}}__TEXT,__mysection
55-
// ASM-linux-androideabi: .section{{.*}}__TEXT,__mysection
56-
// ASM-NOT: .section
57-
// ASM: $s7section2g0Sivp:
58-
// ASM-NOT: .section
59-
// ASM: $s7section2g1Si_Sitvp:
60-
// ASM-NOT: .section
61-
// ASM: $s7section2g2Sbvp:
62-
// ASM-NOT: .section
63-
// ASM: $s7section2g3Sbvp:
64-
// ASM-NOT: .section
65-
// ASM: $s7section2g4SpySiGSgvp:
66-
// ASM-NOT: .section
67-
// ASM: $s7section2g5SpySiGSgvp:

test/IRGen/section_asm.swift

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// RUN: %target-swift-frontend -enable-experimental-feature SymbolLinkageMarkers -primary-file %S/section.swift -S -parse-as-library | %FileCheck %s --check-prefix=ASM --check-prefix ASM-%target-os
2+
// REQUIRES: swift_in_compiler
3+
// UNSUPPORTED: CPU=wasm32
4+
5+
// ASM: .section{{.*}}__TEXT,__mysection
6+
// ASM-NOT: .section
7+
// ASM: $s7section3fooyyF:
8+
// ASM-linux-gnu: .section{{.*}}__TEXT,__mysection
9+
// ASM-linux-android: .section{{.*}}__TEXT,__mysection
10+
// ASM-linux-androideabi: .section{{.*}}__TEXT,__mysection
11+
// ASM-NOT: .section
12+
// ASM: $s7section2g0Sivp:
13+
// ASM-NOT: .section
14+
// ASM: $s7section2g1Si_Sitvp:
15+
// ASM-NOT: .section
16+
// ASM: $s7section2g2Sbvp:
17+
// ASM-NOT: .section
18+
// ASM: $s7section2g3Sbvp:
19+
// ASM-NOT: .section
20+
// ASM: $s7section2g4SpySiGSgvp:
21+
// ASM-NOT: .section
22+
// ASM: $s7section2g5SpySiGSgvp:

test/IRGen/section_wasm.swift

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// RUN: %target-swift-frontend -enable-experimental-feature SymbolLinkageMarkers -primary-file %S/section.swift -S -parse-as-library | %FileCheck %s --check-prefix=ASM --check-prefix ASM-%target-os
2+
// REQUIRES: CPU=wasm32
3+
// REQUIRES: swift_in_compiler
4+
5+
// Wasm cannot have user defined section name for code sections
6+
//
7+
// ASM-NOT: .section{{.*}}__TEXT,__mysection
8+
// ASM: .section ".text.$s7section3fooyyF"
9+
// ASM: $s7section3fooyyF:
10+
11+
// Wasm places one-time init token on .bss section before each "__TEXT,__mysection"
12+
// so need to put .section directives for each data to switch sections.
13+
// Here is an example pattern of a global variable with @section
14+
// ```
15+
// .type $s7section2g0_Wz,@object
16+
// .section ".bss.$s7section2g0_Wz","",@
17+
// .p2align 2, 0x0
18+
// $s7section2g0_Wz:
19+
// .int32 0
20+
// .size $s7section2g0_Wz, 4
21+
//
22+
// .hidden $s7section2g0Sivp
23+
// .type $s7section2g0Sivp,@object
24+
// .section "__TEXT,__mysection","",@
25+
// .globl $s7section2g0Sivp
26+
// .p2align 2, 0x0
27+
// $s7section2g0Sivp:
28+
// .int32 1
29+
// .size $s7section2g0Sivp, 4
30+
// ```
31+
32+
//
33+
// ASM: .section ".bss.$s7section2g0_Wz"
34+
// ASM: $s7section2g0_Wz:
35+
// ASM: .section "__TEXT,__mysection"
36+
// ASM: $s7section2g0Sivp:
37+
38+
// ASM: .section ".bss.$s7section2g1_Wz"
39+
// ASM: $s7section2g1_Wz:
40+
// ASM: .section "__TEXT,__mysection"
41+
// ASM: $s7section2g1Si_Sitvp:
42+
43+
// ASM: .section ".bss.$s7section2g2_Wz"
44+
// ASM: $s7section2g2_Wz:
45+
// ASM: .section "__TEXT,__mysection"
46+
// ASM: $s7section2g2Sbvp:
47+
48+
// ASM: .section ".bss.$s7section2g3_Wz"
49+
// ASM: $s7section2g3_Wz:
50+
// ASM: .section "__TEXT,__mysection"
51+
// ASM: $s7section2g3Sbvp:
52+
53+
// ASM: .section ".bss.$s7section2g4_Wz"
54+
// ASM: $s7section2g4_Wz:
55+
// ASM: .section "__TEXT,__mysection"
56+
// ASM: $s7section2g4SpySiGSgvp:
57+
58+
// ASM: .section ".bss.$s7section2g5_Wz"
59+
// ASM: $s7section2g5_Wz:
60+
// ASM: .section "__TEXT,__mysection"
61+
// ASM: $s7section2g5SpySiGSgvp:

0 commit comments

Comments
 (0)