[compiler-rt] [compiler-rt] Support Windows GNU sanitizer runtimes (PR #209902)

Tomohiro Kashiwada via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 22 01:52:32 PDT 2026


================
@@ -14,10 +14,16 @@
 #if SANITIZER_WINDOWS
 #  include "sanitizer_common/sanitizer_win_defs.h"
 
+#  if defined(__GNUC__) && !defined(__clang__)
+#    include <intrin.h>
+#  endif
+
 namespace __asan {
 
-#  pragma section(".ASAN$GA", read, write)
-#  pragma section(".ASAN$GZ", read, write)
+#  if !defined(__GNUC__) || defined(__clang__)
+#    pragma section(".ASAN$GA", read, write)
+#    pragma section(".ASAN$GZ", read, write)
+#  endif
----------------
kikairoya wrote:

Would it be possible to make it a macro like
```
#if defined(__clang__) || defined(_MSC_VER)
#define SANITIZER_PRAGMA_SECTION(...) _Pragma(#__VA_ARGS__)
#else
#define SANITIZER_PRAGMA_SECTION(...)
#endif
```
? (just a suggestion, not a request)

https://github.com/llvm/llvm-project/pull/209902


More information about the llvm-commits mailing list