[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
Thu Nov 2 15:12:03 PDT 2017
mstorsjo created this revision.
This was already taken care of for the output def file.
https://reviews.llvm.org/D39573
Files:
COFF/Driver.cpp
test/COFF/export-all.s
Index: test/COFF/export-all.s
===================================================================
--- test/COFF/export-all.s
+++ 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: COFF/Driver.cpp
===================================================================
--- COFF/Driver.cpp
+++ 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.121392.patch
Type: text/x-patch
Size: 1275 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171102/f436845f/attachment.bin>
More information about the llvm-commits
mailing list