File tree Expand file tree Collapse file tree 2 files changed +17
-8
lines changed Expand file tree Collapse file tree 2 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -1032,19 +1032,18 @@ void LinkerDriver::parseModuleDefs(StringRef path) {
1032
1032
1033
1033
for (COFFShortExport e1 : m.Exports ) {
1034
1034
Export e2 ;
1035
- // In simple cases, only Name is set. Renamed exports are parsed
1036
- // and set as "ExtName = Name". If Name has the form "OtherDll.Func",
1037
- // it shouldn't be a normal exported function but a forward to another
1038
- // DLL instead. This is supported by both MS and GNU linkers.
1035
+ // Renamed exports are parsed and set as "ExtName = Name". If Name has
1036
+ // the form "OtherDll.Func", it shouldn't be a normal exported
1037
+ // function but a forward to another DLL instead. This is supported
1038
+ // by both MS and GNU linkers.
1039
1039
if (!e1 .ExtName .empty () && e1 .ExtName != e1 .Name &&
1040
1040
StringRef (e1 .Name ).contains (' .' )) {
1041
1041
e2 .name = saver ().save (e1 .ExtName );
1042
1042
e2 .forwardTo = saver ().save (e1 .Name );
1043
- ctx.config .exports .push_back (e2 );
1044
- continue ;
1043
+ } else {
1044
+ e2 .name = saver ().save (e1 .Name );
1045
+ e2 .extName = saver ().save (e1 .ExtName );
1045
1046
}
1046
- e2 .name = saver ().save (e1 .Name );
1047
- e2 .extName = saver ().save (e1 .ExtName );
1048
1047
e2 .aliasTarget = saver ().save (e1 .AliasTarget );
1049
1048
e2 .ordinal = e1 .Ordinal ;
1050
1049
e2 .noname = e1 .Noname ;
Original file line number Diff line number Diff line change @@ -104,6 +104,11 @@ SYMTAB-FWD-PRIV-NOT: __imp_foo
104
104
SYMTAB-FWD-PRIV-NEXT: exportfn3 in export.test.tmp-fwd-priv
105
105
SYMTAB-FWD-PRIV-NOT: foo
106
106
107
+ # RUN: echo "EXPORTS foo=kernel32.foobar DATA PRIVATE" > %t-fwd-priv.def
108
+ # RUN: lld-link /out:%t-fwd-priv-def.dll /dll %t.obj /def:%t-fwd-priv.def
109
+ # RUN: llvm-objdump -p %t-fwd-priv-def.dll | FileCheck --check-prefix=FORWARDER %s
110
+ # RUN: llvm-nm -M %t-fwd-priv-def.lib | FileCheck --check-prefix=SYMTAB-FWD-PRIV %s
111
+
107
112
# RUN: lld-link /out:%t-fwd-ord.dll /dll %t.obj /export:foo=kernel32.foobar,@3,NONAME
108
113
# RUN: llvm-objdump -p %t-fwd-ord.dll | FileCheck --check-prefix=FORWARDER-ORD %s
109
114
# RUN: llvm-nm -M %t-fwd-ord.lib | FileCheck --check-prefix=SYMTAB-FWD %s
@@ -115,6 +120,11 @@ FORWARDER-ORD-NEXT: Ordinal RVA Name
115
120
FORWARDER-ORD-NEXT: 3 (forwarded to kernel32.foobar)
116
121
FORWARDER-ORD-NEXT: 4 0x1010 exportfn3
117
122
123
+ # RUN: echo "EXPORTS foo=kernel32.foobar @3 NONAME" > %t-fwd-ord.def
124
+ # RUN: lld-link /out:%t-fwd-ord-def.dll /dll %t.obj /def:%t-fwd-ord.def
125
+ # RUN: llvm-objdump -p %t-fwd-ord-def.dll | FileCheck --check-prefix=FORWARDER-ORD %s
126
+ # RUN: llvm-nm -M %t-fwd-ord-def.lib | FileCheck --check-prefix=SYMTAB-FWD %s
127
+
118
128
# RUN: lld-link /out:%t.dll /dll %t.obj /merge:.rdata=.text /export:exportfn1 /export:exportfn2
119
129
# RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=MERGE --match-full-lines %s
120
130
You can’t perform that action at this time.
0 commit comments