[compiler-rt] [rtsan] Support legacy pthread_cond variables (PR #152947)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 11 09:11:40 PDT 2025
================
@@ -46,12 +46,44 @@
using namespace __sanitizer;
+#if defined(__x86_64__) || defined(__mips__) || SANITIZER_PPC64V1 || \
+ defined(__s390x__)
+#define PTHREAD_ABI_BASE "GLIBC_2.3.2"
+#elif defined(__aarch64__) || SANITIZER_PPC64V2
+#define PTHREAD_ABI_BASE "GLIBC_2.17"
+#elif SANITIZER_LOONGARCH64
+#define PTHREAD_ABI_BASE "GLIBC_2.36"
+#elif SANITIZER_RISCV64
+#define PTHREAD_ABI_BASE "GLIBC_2.27"
+#endif
+
+DECLARE_REAL_AND_INTERCEPTOR(void *, malloc, usize size)
+DECLARE_REAL_AND_INTERCEPTOR(void, free, void *ptr)
+
namespace {
struct DlsymAlloc : public DlSymAllocator<DlsymAlloc> {
static bool UseImpl() { return !__rtsan_is_initialized(); }
};
} // namespace
+// See note in tsan or ddsan as to why this is necessary
+static pthread_cond_t *init_cond(pthread_cond_t *c, bool force = false) {
----------------
davidtrevelyan wrote:
Likewise, would it be sensible to put this into a shared utility within the `RTSanitizerCommon` or `RTInterception` libs?
https://github.com/llvm/llvm-project/pull/152947
More information about the llvm-commits
mailing list