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/Sema/dllimport.c | |
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/Sema/dllimport.c')
-rw-r--r-- | clang/test/Sema/dllimport.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/test/Sema/dllimport.c b/clang/test/Sema/dllimport.c index d64c85953d0..1b111077b62 100644 --- a/clang/test/Sema/dllimport.c +++ b/clang/test/Sema/dllimport.c @@ -77,6 +77,9 @@ __declspec(dllimport) extern int GlobalRedecl5; // expected-warning{{redeclarati // External linkage is required. __declspec(dllimport) static int StaticGlobal; // expected-error{{'StaticGlobal' must have external linkage when declared 'dllimport'}} +// 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}} |