diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-09-12 02:51:43 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-09-12 02:51:43 +0000 |
commit | c5d3857912daeb84f22ab9fb849f43c0a541f7fe (patch) | |
tree | c66bb797878130b27203d43ff436a0693e92d80a /lib/CodeGen/MicrosoftCXXABI.cpp | |
parent | 359c45534e46a8ef263db1a8b855740bbeca6998 (diff) |
[MS ABI] Add /include directives for dynamic TLS
MSVC emits /include directives in the .drective section for the
__dyn_tls_init function (decorated as ___dyn_tls_init@12 for 32-bit).
This fixes PR30347.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281189 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MicrosoftCXXABI.cpp')
-rw-r--r-- | lib/CodeGen/MicrosoftCXXABI.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/CodeGen/MicrosoftCXXABI.cpp b/lib/CodeGen/MicrosoftCXXABI.cpp index 58fe5d39eb..7220768a48 100644 --- a/lib/CodeGen/MicrosoftCXXABI.cpp +++ b/lib/CodeGen/MicrosoftCXXABI.cpp @@ -2211,6 +2211,14 @@ void MicrosoftCXXABI::EmitThreadLocalInitFuncs( CodeGenModule &CGM, ArrayRef<const VarDecl *> CXXThreadLocals, ArrayRef<llvm::Function *> CXXThreadLocalInits, ArrayRef<const VarDecl *> CXXThreadLocalInitVars) { + if (CXXThreadLocalInits.empty()) + return; + + CGM.AppendLinkerOptions(CGM.getTarget().getTriple().getArch() == + llvm::Triple::x86 + ? "/include:___dyn_tls_init@12" + : "/include:__dyn_tls_init"); + // This will create a GV in the .CRT$XDU section. It will point to our // initialization function. The CRT will call all of these function // pointers at start-up time and, eventually, at thread-creation time. |