[PATCH] D46244: [LLD] [COFF] Allow specifying export forwarding in a def file

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 30 00:40:07 PDT 2018


mstorsjo created this revision.
mstorsjo added reviewers: ruiu, rnk.

Previously this was only supported when specified on the command line or in directives.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D46244

Files:
  COFF/Driver.cpp
  test/COFF/export.test


Index: test/COFF/export.test
===================================================================
--- test/COFF/export.test
+++ test/COFF/export.test
@@ -86,6 +86,10 @@
 # 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: 0
Index: COFF/Driver.cpp
===================================================================
--- COFF/Driver.cpp
+++ COFF/Driver.cpp
@@ -628,6 +628,12 @@
 
   for (COFFShortExport E1 : M.Exports) {
     Export E2;
+    if (E1.ExtName != E1.Name && StringRef(E1.Name).contains('.')) {
+      E2.Name = E1.ExtName;
+      E2.ForwardTo = E1.Name;
+      Config->Exports.push_back(E2);
+      continue;
+    }
     E2.Name = Saver.save(E1.Name);
     if (E1.isWeak())
       E2.ExtName = Saver.save(E1.ExtName);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46244.144506.patch
Type: text/x-patch
Size: 1090 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180430/c55833d9/attachment.bin>


More information about the llvm-commits mailing list