[compiler-rt] [ASan] Recognize WASI platform in sanitizer_platform.h (PR #139017)

via llvm-commits llvm-commits at lists.llvm.org
Wed May 7 21:09:36 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Yuta Saito (kateinoigakukun)

<details>
<summary>Changes</summary>

The groundwork for upcoming WASI support.

---
Full diff: https://github.com/llvm/llvm-project/pull/139017.diff


1 Files Affected:

- (modified) compiler-rt/lib/sanitizer_common/sanitizer_platform.h (+8-1) 


``````````diff
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform.h
index 9f5f41cd85514..0a116da0d895b 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform.h
@@ -14,7 +14,8 @@
 
 #if !defined(__linux__) && !defined(__FreeBSD__) && !defined(__NetBSD__) && \
     !defined(__APPLE__) && !defined(_WIN32) && !defined(__Fuchsia__) &&     \
-    !(defined(__sun__) && defined(__svr4__)) && !defined(__HAIKU__)
+    !(defined(__sun__) && defined(__svr4__)) && !defined(__HAIKU__) && \
+    !defined(__wasi__)
 #  error "This operating system is not supported"
 #endif
 
@@ -61,6 +62,12 @@
 #  define SANITIZER_HAIKU 0
 #endif
 
+#if defined(__wasi__)
+#  define SANITIZER_WASI 1
+#else
+#  define SANITIZER_WASI 0
+#endif
+
 // - SANITIZER_APPLE: all Apple code
 //   - TARGET_OS_OSX: macOS
 //   - SANITIZER_IOS: devices (iOS and iOS-like)

``````````

</details>


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


More information about the llvm-commits mailing list