diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2024-09-24 13:47:29 +0200 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2024-09-24 23:58:21 -0700 |
| commit | a40cdad18c06fd377622c47aa34564df7ea959b5 (patch) | |
| tree | dbcfabc2191cdbf2acc6c356c5ea25237b29d8f1 /lib/tsan/interception/interception_linux.h | |
| parent | 7f6b7c56089eaa5b147e71b3d98328498c9025c8 (diff) | |
| download | zig-a40cdad18c06fd377622c47aa34564df7ea959b5.tar.gz zig-a40cdad18c06fd377622c47aa34564df7ea959b5.zip | |
tsan: Update to LLVM 19.1.0.
Diffstat (limited to 'lib/tsan/interception/interception_linux.h')
| -rw-r--r-- | lib/tsan/interception/interception_linux.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/tsan/interception/interception_linux.h b/lib/tsan/interception/interception_linux.h index 433a3d9bd7..2e01ff4457 100644 --- a/lib/tsan/interception/interception_linux.h +++ b/lib/tsan/interception/interception_linux.h @@ -28,12 +28,14 @@ bool InterceptFunction(const char *name, const char *ver, uptr *ptr_to_real, uptr func, uptr trampoline); } // namespace __interception -#define INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func) \ - ::__interception::InterceptFunction( \ - #func, \ - (::__interception::uptr *)&REAL(func), \ - (::__interception::uptr)&(func), \ - (::__interception::uptr)&TRAMPOLINE(func)) +// Cast func to type of REAL(func) before casting to uptr in case it is an +// overloaded function, which is the case for some glibc functions when +// _FORTIFY_SOURCE is used. This disambiguates which overload to use. +#define INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func) \ + ::__interception::InterceptFunction( \ + #func, (::__interception::uptr *)&REAL(func), \ + (::__interception::uptr)(decltype(REAL(func)))&(func), \ + (::__interception::uptr) &TRAMPOLINE(func)) // dlvsym is a GNU extension supported by some other platforms. #if SANITIZER_GLIBC || SANITIZER_FREEBSD || SANITIZER_NETBSD @@ -41,7 +43,7 @@ bool InterceptFunction(const char *name, const char *ver, uptr *ptr_to_real, ::__interception::InterceptFunction( \ #func, symver, \ (::__interception::uptr *)&REAL(func), \ - (::__interception::uptr)&(func), \ + (::__interception::uptr)(decltype(REAL(func)))&(func), \ (::__interception::uptr)&TRAMPOLINE(func)) #else #define INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver) \ |
