1 # RUN: yaml2obj %s -o %t.obj
3 # RUN: lld-link -safeseh:no /out:%t.dll /dll %t.obj /export:exportfn1 /export:exportfn2
4 # RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK1 %s
6 # RUN: lld-link -safeseh:no /out:%t.dll /dll %t.obj /export:exportfn1 /export:exportfn2 /merge:.edata=.rdata
7 # RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK1 %s
8 # RUN: llvm-readobj --file-headers --sections %t.dll | FileCheck -check-prefix=HEADER-MERGE %s
10 # CHECK1: Export Table:
11 # CHECK1: DLL name: export32.test.tmp.dll
12 # CHECK1: Ordinal RVA Name
14 # CHECK1-NEXT: 1 0x1008 exportfn1
15 # CHECK1-NEXT: 2 0x1010 exportfn2
17 # HEADER-MERGE: ExportTableRVA: 0x2000
18 # HEADER-MERGE-NEXT: ExportTableSize: 0x7E
19 # HEADER-MERGE: Name: .rdata
20 # HEADER-MERGE-NEXT: VirtualSize: 0x7E
21 # HEADER-MERGE-NEXT: VirtualAddress: 0x2000
23 # RUN: lld-link -safeseh:no /out:%t.dll /dll %t.obj /export:exportfn1,@5 \
24 # RUN: /export:exportfn2 /export:mangled
25 # RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK2 %s
27 # CHECK2: Export Table:
28 # CHECK2: DLL name: export32.test.tmp.dll
29 # CHECK2: Ordinal RVA Name
35 # CHECK2-NEXT: 5 0x1008 exportfn1
36 # CHECK2-NEXT: 6 0x1010 exportfn2
37 # CHECK2-NEXT: 7 0x1010 exportfn3
38 # CHECK2-NEXT: 8 0x1010 mangled
40 # RUN: lld-link -safeseh:no /out:%t.dll /dll %t.obj /export:exportfn1,@5,noname /export:exportfn2
41 # RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK3 %s
43 # CHECK3: Export Table:
44 # CHECK3: DLL name: export32.test.tmp.dll
45 # CHECK3: Ordinal RVA Name
51 # CHECK3-NEXT: 5 0x1008
52 # CHECK3-NEXT: 6 0x1010 exportfn2
54 # RUN: lld-link -safeseh:no /out:%t.dll /dll %t.obj /export:f1=exportfn1 /export:f2=exportfn2
55 # RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK4 %s
57 # CHECK4: Export Table:
58 # CHECK4: DLL name: export32.test.tmp.dll
59 # CHECK4: Ordinal RVA Name
61 # CHECK4-NEXT: 1 0x1010 exportfn3
62 # CHECK4-NEXT: 2 0x1008 f1
63 # CHECK4-NEXT: 3 0x1010 f2
65 # RUN: echo "EXPORTS exportfn1 @3" > %t.def
66 # RUN: echo "fn2=exportfn2 @2" >> %t.def
67 # RUN: lld-link -safeseh:no /out:%t.dll /dll %t.obj /def:%t.def
68 # RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK5 %s
70 # RUN: echo "EXPORTS exportfn1 @ 3" > %t.def
71 # RUN: echo "fn2=exportfn2 @ 2" >> %t.def
72 # RUN: lld-link -safeseh:no /out:%t.dll /dll %t.obj /def:%t.def
73 # RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK5 %s
75 # CHECK5: Export Table:
76 # CHECK5: DLL name: export32.test.tmp.dll
77 # CHECK5: Ordinal RVA Name
80 # CHECK5-NEXT: 2 0x1010 fn2
81 # CHECK5-NEXT: 3 0x1008 exportfn1
82 # CHECK5-NEXT: 4 0x1010 exportfn3
84 # RUN: lld-link -safeseh:no /out:%t.dll /dll %t.obj /export:exportfn1 /export:exportfn2 \
85 # RUN: /export:exportfn1 /export:exportfn2,@5 >& %t.log
86 # RUN: FileCheck -check-prefix=CHECK6 %s < %t.log
88 # CHECK6: duplicate /export option: _exportfn2
89 # CHECK6-NOT: duplicate /export option: _exportfn1
91 # RUN: lld-link -safeseh:no /out:%t.dll /dll %t.obj /export:foo=mangled
92 # RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK7 %s
94 # CHECK7: Export Table:
95 # CHECK7: DLL name: export32.test.tmp.dll
96 # CHECK7: Ordinal RVA Name
99 # CHECK7-NEXT: 2 0x1010 foo
103 Machine: IMAGE_FILE_MACHINE_I386
107 Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
109 SectionData: B800000000506800000000680000000050E80000000050E800000000
111 Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ]
113 SectionData: 2f6578706f72743a5f6578706f7274666e3300 # /export:_exportfn3
118 SimpleType: IMAGE_SYM_TYPE_NULL
119 ComplexType: IMAGE_SYM_DTYPE_NULL
120 StorageClass: IMAGE_SYM_CLASS_STATIC
123 NumberOfRelocations: 4
124 NumberOfLinenumbers: 0
127 - Name: __DllMainCRTStartup@12
130 SimpleType: IMAGE_SYM_TYPE_NULL
131 ComplexType: IMAGE_SYM_DTYPE_NULL
132 StorageClass: IMAGE_SYM_CLASS_EXTERNAL
136 SimpleType: IMAGE_SYM_TYPE_NULL
137 ComplexType: IMAGE_SYM_DTYPE_NULL
138 StorageClass: IMAGE_SYM_CLASS_EXTERNAL
142 SimpleType: IMAGE_SYM_TYPE_NULL
143 ComplexType: IMAGE_SYM_DTYPE_NULL
144 StorageClass: IMAGE_SYM_CLASS_EXTERNAL
148 SimpleType: IMAGE_SYM_TYPE_NULL
149 ComplexType: IMAGE_SYM_DTYPE_NULL
150 StorageClass: IMAGE_SYM_CLASS_EXTERNAL
151 - Name: '?mangled@@YAHXZ'
154 SimpleType: IMAGE_SYM_TYPE_NULL
155 ComplexType: IMAGE_SYM_DTYPE_NULL
156 StorageClass: IMAGE_SYM_CLASS_EXTERNAL