[PATCH] D79619: [LLD] [COFF] Fix def file exporting of symbols containing periods
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun May 10 13:50:41 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGed0a57f753a3: [LLD] [COFF] Fix def file exporting of symbols containing periods (authored by mstorsjo).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79619/new/
https://reviews.llvm.org/D79619
Files:
lld/COFF/Driver.cpp
lld/test/COFF/export-tricky-names.s
Index: lld/test/COFF/export-tricky-names.s
===================================================================
--- /dev/null
+++ lld/test/COFF/export-tricky-names.s
@@ -0,0 +1,29 @@
+# REQUIRES: x86
+
+# RUN: echo -e "EXPORTS\n foo.bar" > %t.def
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-windows-msvc -defsym drectve=0 %s -o %t.obj
+# RUN: lld-link -entry:dllmain -dll -def:%t.def %t.obj -out:%t.1.dll
+# RUN: llvm-readobj --coff-exports %t.1.dll | FileCheck %s
+
+# RUN: lld-link -entry:dllmain -dll %t.obj -out:%t.2.dll -export:foo.bar
+# RUN: llvm-readobj --coff-exports %t.2.dll | FileCheck %s
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-windows-msvc -defsym drectve=1 %s -o %t.drectve.obj
+# RUN: lld-link -entry:dllmain -dll %t.drectve.obj -out:%t.3.dll
+# RUN: llvm-readobj --coff-exports %t.3.dll | FileCheck %s
+
+# CHECK: Name: foo.bar
+
+ .text
+ .globl dllmain
+ .globl foo.bar
+dllmain:
+ ret
+foo.bar:
+ ret
+
+.if drectve==1
+ .section .drectve
+ .ascii "-export:foo.bar"
+.endif
Index: lld/COFF/Driver.cpp
===================================================================
--- lld/COFF/Driver.cpp
+++ lld/COFF/Driver.cpp
@@ -848,7 +848,8 @@
// and set as "ExtName = Name". If Name has the form "OtherDll.Func",
// it shouldn't be a normal exported function but a forward to another
// DLL instead. This is supported by both MS and GNU linkers.
- if (e1.ExtName != e1.Name && StringRef(e1.Name).contains('.')) {
+ if (!e1.ExtName.empty() && e1.ExtName != e1.Name &&
+ StringRef(e1.Name).contains('.')) {
e2.name = saver.save(e1.ExtName);
e2.forwardTo = saver.save(e1.Name);
config->exports.push_back(e2);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79619.263082.patch
Type: text/x-patch
Size: 1730 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200510/fc74be8e/attachment.bin>
More information about the llvm-commits
mailing list