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