[PATCH] D39573: [LLD] [COFF] Autoexport symbols as data if they don't point to an executable section
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 3 13:58:58 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL317367: [COFF] Autoexport symbols as data if they don't point to an executable section (authored by mstorsjo).
Changed prior to commit:
https://reviews.llvm.org/D39573?vs=121392&id=121547#toc
Repository:
rL LLVM
https://reviews.llvm.org/D39573
Files:
lld/trunk/COFF/Driver.cpp
lld/trunk/test/COFF/export-all.s
Index: lld/trunk/test/COFF/export-all.s
===================================================================
--- lld/trunk/test/COFF/export-all.s
+++ lld/trunk/test/COFF/export-all.s
@@ -4,17 +4,28 @@
# RUN: lld-link -lldmingw -dll -out:%t.dll -entry:DllMainCRTStartup at 12 %t.obj -implib:%t.lib
# RUN: llvm-readobj -coff-exports %t.dll | FileCheck %s
+# RUN: llvm-readobj %t.lib | FileCheck -check-prefix=IMPLIB %s
# CHECK-NOT: Name: DllMainCRTStartup
+# CHECK: Name: dataSym
# CHECK: Name: foobar
+# IMPLIB: Symbol: __imp__dataSym
+# IMPLIB-NOT: Symbol: _dataSym
+# IMPLIB: Symbol: __imp__foobar
+# IMPLIB: Symbol: _foobar
+
.global _foobar
.global _DllMainCRTStartup at 12
+.global _dataSym
.text
_DllMainCRTStartup at 12:
ret
_foobar:
ret
+.data
+_dataSym:
+ .int 4
# Test specifying -export-all-symbols, on an object file that contains
# dllexport directive for some of the symbols.
Index: lld/trunk/COFF/Driver.cpp
===================================================================
--- lld/trunk/COFF/Driver.cpp
+++ lld/trunk/COFF/Driver.cpp
@@ -1244,6 +1244,9 @@
Export E;
E.Name = Def->getName();
E.Sym = Def;
+ if (Def->getChunk() &&
+ !(Def->getChunk()->getPermissions() & IMAGE_SCN_MEM_EXECUTE))
+ E.Data = true;
Config->Exports.push_back(E);
});
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39573.121547.patch
Type: text/x-patch
Size: 1335 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171103/244ac15f/attachment.bin>
More information about the llvm-commits
mailing list