diff options
author | Martin Storsjo <martin@martin.st> | 2018-09-04 20:56:28 +0000 |
---|---|---|
committer | Martin Storsjo <martin@martin.st> | 2018-09-04 20:56:28 +0000 |
commit | 68df812cceaccda7cc0d83aa38db3225b3b53652 (patch) | |
tree | 53f7cdcb7a7fbf853faa36beb7793848c3ec5515 /llvm/lib/Target/TargetMachine.cpp | |
parent | fed420d6b6769bc0b97755345f1072fcb530fb89 (diff) | |
download | bcm5719-llvm-68df812cceaccda7cc0d83aa38db3225b3b53652.tar.gz bcm5719-llvm-68df812cceaccda7cc0d83aa38db3225b3b53652.zip |
[MinGW] Move code for indicating "potentially not DSO local" into shouldAssumeDSOLocal. NFC.
On Windows, if shouldAssumeDSOLocal returns false, it's either a
dllimport reference, or a reference that we should treat as non-local
and create a stub for.
Clean up AArch64Subtarget::ClassifyGlobalReference a little while
touching the flag handling relating to dllimport.
Differential Revision: https://reviews.llvm.org/D51590
llvm-svn: 341402
Diffstat (limited to 'llvm/lib/Target/TargetMachine.cpp')
-rw-r--r-- | llvm/lib/Target/TargetMachine.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Target/TargetMachine.cpp b/llvm/lib/Target/TargetMachine.cpp index 092f5ea4104..b3de6c10662 100644 --- a/llvm/lib/Target/TargetMachine.cpp +++ b/llvm/lib/Target/TargetMachine.cpp @@ -141,6 +141,15 @@ bool TargetMachine::shouldAssumeDSOLocal(const Module &M, if (GV && GV->hasDLLImportStorageClass()) return false; + // On MinGW, variables that haven't been declared with DLLImport may still + // end up automatically imported by the linker. To make this feasible, + // don't assume the variables to be DSO local unless we actually know + // that for sure. This only has to be done for variables; for functions + // the linker can insert thunks for calling functions from another DLL. + if (TT.isWindowsGNUEnvironment() && GV && GV->isDeclarationForLinker() && + isa<GlobalVariable>(GV)) + return false; + // Every other GV is local on COFF. // Make an exception for windows OS in the triple: Some firmware builds use // *-win32-macho triples. This (accidentally?) produced windows relocations |