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/dllexport.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/dllexport.cpp')
-rw-r--r-- | clang/test/SemaCXX/dllexport.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/dllexport.cpp b/clang/test/SemaCXX/dllexport.cpp index df87c737865..5d688944095 100644 --- a/clang/test/SemaCXX/dllexport.cpp +++ b/clang/test/SemaCXX/dllexport.cpp @@ -64,6 +64,9 @@ namespace ns { __declspec(dllexport) int ExternalGlobal; } __declspec(dllexport) auto InternalAutoTypeGlobal = Internal(); // expected-error{{'InternalAutoTypeGlobal' must have external linkage when declared 'dllexport'}} __declspec(dllexport) auto ExternalAutoTypeGlobal = External(); +// Thread local variables are invalid. +__declspec(dllexport) __thread int ThreadLocalGlobal; // expected-error{{'ThreadLocalGlobal' cannot be thread local when declared 'dllexport'}} + // Export in local scope. void functionScope() { __declspec(dllexport) int LocalVarDecl; // expected-error{{'LocalVarDecl' must have external linkage when declared 'dllexport'}} |