[compiler-rt] fe19578 - [hwasan] Enable leak detection in hwasan for Fuchsia by default

Leonard Chan via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 4 12:29:55 PDT 2023


Author: Leonard Chan
Date: 2023-08-04T19:29:18Z
New Revision: fe195781ad2f1aaecd5def14f361f3590a17c79e

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

LOG: [hwasan] Enable leak detection in hwasan for Fuchsia by default

Differential Revision: https://reviews.llvm.org/D157127

Added: 
    

Modified: 
    compiler-rt/lib/hwasan/hwasan.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/hwasan/hwasan.cpp b/compiler-rt/lib/hwasan/hwasan.cpp
index 000c0f76c1daba..74aabc6c4f06b6 100644
--- a/compiler-rt/lib/hwasan/hwasan.cpp
+++ b/compiler-rt/lib/hwasan/hwasan.cpp
@@ -86,9 +86,11 @@ static void InitializeFlags() {
     cf.clear_shadow_mmap_threshold = 4096 * (SANITIZER_ANDROID ? 2 : 8);
     // Sigtrap is used in error reporting.
     cf.handle_sigtrap = kHandleSignalExclusive;
-    // For now only tested on Linux. Other plantforms can be turned on as they
-    // become ready.
-    cf.detect_leaks = cf.detect_leaks && SANITIZER_LINUX && !SANITIZER_ANDROID;
+    // For now only tested on Linux and Fuchsia. Other plantforms can be turned
+    // on as they become ready.
+    constexpr bool can_detect_leaks =
+        (SANITIZER_LINUX && !SANITIZER_ANDROID) || SANITIZER_FUCHSIA;
+    cf.detect_leaks = cf.detect_leaks && can_detect_leaks;
 
 #if SANITIZER_ANDROID
     // Let platform handle other signals. It is better at reporting them then we


        


More information about the llvm-commits mailing list