@@ -9,6 +9,72 @@ RUN: lld-link -out:out1.dll -dll -noentry test.obj test.lib
9
9
RUN: llvm-readobj --coff-imports out1.dll | FileCheck --check-prefix=IMPORT %s
10
10
IMPORT: Symbol: expfunc
11
11
12
+ Pass -export argument with EXPORTAS.
13
+
14
+ RUN: llvm-mc -filetype=obj -triple=x86_64-windows func.s -o func.obj
15
+ RUN: lld-link -out:out2.dll -dll -noentry func.obj -export:func,EXPORTAS,expfunc
16
+ RUN: llvm-readobj --coff-exports out2.dll | FileCheck --check-prefix=EXPORT %s
17
+ EXPORT: Name: expfunc
18
+
19
+ RUN: llvm-readobj out2.lib | FileCheck --check-prefix=IMPLIB %s
20
+ IMPLIB: Name type: export as
21
+ IMPLIB-NEXT: Export name: expfunc
22
+ IMPLIB-NEXT: Symbol: __imp_func
23
+ IMPLIB-NEXT: Symbol: func
24
+
25
+ Use .drectve section with EXPORTAS.
26
+
27
+ RUN: llvm-mc -filetype=obj -triple=x86_64-windows drectve.s -o drectve.obj
28
+ RUN: lld-link -out:out3.dll -dll -noentry func.obj drectve.obj
29
+ RUN: llvm-readobj --coff-exports out3.dll | FileCheck --check-prefix=EXPORT %s
30
+ RUN: llvm-readobj out3.lib | FileCheck --check-prefix=IMPLIB %s
31
+
32
+ Use a .def file with EXPORTAS.
33
+
34
+ RUN: lld-link -out:out4.dll -dll -noentry func.obj -def:test.def
35
+ RUN: llvm-readobj --coff-exports out4.dll | FileCheck --check-prefix=EXPORT %s
36
+ RUN: llvm-readobj out4.lib | FileCheck --check-prefix=IMPLIB %s
37
+
38
+ Use a .def file with EXPORTAS in a forwarding export.
39
+
40
+ RUN: lld-link -out:out5.dll -dll -noentry func.obj -def:test2.def
41
+ RUN: llvm-readobj --coff-exports out5.dll | FileCheck --check-prefix=FORWARD-EXPORT %s
42
+ FORWARD-EXPORT: Export {
43
+ FORWARD-EXPORT-NEXT: Ordinal: 1
44
+ FORWARD-EXPORT-NEXT: Name: expfunc
45
+ FORWARD-EXPORT-NEXT: ForwardedTo: otherdll.otherfunc
46
+ FORWARD-EXPORT-NEXT: }
47
+
48
+ RUN: llvm-readobj out5.lib | FileCheck --check-prefix=FORWARD-IMPLIB %s
49
+ FORWARD-IMPLIB: Name type: export as
50
+ FORWARD-IMPLIB-NEXT: Export name: expfunc
51
+ FORWARD-IMPLIB-NEXT: Symbol: __imp_func
52
+ FORWARD-IMPLIB-NEXT: Symbol: func
53
+
54
+ Pass -export argument with EXPORTAS in a forwarding export.
55
+
56
+ RUN: lld-link -out:out6.dll -dll -noentry func.obj -export:func=otherdll.otherfunc,EXPORTAS,expfunc
57
+ RUN: llvm-readobj --coff-exports out6.dll | FileCheck --check-prefix=FORWARD-EXPORT %s
58
+ RUN: llvm-readobj out6.lib | FileCheck --check-prefix=FORWARD-IMPLIB %s
59
+
60
+ Pass -export argument with EXPORTAS in a data export.
61
+
62
+ RUN: lld-link -out:out7.dll -dll -noentry func.obj -export:func,DATA,@5,EXPORTAS,expfunc
63
+ RUN: llvm-readobj --coff-exports out7.dll | FileCheck --check-prefix=ORD %s
64
+ ORD: Ordinal: 5
65
+ ORD-NEXT: Name: expfunc
66
+
67
+ RUN: llvm-readobj out7.lib | FileCheck --check-prefix=ORD-IMPLIB %s
68
+ ORD-IMPLIB: Type: data
69
+ ORD-IMPLIB-NEXT: Name type: export as
70
+ ORD-IMPLIB-NEXT: Export name: expfunc
71
+ ORD-IMPLIB-NEXT: Symbol: __imp_func
72
+
73
+ Check invalid EXPORTAS syntax.
74
+
75
+ RUN: not lld-link -out:err1.dll -dll -noentry func.obj -export:func,EXPORTAS,
76
+ RUN: not lld-link -out:err2.dll -dll -noentry func.obj -export:func,EXPORTAS,expfunc,DATA
77
+
12
78
#--- test.s
13
79
.section ".test", "rd"
14
80
.rva __imp_func
@@ -17,3 +83,20 @@ IMPORT: Symbol: expfunc
17
83
LIBRARY test.dll
18
84
EXPORTS
19
85
func EXPORTAS expfunc
86
+
87
+ #--- test2.def
88
+ LIBRARY test.dll
89
+ EXPORTS
90
+ func=otherdll.otherfunc EXPORTAS expfunc
91
+
92
+ #--- func.s
93
+ .text
94
+ .globl func
95
+ .p2align 2, 0x0
96
+ func:
97
+ movl $1, %eax
98
+ retq
99
+
100
+ #--- drectve.s
101
+ .section .drectve, "yn"
102
+ .ascii " -export:func,EXPORTAS,expfunc"
0 commit comments