diff options
author | David Majnemer <david.majnemer@gmail.com> | 2014-10-04 06:51:54 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2014-10-04 06:51:54 +0000 |
commit | 5da21da4f6d7c69bbd7b2e7cf3fbdfb337978f9c (patch) | |
tree | 02ce42e06ef08dfe72b32352c35c36888b3ffc85 /clang/test/SemaCXX/dllimport.cpp | |
parent | 7656f418091b1ae51145cf12edabb29fed67ab6d (diff) | |
download | bcm5719-llvm-5da21da4f6d7c69bbd7b2e7cf3fbdfb337978f9c.tar.gz bcm5719-llvm-5da21da4f6d7c69bbd7b2e7cf3fbdfb337978f9c.zip |
MS ABI: Disallow dllimported/exported variables from having TLS
Windows TLS relies on indexing through a tls_index in order to get at
the DLL's thread local variables. However, this index is not exported
along with the variable: it is assumed that all accesses to thread local
variables are inside the same module which created the variable in the
first place.
While there are several implementation techniques we could adopt to fix
this (notably, the Itanium ABI gets this for free), it is not worth the
heroics.
Instead, let's just ban this combination. We could revisit this in the
future if we need to.
This fixes PR21111.
llvm-svn: 219049
Diffstat (limited to 'clang/test/SemaCXX/dllimport.cpp')
-rw-r--r-- | clang/test/SemaCXX/dllimport.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/dllimport.cpp b/clang/test/SemaCXX/dllimport.cpp index d0e88368fc3..1ba25dbbc5c 100644 --- a/clang/test/SemaCXX/dllimport.cpp +++ b/clang/test/SemaCXX/dllimport.cpp @@ -86,6 +86,9 @@ namespace ns { __declspec(dllimport) int ExternalGlobal; } __declspec(dllimport) auto InternalAutoTypeGlobal = Internal(); // expected-error{{'InternalAutoTypeGlobal' must have external linkage when declared 'dllimport'}} // expected-error@-1{{definition of dllimport data}} +// Thread local variables are invalid. +__declspec(dllimport) __thread int ThreadLocalGlobal; // expected-error{{'ThreadLocalGlobal' cannot be thread local when declared 'dllimport'}} + // Import in local scope. __declspec(dllimport) float LocalRedecl1; // expected-note{{previous definition is here}} __declspec(dllimport) float LocalRedecl2; // expected-note{{previous definition is here}} |