export32.test
5.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# RUN: yaml2obj %s -o %t.obj
#
# RUN: lld-link -safeseh:no /out:%t.dll /dll %t.obj /export:exportfn1 /export:exportfn2
# RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK1 %s
#
# RUN: lld-link -safeseh:no /out:%t.dll /dll %t.obj /export:exportfn1 /export:exportfn2 /merge:.edata=.rdata
# RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK1 %s
# RUN: llvm-readobj --file-headers --sections %t.dll | FileCheck -check-prefix=HEADER-MERGE %s
# CHECK1: Export Table:
# CHECK1: DLL name: export32.test.tmp.dll
# CHECK1: Ordinal RVA Name
# CHECK1-NEXT: 0 0
# CHECK1-NEXT: 1 0x1008 exportfn1
# CHECK1-NEXT: 2 0x1010 exportfn2
# HEADER-MERGE: ExportTableRVA: 0x2000
# HEADER-MERGE-NEXT: ExportTableSize: 0x7E
# HEADER-MERGE: Name: .rdata
# HEADER-MERGE-NEXT: VirtualSize: 0x7E
# HEADER-MERGE-NEXT: VirtualAddress: 0x2000
# RUN: lld-link -safeseh:no /out:%t.dll /dll %t.obj /export:exportfn1,@5 \
# RUN: /export:exportfn2 /export:mangled
# RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK2 %s
# CHECK2: Export Table:
# CHECK2: DLL name: export32.test.tmp.dll
# CHECK2: Ordinal RVA Name
# CHECK2-NEXT: 0 0
# CHECK2-NEXT: 1 0
# CHECK2-NEXT: 2 0
# CHECK2-NEXT: 3 0
# CHECK2-NEXT: 4 0
# CHECK2-NEXT: 5 0x1008 exportfn1
# CHECK2-NEXT: 6 0x1010 exportfn2
# CHECK2-NEXT: 7 0x1010 exportfn3
# CHECK2-NEXT: 8 0x1010 mangled
# RUN: lld-link -safeseh:no /out:%t.dll /dll %t.obj /export:exportfn1,@5,noname /export:exportfn2
# RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK3 %s
# CHECK3: Export Table:
# CHECK3: DLL name: export32.test.tmp.dll
# CHECK3: Ordinal RVA Name
# CHECK3-NEXT: 0 0
# CHECK3-NEXT: 1 0
# CHECK3-NEXT: 2 0
# CHECK3-NEXT: 3 0
# CHECK3-NEXT: 4 0
# CHECK3-NEXT: 5 0x1008
# CHECK3-NEXT: 6 0x1010 exportfn2
# RUN: lld-link -safeseh:no /out:%t.dll /dll %t.obj /export:f1=exportfn1 /export:f2=exportfn2
# RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK4 %s
# CHECK4: Export Table:
# CHECK4: DLL name: export32.test.tmp.dll
# CHECK4: Ordinal RVA Name
# CHECK4-NEXT: 0 0
# CHECK4-NEXT: 1 0x1010 exportfn3
# CHECK4-NEXT: 2 0x1008 f1
# CHECK4-NEXT: 3 0x1010 f2
# RUN: echo "EXPORTS exportfn1 @3" > %t.def
# RUN: echo "fn2=exportfn2 @2" >> %t.def
# RUN: lld-link -safeseh:no /out:%t.dll /dll %t.obj /def:%t.def
# RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK5 %s
# RUN: echo "EXPORTS exportfn1 @ 3" > %t.def
# RUN: echo "fn2=exportfn2 @ 2" >> %t.def
# RUN: lld-link -safeseh:no /out:%t.dll /dll %t.obj /def:%t.def
# RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK5 %s
# CHECK5: Export Table:
# CHECK5: DLL name: export32.test.tmp.dll
# CHECK5: Ordinal RVA Name
# CHECK5-NEXT: 0 0
# CHECK5-NEXT: 1 0
# CHECK5-NEXT: 2 0x1010 fn2
# CHECK5-NEXT: 3 0x1008 exportfn1
# CHECK5-NEXT: 4 0x1010 exportfn3
# RUN: lld-link -safeseh:no /out:%t.dll /dll %t.obj /export:exportfn1 /export:exportfn2 \
# RUN: /export:exportfn1 /export:exportfn2,@5 >& %t.log
# RUN: FileCheck -check-prefix=CHECK6 %s < %t.log
# CHECK6: duplicate /export option: _exportfn2
# CHECK6-NOT: duplicate /export option: _exportfn1
# RUN: lld-link -safeseh:no /out:%t.dll /dll %t.obj /export:foo=mangled
# RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK7 %s
# CHECK7: Export Table:
# CHECK7: DLL name: export32.test.tmp.dll
# CHECK7: Ordinal RVA Name
# CHECK7-NEXT: 0 0
# CHECK7-NEXT: 1 0
# CHECK7-NEXT: 2 0x1010 foo
--- !COFF
header:
Machine: IMAGE_FILE_MACHINE_I386
Characteristics: []
sections:
- Name: .text
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
Alignment: 4
SectionData: B800000000506800000000680000000050E80000000050E800000000
- Name: .drectve
Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ]
Alignment: 1
SectionData: 2f6578706f72743a5f6578706f7274666e3300 # /export:_exportfn3
symbols:
- Name: .text
Value: 0
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
SectionDefinition:
Length: 28
NumberOfRelocations: 4
NumberOfLinenumbers: 0
CheckSum: 0
Number: 0
- Name: __DllMainCRTStartup@12
Value: 0
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
- Name: _exportfn1
Value: 8
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
- Name: _exportfn2@4
Value: 16
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
- Name: _exportfn3
Value: 16
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
- Name: '?mangled@@YAHXZ'
Value: 16
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
...