aboutsummaryrefslogtreecommitdiff
path: root/lib/libtsan/interception/interception.h
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2025-07-16 11:22:46 +0200
committerAlex Rønne Petersen <alex@alexrp.com>2025-08-30 06:36:41 +0200
commitac2050609055d76a58b058b064f0b0c4d54e2faa (patch)
tree54855b2bde3e1eed89d870251b044e93972f6c5c /lib/libtsan/interception/interception.h
parent85438e75e04b356ca319051c33e0987a9958ad4a (diff)
downloadzig-ac2050609055d76a58b058b064f0b0c4d54e2faa.tar.gz
zig-ac2050609055d76a58b058b064f0b0c4d54e2faa.zip
libtsan: update to LLVM 21
Diffstat (limited to 'lib/libtsan/interception/interception.h')
-rw-r--r--lib/libtsan/interception/interception.h27
1 files changed, 21 insertions, 6 deletions
diff --git a/lib/libtsan/interception/interception.h b/lib/libtsan/interception/interception.h
index 3cb6b44663..9fe7d3db30 100644
--- a/lib/libtsan/interception/interception.h
+++ b/lib/libtsan/interception/interception.h
@@ -19,7 +19,7 @@
#if !SANITIZER_LINUX && !SANITIZER_FREEBSD && !SANITIZER_APPLE && \
!SANITIZER_NETBSD && !SANITIZER_WINDOWS && !SANITIZER_FUCHSIA && \
- !SANITIZER_SOLARIS
+ !SANITIZER_SOLARIS && !SANITIZER_HAIKU && !SANITIZER_AIX
# error "Interception doesn't work on this operating system."
#endif
@@ -168,6 +168,16 @@ const interpose_substitution substitution_##func_name[] \
extern "C" ret_type func(__VA_ARGS__);
# define DECLARE_WRAPPER_WINAPI(ret_type, func, ...) \
extern "C" __declspec(dllimport) ret_type __stdcall func(__VA_ARGS__);
+#elif SANITIZER_AIX
+# define WRAP(x) __interceptor_##x
+# define TRAMPOLINE(x) WRAP(x)
+// # define WRAPPER_NAME(x) "__interceptor_" #x
+# define INTERCEPTOR_ATTRIBUTE __attribute__((visibility("default")))
+// AIX's linker will not select the weak symbol, so don't use weak for the
+// interceptors.
+# define DECLARE_WRAPPER(ret_type, func, ...) \
+ extern "C" ret_type func(__VA_ARGS__) \
+ __attribute__((alias("__interceptor_" #func), visibility("default")));
#elif !SANITIZER_FUCHSIA // LINUX, FREEBSD, NETBSD, SOLARIS
# define INTERCEPTOR_ATTRIBUTE __attribute__((visibility("default")))
# if ASM_INTERCEPTOR_TRAMPOLINE_SUPPORT
@@ -367,12 +377,17 @@ inline void DoesNotSupportStaticLinking() {}
#define INCLUDED_FROM_INTERCEPTION_LIB
-#if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_NETBSD || \
- SANITIZER_SOLARIS
+#if SANITIZER_AIX
+# include "interception_aix.h"
+# define INTERCEPT_FUNCTION(func) INTERCEPT_FUNCTION_AIX(func)
+# define INTERCEPT_FUNCTION_VER(func, symver) INTERCEPT_FUNCTION_AIX(func)
-# include "interception_linux.h"
-# define INTERCEPT_FUNCTION(func) INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func)
-# define INTERCEPT_FUNCTION_VER(func, symver) \
+#elif SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_NETBSD || \
+ SANITIZER_SOLARIS || SANITIZER_HAIKU
+
+# include "interception_linux.h"
+# define INTERCEPT_FUNCTION(func) INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func)
+# define INTERCEPT_FUNCTION_VER(func, symver) \
INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver)
#elif SANITIZER_APPLE
# include "interception_mac.h"