1# REQUIRES: x86
2# RUN: yaml2obj < %p/Inputs/export.yaml > %t.obj
3# RUN: lld-link /out:%t.dll /dll %t.obj /export:exportfn1 /export:exportfn2 \
4# RUN:   /export:mangled
5# RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=EXPORT %s
6
7EXPORT:      Export Table:
8EXPORT:      DLL name: dll.test.tmp.dll
9EXPORT:      Ordinal      RVA  Name
10EXPORT-NEXT:       0        0
11EXPORT-NEXT:       1   0x1008  exportfn1
12EXPORT-NEXT:       2   0x1010  exportfn2
13EXPORT-NEXT:       3   0x1010  exportfn3
14EXPORT-NEXT:       4   0x1010  mangled
15
16# RUN: yaml2obj < %p/Inputs/export2.yaml > %t5.obj
17# RUN: rm -f %t5.lib
18# RUN: llvm-ar cru %t5.lib %t5.obj
19# RUN: lld-link /out:%t5.dll /dll %t.obj %t5.lib /export:mangled2
20# RUN: llvm-objdump -p %t5.dll | FileCheck --check-prefix=EXPORT2 %s
21
22EXPORT2:      Export Table:
23EXPORT2:      DLL name: dll.test.tmp5.dll
24EXPORT2:      Ordinal      RVA  Name
25EXPORT2-NEXT:       0        0
26EXPORT2-NEXT:       1   0x1010  exportfn3
27EXPORT2-NEXT:       2   0x101c  mangled2
28
29# RUN: llvm-as -o %t.lto.obj %p/Inputs/export.ll
30# RUN: lld-link -opt:noicf /out:%t.lto.dll /dll %t.lto.obj /export:exportfn1 /export:exportfn2
31# RUN: llvm-objdump -p %t.lto.dll | FileCheck --check-prefix=EXPORT-LTO %s
32
33EXPORT-LTO:      Export Table:
34EXPORT-LTO:      DLL name: dll.test.tmp.lto.dll
35EXPORT-LTO:      Ordinal      RVA  Name
36EXPORT-LTO-NEXT:       0        0
37EXPORT-LTO-NEXT:       1   0x1010  exportfn1
38EXPORT-LTO-NEXT:       2   0x1020  exportfn2
39EXPORT-LTO-NEXT:       3   0x1030  exportfn3
40
41# RUN: lld-link /out:%t.dll /dll %t.obj /implib:%t2.lib \
42# RUN:   /export:exportfn1 /export:exportfn2
43# RUN: yaml2obj < %p/Inputs/import.yaml > %t2.obj
44# RUN: lld-link /out:%t2.exe /entry:main %t2.obj %t2.lib
45# RUN: llvm-readobj --coff-imports %t2.exe | FileCheck -check-prefix=IMPORT %s
46
47# RUN: lld-link /out:%t2.lto.exe /entry:main %t2.obj %t.lto.lib
48# RUN: llvm-readobj --coff-imports %t2.lto.exe | FileCheck -check-prefix=IMPORT %s
49
50IMPORT: Symbol: exportfn1
51IMPORT: Symbol: exportfn2
52