forked from OSchip/llvm-project
[COFF] Autoexport symbols as data if they don't point to an executable section
This was already taken care of for the output def file. Differential Revision: https://reviews.llvm.org/D39573 llvm-svn: 317367
This commit is contained in:
parent
34eb96b03f
commit
dc95dbfcab
|
@ -1244,6 +1244,9 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) {
|
|||
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);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -4,17 +4,28 @@
|
|||
|
||||
# RUN: lld-link -lldmingw -dll -out:%t.dll -entry:DllMainCRTStartup@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@12
|
||||
.global _dataSym
|
||||
.text
|
||||
_DllMainCRTStartup@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.
|
||||
|
|
Loading…
Reference in New Issue