• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -mtriple i386-pc-win32 < %s \
2; RUN:    | FileCheck -check-prefix CHECK -check-prefix CHECK-CL %s
3; RUN: llc -mtriple i386-pc-mingw32 < %s \
4; RUN:    | FileCheck -check-prefix CHECK -check-prefix CHECK-GCC %s
5; RUN: llc -mtriple i686-pc-cygwin %s -o - \
6; RUN:    | FileCheck -check-prefix CHECK -check-prefix CHECK-GCC %s
7; RUN: llc -mtriple i386-pc-win32 < %s \
8; RUN:    | FileCheck -check-prefix NOTEXPORTED %s
9; RUN: llc -mtriple i386-pc-mingw32 < %s \
10; RUN:    | FileCheck -check-prefix NOTEXPORTED %s
11; RUN: llc -mtriple i686-pc-cygwin %s -o - \
12; RUN:    | FileCheck -check-prefix NOTEXPORTED %s
13
14; CHECK: .text
15
16define void @notExported() {
17	ret void
18}
19
20; CHECK: .globl _f1
21define dllexport void @f1() {
22	ret void
23}
24
25; CHECK: .globl _f2
26define dllexport void @f2() unnamed_addr {
27	ret void
28}
29
30declare dllexport void @notDefined()
31
32; CHECK: .globl _stdfun@0
33define dllexport x86_stdcallcc void @stdfun() nounwind {
34	ret void
35}
36
37; CHECK: .globl @fastfun@0
38define dllexport x86_fastcallcc i32 @fastfun() nounwind {
39	ret i32 0
40}
41
42; CHECK: .globl _thisfun
43define dllexport x86_thiscallcc void @thisfun() nounwind {
44	ret void
45}
46
47; CHECK: .globl _lnk1
48define linkonce_odr dllexport void @lnk1() {
49	ret void
50}
51
52; CHECK: .globl _lnk2
53define linkonce_odr dllexport void @lnk2() alwaysinline {
54	ret void
55}
56
57; CHECK: .globl _weak1
58define weak_odr dllexport void @weak1() {
59	ret void
60}
61
62
63; CHECK: .data
64; CHECK: .globl _Var1
65@Var1 = dllexport global i32 1, align 4
66
67; CHECK: .rdata,"dr"
68; CHECK: .globl _Var2
69@Var2 = dllexport unnamed_addr constant i32 1
70
71; CHECK: .comm _Var3
72@Var3 = common dllexport global i32 0, align 4
73
74; CHECK: .globl _WeakVar1
75@WeakVar1 = weak_odr dllexport global i32 1, align 4
76
77; CHECK: .globl _WeakVar2
78@WeakVar2 = weak_odr dllexport unnamed_addr constant i32 1
79
80
81; CHECK: .globl _alias
82; CHECK: _alias = _notExported
83@alias = dllexport alias void(), void()* @notExported
84
85; CHECK: .globl _alias2
86; CHECK: _alias2 = _f1
87@alias2 = dllexport alias void(), void()* @f1
88
89; CHECK: .globl _alias3
90; CHECK: _alias3 = _notExported
91@alias3 = dllexport alias void(), void()* @notExported
92
93; CHECK: .weak _weak_alias
94; CHECK: _weak_alias = _f1
95@weak_alias = weak_odr dllexport alias void(), void()* @f1
96
97; Verify items that should not be exported do not appear in the export table.
98; We use a separate check prefix to avoid confusion between -NOT and -SAME.
99; NOTEXPORTED: .section .drectve
100; NOTEXPORTED-NOT: notExported
101; NOTEXPORTED-NOT: notDefined
102
103; CHECK: .section .drectve
104; CHECK-CL: /EXPORT:_f1
105; CHECK-CL-SAME: /EXPORT:_f2
106; CHECK-CL-SAME: /EXPORT:_stdfun@0
107; CHECK-CL-SAME: /EXPORT:@fastfun@0
108; CHECK-CL-SAME: /EXPORT:_thisfun
109; CHECK-CL-SAME: /EXPORT:_lnk1
110; CHECK-CL-SAME: /EXPORT:_lnk2
111; CHECK-CL-SAME: /EXPORT:_weak1
112; CHECK-CL-SAME: /EXPORT:_Var1,DATA
113; CHECK-CL-SAME: /EXPORT:_Var2,DATA
114; CHECK-CL-SAME: /EXPORT:_Var3,DATA
115; CHECK-CL-SAME: /EXPORT:_WeakVar1,DATA
116; CHECK-CL-SAME: /EXPORT:_WeakVar2,DATA
117; CHECK-CL-SAME: /EXPORT:_alias
118; CHECK-CL-SAME: /EXPORT:_alias2
119; CHECK-CL-SAME: /EXPORT:_alias3
120; CHECK-CL-SAME: /EXPORT:_weak_alias"
121; CHECK-GCC: -export:f1
122; CHECK-GCC-SAME: -export:f2
123; CHECK-GCC-SAME: -export:stdfun@0
124; CHECK-GCC-SAME: -export:@fastfun@0
125; CHECK-GCC-SAME: -export:thisfun
126; CHECK-GCC-SAME: -export:lnk1
127; CHECK-GCC-SAME: -export:lnk2
128; CHECK-GCC-SAME: -export:weak1
129; CHECK-GCC-SAME: -export:Var1,data
130; CHECK-GCC-SAME: -export:Var2,data
131; CHECK-GCC-SAME: -export:Var3,data
132; CHECK-GCC-SAME: -export:WeakVar1,data
133; CHECK-GCC-SAME: -export:WeakVar2,data
134; CHECK-GCC-SAME: -export:alias
135; CHECK-GCC-SAME: -export:alias2
136; CHECK-GCC-SAME: -export:alias3
137; CHECK-GCC-SAME: -export:weak_alias"
138