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 | cb60a4305b469d8c99ff9fb6f0c393c43398d7d9 (patch) | |
| tree | 00eb2ff9c5679346fa811b91466a24db5ea23f63 /clang/lib | |
| parent | cd0fffb6e1f779884a9df21d898635ab9d72954c (diff) | |
| download | bcm5719-llvm-cb60a4305b469d8c99ff9fb6f0c393c43398d7d9.tar.gz bcm5719-llvm-cb60a4305b469d8c99ff9fb6f0c393c43398d7d9.zip  | |
[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.
llvm-svn: 281189
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/CodeGen/MicrosoftCXXABI.cpp | 8 | 
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/MicrosoftCXXABI.cpp b/clang/lib/CodeGen/MicrosoftCXXABI.cpp index 58fe5d39eb0..7220768a489 100644 --- a/clang/lib/CodeGen/MicrosoftCXXABI.cpp +++ b/clang/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.  | 

