[compiler-rt] [TySan][Sanitizer Common] Make TySan compatible with sanitizer common… (PR #183310)
Dan Liew via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 13 13:56:17 PDT 2026
delcypher wrote:
So ultimately the problem is when the macros get expanded `InitializeSignalInterceptors` looks like this:
```
# 130 "/Volumes/user_data/dev/llvm/llvm.org/main/src/llvm-project/compiler-rt/lib/tysan/../sanitizer_common/sanitizer_signal_interceptors.inc"
static void InitializeSignalInterceptors() {
static bool was_called_once;
do { __sanitizer::u64 v1 = (__sanitizer::u64)((!was_called_once)); __sanitizer::u64 v2 = (__sanitizer::u64)(0); if (__builtin_expect(!!(!(v1 != v2)), 0)) __sanitizer::CheckFailed("/Volumes/user_data/dev/llvm/llvm.org/main/src/llvm-project/compiler-rt/lib/tysan/../sanitizer_common/sanitizer_signal_interceptors.inc", 132, "(" "(!was_called_once)" ") " "!=" " (" "0" ")", v1, v2); } while (false);
was_called_once = true;
;
do { if (!) do { if (__builtin_expect(!!((uptr)Verbosity() >= (1)), 0)) Report("TypeSanitizer: failed to intercept '%s'\n", "signal"); } while (0); } while (0);
do { if (!) do { if (__builtin_expect(!!((uptr)Verbosity() >= (1)), 0)) Report("TypeSanitizer: failed to intercept '%s'\n", "sigaction"); } while (0); } while (0);
}
```
in particular the `if (!)` is the problem. I think this comes from
```
#define TYSAN_INTERCEPT_FUNC(name) \
do { \
if (!INTERCEPT_FUNCTION(name)) \
VReport(1, "TypeSanitizer: failed to intercept '%s'\n", #name); \
} while (0)
```
on Apple functions `INTERCEPT_FUNCTION(name)` expands to nothing.
https://github.com/llvm/llvm-project/pull/183310
More information about the llvm-commits
mailing list