File: export.test

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (97 lines) | stat: -rw-r--r-- 3,657 bytes parent folder | download | duplicates (2)
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
# RUN: yaml2obj %p/Inputs/export.yaml -o %t.obj
#
# RUN: lld-link /out:%t.dll /dll %t.obj /export:exportfn1 /export:exportfn2
# RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK1 %s

CHECK1:      Export Table:
CHECK1-NEXT: DLL name: export.test.tmp.dll
CHECK1-NEXT: Ordinal base: 1
CHECK1-NEXT: Ordinal      RVA  Name
CHECK1-NEXT:       1   0x1008  exportfn1
CHECK1-NEXT:       2   0x1010  exportfn2

# RUN: lld-link /out:%t.dll /dll %t.obj /export:exportfn1,@5 /export:exportfn2
# RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK2 %s

CHECK2:      Export Table:
CHECK2-NEXT: DLL name: export.test.tmp.dll
CHECK2-NEXT: Ordinal base: 5
CHECK2-NEXT: Ordinal      RVA  Name
CHECK2-NEXT:       5   0x1008  exportfn1
CHECK2-NEXT:       6   0x1010  exportfn2
CHECK2-NEXT:       7   0x1010  exportfn3

# RUN: lld-link /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-NEXT: DLL name: export.test.tmp.dll
CHECK3-NEXT: Ordinal base: 5
CHECK3-NEXT: Ordinal      RVA  Name
CHECK3-NEXT:       5   0x1008
CHECK3-NEXT:       6   0x1010  exportfn2

# RUN: lld-link /out:%t.dll /dll %t.obj /export:f1=exportfn1 /export:f2=exportfn2 /implib:%t.lib
# RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK4 %s
# RUN: llvm-nm %t.lib | FileCheck -check-prefix=CHECK4-NM %s

CHECK4:      Export Table:
CHECK4-NEXT: DLL name: export.test.tmp.dll
CHECK4-NEXT: Ordinal base: 1
CHECK4-NEXT: Ordinal      RVA  Name
CHECK4-NEXT:       1   0x1010  exportfn3
CHECK4-NEXT:       2   0x1008  f1
CHECK4-NEXT:       3   0x1010  f2
CHECK4-NM: 00000000 T f1
CHECK4-NM: 00000000 T f2

# RUN: echo "EXPORTS exportfn1 @3" > %t.def
# RUN: echo "fn2=exportfn2 @2" >> %t.def
# RUN: lld-link /out:%t.dll /dll %t.obj /def:%t.def
# RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK5 %s

CHECK5:      Export Table:
CHECK5-NEXT: DLL name: export.test.tmp.dll
CHECK5-NEXT: Ordinal base: 2
CHECK5-NEXT: Ordinal      RVA  Name
CHECK5-NEXT:       2   0x1010  fn2
CHECK5-NEXT:       3   0x1008  exportfn1
CHECK5-NEXT:       4   0x1010  exportfn3

# RUN: lld-link /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: llvm-nm -M %t.lib | FileCheck --check-prefix=SYMTAB %s

SYMTAB: __imp_exportfn1 in export.test.tmp.DLL
SYMTAB: exportfn1 in export.test.tmp.DLL
SYMTAB: __imp_exportfn2 in export.test.tmp.DLL
SYMTAB: exportfn2 in export.test.tmp.DLL
SYMTAB: __imp_exportfn3 in export.test.tmp.DLL
SYMTAB: exportfn3 in export.test.tmp.DLL

# RUN: lld-link /out:%t.dll /dll %t.obj /export:foo=kernel32.foobar
# RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=FORWARDER %s

# RUN: echo "EXPORTS foo=kernel32.foobar" > %t.def
# RUN: lld-link /out:%t.dll /dll %t.obj /def:%t.def
# RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=FORWARDER %s

FORWARDER: Export Table:
FORWARDER:  DLL name: export.test.tmp.dll
FORWARDER:  Ordinal base: 1
FORWARDER:  Ordinal      RVA  Name
FORWARDER:        1   0x1010  exportfn
FORWARDER:        2           foo (forwarded to kernel32.foobar)

# RUN: lld-link /out:%t.dll /dll %t.obj /merge:.rdata=.text /export:exportfn1 /export:exportfn2
# RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=MERGE --match-full-lines %s

MERGE:      DLL name: export.test.tmp.dll
MERGE:      Ordinal      RVA  Name
MERGE-NEXT:       1   0x1008  exportfn1
MERGE-NEXT:       2   0x1010  exportfn2