[compiler-rt] 16d88a5 - [compiler-rt][asan] Use native TLS for TSD on Windows (#222705)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 24 14:18:27 PDT 2026


Author: oltolm
Date: 2026-09-24T14:18:20-07:00
New Revision: 16d88a5e65b141b4ecf7a237c6104e1425a335d9

URL: https://github.com/llvm/llvm-project/commit/16d88a5e65b141b4ecf7a237c6104e1425a335d9
DIFF: https://github.com/llvm/llvm-project/commit/16d88a5e65b141b4ecf7a237c6104e1425a335d9.diff

LOG: [compiler-rt][asan] Use native TLS for TSD on Windows (#222705)

GCC 16 supports native Windows TLS. Use compiler-rt's THREADLOCAL
abstraction for fake_tsd on all compilers instead of spelling the
MSVC-specific storage-class syntax directly. GCC configurations using
emulated TLS remain unsupported.

Co-authored-by: Hannes Domani <ssbssa at yahoo.de>

Added: 
    

Modified: 
    compiler-rt/lib/asan/asan_win.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/asan/asan_win.cpp b/compiler-rt/lib/asan/asan_win.cpp
index 776ab49de565a..269406bde9070 100644
--- a/compiler-rt/lib/asan/asan_win.cpp
+++ b/compiler-rt/lib/asan/asan_win.cpp
@@ -229,7 +229,7 @@ void FlushUnneededASanShadowMemory(uptr p, uptr size) {
 // ---------------------- TSD ---------------- {{{
 static bool tsd_key_inited = false;
 
-static __declspec(thread) void *fake_tsd = 0;
+static THREADLOCAL void* fake_tsd = 0;
 
 // https://docs.microsoft.com/en-us/windows/desktop/api/winternl/ns-winternl-_teb
 // "[This structure may be altered in future versions of Windows. Applications


        


More information about the llvm-commits mailing list