Skip to content

tsan: remove interceptors for termio #24734

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 13, 2025
Merged

Conversation

Rexicon226
Copy link
Contributor

@Rexicon226 Rexicon226 commented Aug 7, 2025

llvm/llvm-project#137403
makes tsan build again for glibc after #24640

@alexrp alexrp enabled auto-merge (rebase) August 7, 2025 17:40
@alexrp
Copy link
Member

alexrp commented Aug 7, 2025

Do you feel like adding a small standalone test that just builds an executable with TSan enabled?

@Rexicon226
Copy link
Contributor Author

I was thinking that exact same thought -- but I wonder what targets we should run it for. We used to have MacOS regressions on TSan as well. Should that be included?

@alexrp
Copy link
Member

alexrp commented Aug 7, 2025

In theory:

  • FreeBSD: aarch64, powerpc64(le), riscv64, x86_64
  • Linux: aarch64(_be), loongarch64, mips64(el), powerpc64(le), riscv64, s390x, x86_64
  • macOS: aarch64, x86_64
  • NetBSD: aarch64(_be), x86_64
  • Windows: aarch64, x86_64

I have no idea how many of these it'll actually build for in practice though.

@Rexicon226
Copy link
Contributor Author

Trying it out now.

@Rexicon226
Copy link
Contributor Author

Rexicon226 commented Aug 7, 2025

This is compiling from a x86-64-linux host.

aarch64-freebsd and x86_64-freebsd
+- install tsan_freebsd_aarch64
   +- compile exe tsan_freebsd_aarch64 Debug aarch64-freebsd 1 errors
error: sub-compilation of libtsan failed
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_platform_limits_freebsd.cpp:73:10: note: 'md5.h' file not found
#include <md5.h>
         ^~~~~~~~
error: the following command failed with 1 compilation errors:
powerpc64-freebsd and powerpc64le-freebsd and riscv64-freebsd
+- install tsan_freebsd_powerpc64le
   +- compile exe tsan_freebsd_powerpc64le Debug powerpc64le-freebsd 3 errors
error: sub-compilation of libcxxabi failed
    :1:1: note: unsupported option '-fsanitize=thread' for target 'powerpc64le-unknown-freebsd14.0.0-unknown'
...
    :1:1: note: unsupported option '-fsanitize=thread' for target 'powerpc64le-unknown-freebsd14.0.0-unknown'
error: sub-compilation of libtsan failed
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_platform_limits_freebsd.cpp:73:10: note: 'md5.h' file not found
#include <md5.h>
         ^~~~~~~~
error: sub-compilation of libcxx failed
    :1:1: note: unsupported option '-fsanitize=thread' for target 'powerpc64le-unknown-freebsd14.0.0-unknown'
...
    :1:1: note: unsupported option '-fsanitize=thread' for target 'powerpc64le-unknown-freebsd14.0.0-unknown'
mips64el-linux and mips64-linux
+- install tsan_linux_mips64el
   +- compile exe tsan_linux_mips64el Debug mips64el-linux 1 errors
error: sub-compilation of libtsan failed
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_platform_limits_linux.cpp:67:16: note: static assertion failed due to requirement 'struct_kernel_stat_sz == sizeof(stat)': 
COMPILER_CHECK(struct_kernel_stat_sz == sizeof(struct stat));
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_internal_defs.h:369:44: note: expanded from macro 'COMPILER_CHECK'
#define COMPILER_CHECK(pred) static_assert(pred, "")
                                           ^
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_platform_limits_linux.cpp:67:38: note: expression evaluates to '216 == 208'
COMPILER_CHECK(struct_kernel_stat_sz == sizeof(struct stat));
               ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_internal_defs.h:369:44: note: expanded from macro 'COMPILER_CHECK'
#define COMPILER_CHECK(pred) static_assert(pred, "")
                                           ^
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp:630:60: note: use of undeclared identifier 'EF_REG29'
  *sp = reinterpret_cast<regs_struct *>(buffer->data())[0].REG_SP;
                                                           ^
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp:517:23: note: expanded from macro 'REG_SP'
#  define REG_SP regs[EF_REG29]
                      ^
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_platform_limits_posix.cpp:1133:1: note: static assertion failed due to requirement '__builtin_offsetof(__sanitizer::__sanitizer_sigaction, sa_mask) == __builtin_offsetof(sigaction, sa_mask)': 
CHECK_STRUCT_SIZE_AND_OFFSET(sigaction, sa_mask);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_platform_limits_posix.h:1529:18: note: expanded from macro 'CHECK_STRUCT_SIZE_AND_OFFSET'
  COMPILER_CHECK(offsetof(struct __sanitizer_##CLASS, MEMBER) ==         \
  ~~~~~~~~~~~~~~~^
    /home/david/Code/zig/lib/include/__stddef_offsetof.h:16:24: note: expanded from macro 'offsetof'
#define offsetof(t, d) __builtin_offsetof(t, d)
                       ^
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_internal_defs.h:369:44: note: expanded from macro 'COMPILER_CHECK'
#define COMPILER_CHECK(pred) static_assert(pred, "")
                                           ^
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_platform_limits_posix.cpp:1133:1: note: expression evaluates to '16 == 8'
CHECK_STRUCT_SIZE_AND_OFFSET(sigaction, sa_mask);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_platform_limits_posix.h:1529:63: note: expanded from macro 'CHECK_STRUCT_SIZE_AND_OFFSET'
  COMPILER_CHECK(offsetof(struct __sanitizer_##CLASS, MEMBER) ==         \
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_internal_defs.h:369:44: note: expanded from macro 'COMPILER_CHECK'
#define COMPILER_CHECK(pred) static_assert(pred, "")
                                           ^
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_platform_limits_posix.cpp:1137:1: note: static assertion failed due to requirement '__builtin_offsetof(__sanitizer::__sanitizer_sigaction, sa_flags) == __builtin_offsetof(sigaction, sa_flags)': 
CHECK_STRUCT_SIZE_AND_OFFSET(sigaction, sa_flags);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_platform_limits_posix.h:1529:18: note: expanded from macro 'CHECK_STRUCT_SIZE_AND_OFFSET'
  COMPILER_CHECK(offsetof(struct __sanitizer_##CLASS, MEMBER) ==         \
  ~~~~~~~~~~~~~~~^
    /home/david/Code/zig/lib/include/__stddef_offsetof.h:16:24: note: expanded from macro 'offsetof'
#define offsetof(t, d) __builtin_offsetof(t, d)
                       ^
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_internal_defs.h:369:44: note: expanded from macro 'COMPILER_CHECK'
#define COMPILER_CHECK(pred) static_assert(pred, "")
                                           ^
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_platform_limits_posix.cpp:1137:1: note: expression evaluates to '0 == 136'
CHECK_STRUCT_SIZE_AND_OFFSET(sigaction, sa_flags);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_platform_limits_posix.h:1529:63: note: expanded from macro 'CHECK_STRUCT_SIZE_AND_OFFSET'
  COMPILER_CHECK(offsetof(struct __sanitizer_##CLASS, MEMBER) ==         \
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_internal_defs.h:369:44: note: expanded from macro 'COMPILER_CHECK'
#define COMPILER_CHECK(pred) static_assert(pred, "")
                                           ^
s390x-linux
test
+- install tsan_linux_s390x
   +- compile exe tsan_linux_s390x Debug s390x-linux 1 errors
error: sub-compilation of libtsan failed
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_platform_limits_posix.cpp:1133:1: note: static assertion failed due to requirement '__builtin_offsetof(__sanitizer::__sanitizer_sigaction, sa_mask) == __builtin_offsetof(sigaction, sa_mask)': 
CHECK_STRUCT_SIZE_AND_OFFSET(sigaction, sa_mask);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_platform_limits_posix.h:1529:18: note: expanded from macro 'CHECK_STRUCT_SIZE_AND_OFFSET'
  COMPILER_CHECK(offsetof(struct __sanitizer_##CLASS, MEMBER) ==         \
  ~~~~~~~~~~~~~~~^
    /home/david/Code/zig/lib/include/__stddef_offsetof.h:16:24: note: expanded from macro 'offsetof'
#define offsetof(t, d) __builtin_offsetof(t, d)
                       ^
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_internal_defs.h:369:44: note: expanded from macro 'COMPILER_CHECK'
#define COMPILER_CHECK(pred) static_assert(pred, "")
                                           ^
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_platform_limits_posix.cpp:1133:1: note: expression evaluates to '24 == 8'
CHECK_STRUCT_SIZE_AND_OFFSET(sigaction, sa_mask);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_platform_limits_posix.h:1529:63: note: expanded from macro 'CHECK_STRUCT_SIZE_AND_OFFSET'
  COMPILER_CHECK(offsetof(struct __sanitizer_##CLASS, MEMBER) ==         \
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_internal_defs.h:369:44: note: expanded from macro 'COMPILER_CHECK'
#define COMPILER_CHECK(pred) static_assert(pred, "")
                                           ^
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_platform_limits_posix.cpp:1140:1: note: static assertion failed due to requirement '__builtin_offsetof(__sanitizer::__sanitizer_sigaction, sa_restorer) == __builtin_offsetof(sigaction, sa_restorer)': 
CHECK_STRUCT_SIZE_AND_OFFSET(sigaction, sa_restorer);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_platform_limits_posix.h:1529:18: note: expanded from macro 'CHECK_STRUCT_SIZE_AND_OFFSET'
  COMPILER_CHECK(offsetof(struct __sanitizer_##CLASS, MEMBER) ==         \
  ~~~~~~~~~~~~~~~^
    /home/david/Code/zig/lib/include/__stddef_offsetof.h:16:24: note: expanded from macro 'offsetof'
#define offsetof(t, d) __builtin_offsetof(t, d)
                       ^
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_internal_defs.h:369:44: note: expanded from macro 'COMPILER_CHECK'
#define COMPILER_CHECK(pred) static_assert(pred, "")
                                           ^
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_platform_limits_posix.cpp:1140:1: note: expression evaluates to '16 == 144'
CHECK_STRUCT_SIZE_AND_OFFSET(sigaction, sa_restorer);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_platform_limits_posix.h:1529:63: note: expanded from macro 'CHECK_STRUCT_SIZE_AND_OFFSET'
  COMPILER_CHECK(offsetof(struct __sanitizer_##CLASS, MEMBER) ==         \
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_internal_defs.h:369:44: note: expanded from macro 'COMPILER_CHECK'
#define COMPILER_CHECK(pred) static_assert(pred, "")
                                           ^
x86_64-macos
+- install tsan_macos_x86_64
   +- compile exe tsan_macos_x86_64 Debug x86_64-macos 1 errors
error: sub-compilation of libtsan failed
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_symbolizer_mac.cpp:22:12: note: 'util.h' file not found
#  include <util.h>
           ^~~~~~~~~
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_platform_limits_posix.cpp:65:10: note: 'sys/timeb.h' file not found
#include <sys/timeb.h>
         ^~~~~~~~~~~~~~
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_mac.cpp:64:12: note: 'asl.h' file not found
#  include <asl.h>
           ^~~~~~~~
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_malloc_mac.inc:20:10: note: 'CoreFoundation/CFBase.h' file not found
#include <CoreFoundation/CFBase.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/david/Code/zig/lib/libtsan/tsan_malloc_mac.cpp:85:10: note: in file included from /home/david/Code/zig/lib/libtsan/tsan_malloc_mac.cpp:85:
#include "sanitizer_common/sanitizer_malloc_mac.inc"
         ^
    /home/david/Code/zig/lib/libtsan/tsan_platform_mac.cpp:37:10: note: 'sys/syscall.h' file not found
#include <sys/syscall.h>
         ^~~~~~~~~~~~~~~~
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_mac.cpp:19:12: note: 'objc/objc-sync.h' file not found
#  include <objc/objc-sync.h>
           ^~~~~~~~~~~~~~~~~~~
aarch64-macos
+- install tsan_macos_aarch64
   +- compile exe tsan_macos_aarch64 Debug aarch64-macos 1 errors
error: sub-compilation of libtsan failed
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_symbolizer_mac.cpp:22:12: note: 'util.h' file not found
#  include <util.h>
           ^~~~~~~~~
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_platform_limits_posix.cpp:65:10: note: 'sys/timeb.h' file not found
#include <sys/timeb.h>
         ^~~~~~~~~~~~~~
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_malloc_mac.inc:20:10: note: 'CoreFoundation/CFBase.h' file not found
#include <CoreFoundation/CFBase.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/david/Code/zig/lib/libtsan/tsan_malloc_mac.cpp:85:10: note: in file included from /home/david/Code/zig/lib/libtsan/tsan_malloc_mac.cpp:85:
#include "sanitizer_common/sanitizer_malloc_mac.inc"
         ^
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_mac.cpp:64:12: note: 'asl.h' file not found
#  include <asl.h>
           ^~~~~~~~
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_mac.cpp:19:12: note: 'objc/objc-sync.h' file not found
#  include <objc/objc-sync.h>
           ^~~~~~~~~~~~~~~~~~~
    /home/david/Code/zig/lib/libtsan/tsan_platform_mac.cpp:37:10: note: 'sys/syscall.h' file not found
#include <sys/syscall.h>
         ^~~~~~~~~~~~~~~~
aarch64-netbsd and aarch64be-netbsd
+- install tsan_netbsd_aarch64
   +- compile exe tsan_netbsd_aarch64 Debug aarch64-netbsd 3 errors
error: sub-compilation of libcxxabi failed
    :1:1: note: unsupported option '-fsanitize=thread' for target 'aarch64-unknown-netbsd10.1.0-unknown'
...
    :1:1: note: unsupported option '-fsanitize=thread' for target 'aarch64-unknown-netbsd10.1.0-unknown'
error: sub-compilation of libcxx failed
    :1:1: note: unsupported option '-fsanitize=thread' for target 'aarch64-unknown-netbsd10.1.0-unknown'
...
    :1:1: note: unsupported option '-fsanitize=thread' for target 'aarch64-unknown-netbsd10.1.0-unknown'
error: sub-compilation of libtsan failed
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_linux.cpp:2052:8: note: use of undeclared identifier 'Aarch64GetESR'
  if (!Aarch64GetESR(ucontext, &esr))
       ^
    /home/david/Code/zig/lib/libtsan/tsan_platform_linux.cpp:510:4: note: unsupported
#  error unsupported
   ^
    /home/david/Code/zig/lib/libtsan/tsan_platform_linux.cpp:537:25: note: use of undeclared identifier 'LONG_JMP_SP_ENV_SLOT'
  uptr mangled_sp = env[LONG_JMP_SP_ENV_SLOT];
                        ^
    /home/david/Code/zig/lib/libc/include/generic-netbsd/sys/lua.h:38:10: note: 'lua.h' file not found with <angled> include; use "quotes" instead
#include <lua.h>  /* for lua_State */
         ^
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_platform_limits_netbsd.cpp:50:10: note: in file included from /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_platform_limits_netbsd.cpp:50:
#include <sys/lua.h>
         ^
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_platform_limits_netbsd.cpp:94:10: note: 'sys/soundcard.h' file not found
#include <sys/soundcard.h>
         ^~~~~~~~~~~~~~~~~~
x86_64-netbsd
+- install tsan_netbsd_x86_64
   +- compile exe tsan_netbsd_x86_64 Debug x86_64-netbsd 1 errors
error: sub-compilation of libtsan failed
    /home/david/Code/zig/lib/libc/include/generic-netbsd/sys/lua.h:38:10: note: 'lua.h' file not found with <angled> include; use "quotes" instead
#include <lua.h>  /* for lua_State */
         ^
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_platform_limits_netbsd.cpp:50:10: note: in file included from /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_platform_limits_netbsd.cpp:50:
#include <sys/lua.h>
         ^
    /home/david/Code/zig/lib/libtsan/sanitizer_common/sanitizer_platform_limits_netbsd.cpp:94:10: note: 'sys/soundcard.h' file not found
#include <sys/soundcard.h>
         ^~~~~~~~~~~~~~~~~~
x86-64-windows-gnu
+- install tsan_windows_x86_64
   +- compile exe tsan_windows_x86_64 Debug x86_64-windows 3 errors
error: sub-compilation of libcxxabi failed
    :1:1: note: unsupported option '-fsanitize=thread' for target 'x86_64-unknown-windows-gnu'
...
    :1:1: note: unsupported option '-fsanitize=thread' for target 'x86_64-unknown-windows-gnu'
error: sub-compilation of libtsan failed
    /home/david/Code/zig/lib/libtsan/tsan_rtl_amd64.S:1:1: note: clang exited with code 1
    /home/david/Code/zig/lib/libtsan/tsan_rtl.cpp:445:23: note: incompatible integer to pointer conversion assigning to 'fd_t' (aka 'void *') from 'int'
    ctx->memprof_fd = 1;
                      ^
    /home/david/Code/zig/lib/libtsan/tsan_rtl.cpp:447:23: note: incompatible integer to pointer conversion assigning to 'fd_t' (aka 'void *') from 'int'
    ctx->memprof_fd = 2;
                      ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:99:27: note: unknown type name '__sanitizer_FILE'
DECLARE_REAL(int, fflush, __sanitizer_FILE *fp)
                          ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:112:8: note: unknown type name '__sanitizer_FILE'
extern __sanitizer_FILE *stdout, *stderr;
       ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:171:3: note: unknown type name '__sanitizer_siginfo'
  __sanitizer_siginfo siginfo;
  ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:179:3: note: unknown type name '__sanitizer_sigset_t'
  __sanitizer_sigset_t emptyset;
  ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:180:3: note: unknown type name '__sanitizer_sigset_t'
  __sanitizer_sigset_t oldset;
  ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:213:3: note: unknown type name '__sanitizer_sigaction'
  __sanitizer_sigaction sigactions[kSigCount];
  ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:620:25: note: no member named 'InterceptFunction' in namespace '__interception'
  using __interception::InterceptFunction;
        ~~~~~~~~~~~~~~~~^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:621:3: note: use of undeclared identifier 'InterceptFunction'
  InterceptFunction(SANITIZER_STRINGIFY(setjmp_symname), (uptr*)&REAL(setjmp_symname), 0, 0);
  ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:622:3: note: use of undeclared identifier 'InterceptFunction'
  InterceptFunction("_setjmp", (uptr*)&REAL(_setjmp), 0, 0);
  ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:623:3: note: use of undeclared identifier 'InterceptFunction'
  InterceptFunction(SANITIZER_STRINGIFY(sigsetjmp_symname), (uptr*)&REAL(sigsetjmp_symname), 0,
  ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:626:3: note: use of undeclared identifier 'InterceptFunction'
  InterceptFunction("__sigsetjmp", (uptr*)&REAL(__sigsetjmp), 0, 0);
  ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:1058:3: note: unknown type name '__sanitizer_pthread_attr_t'
  __sanitizer_pthread_attr_t myattr;
  ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:1080:48: note: use of undeclared identifier 'IsStateDetached'
    p.tid = ThreadCreate(thr, pc, *(uptr *)th, IsStateDetached(detached));
                                               ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:1200:32: note: use of undeclared identifier 'pthread_cond_t_sz'
  void *newcond = WRAP(malloc)(pthread_cond_t_sz);
                               ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:1201:31: note: use of undeclared identifier 'pthread_cond_t_sz'
  internal_memset(newcond, 0, pthread_cond_t_sz);
                              ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:1626:46: note: no member named 'pthread_mutex_t_sz' in namespace '__sanitizer'
          ((void *)((char *)o + __sanitizer::pthread_mutex_t_sz));
                                ~~~~~~~~~~~~~^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:1684:7: note: use of undeclared identifier 'OpenReadsVaArgs'
  if (OpenReadsVaArgs(oflag)) {
      ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:1695:7: note: use of undeclared identifier 'OpenReadsVaArgs'
  if (OpenReadsVaArgs(oflag))
      ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:1954:16: note: use of undeclared identifier 'stderr'
  REAL(fflush)(stderr);
               ^
    :1:1: note: too many errors emitted, stopping now
error: sub-compilation of libcxx failed
    :1:1: note: unsupported option '-fsanitize=thread' for target 'x86_64-unknown-windows-gnu'
...
    :1:1: note: unsupported option '-fsanitize=thread' for target 'x86_64-unknown-windows-gnu'
error: error(compilation): clang failed with stderr: /home/david/Code/zig/lib/libtsan/tsan_rtl_amd64.S:39:3: error: "Unknown platform"
   39 | # error "Unknown platform"
      |   ^
/home/david/Code/zig/lib/libtsan/tsan_rtl_amd64.S:81:3: error: "Unknown platform"
   81 | # error "Unknown platform"
      |   ^
/home/david/Code/zig/lib/libtsan/tsan_rtl_amd64.S:130:3: error: "Unknown platform"
  130 | # error "Unknown platform"
      |   ^
3 errors generated.
aarch64-windows
+- install tsan_windows_aarch64
   +- compile exe tsan_windows_aarch64 Debug aarch64-windows 3 errors
error: sub-compilation of libcxxabi failed
    :1:1: note: unsupported option '-fsanitize=thread' for target 'aarch64-unknown-windows-gnu'
...
    :1:1: note: unsupported option '-fsanitize=thread' for target 'aarch64-unknown-windows-gnu'
error: sub-compilation of libcxx failed
    :1:1: note: unsupported option '-fsanitize=thread' for target 'aarch64-unknown-windows-gnu'
...
    :1:1: note: unsupported option '-fsanitize=thread' for target 'aarch64-unknown-windows-gnu'
error: sub-compilation of libtsan failed
    /home/david/Code/zig/lib/libtsan/tsan_rtl_aarch64.S:1:1: note: clang exited with code 1
    /home/david/Code/zig/lib/libtsan/tsan_rtl.cpp:445:23: note: incompatible integer to pointer conversion assigning to 'fd_t' (aka 'void *') from 'int'
    ctx->memprof_fd = 1;
                      ^
    /home/david/Code/zig/lib/libtsan/tsan_rtl.cpp:447:23: note: incompatible integer to pointer conversion assigning to 'fd_t' (aka 'void *') from 'int'
    ctx->memprof_fd = 2;
                      ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:99:27: note: unknown type name '__sanitizer_FILE'
DECLARE_REAL(int, fflush, __sanitizer_FILE *fp)
                          ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:112:8: note: unknown type name '__sanitizer_FILE'
extern __sanitizer_FILE *stdout, *stderr;
       ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:171:3: note: unknown type name '__sanitizer_siginfo'
  __sanitizer_siginfo siginfo;
  ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:179:3: note: unknown type name '__sanitizer_sigset_t'
  __sanitizer_sigset_t emptyset;
  ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:180:3: note: unknown type name '__sanitizer_sigset_t'
  __sanitizer_sigset_t oldset;
  ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:213:3: note: unknown type name '__sanitizer_sigaction'
  __sanitizer_sigaction sigactions[kSigCount];
  ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:620:25: note: no member named 'InterceptFunction' in namespace '__interception'
  using __interception::InterceptFunction;
        ~~~~~~~~~~~~~~~~^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:621:3: note: use of undeclared identifier 'InterceptFunction'
  InterceptFunction(SANITIZER_STRINGIFY(setjmp_symname), (uptr*)&REAL(setjmp_symname), 0, 0);
  ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:622:3: note: use of undeclared identifier 'InterceptFunction'
  InterceptFunction("_setjmp", (uptr*)&REAL(_setjmp), 0, 0);
  ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:623:3: note: use of undeclared identifier 'InterceptFunction'
  InterceptFunction(SANITIZER_STRINGIFY(sigsetjmp_symname), (uptr*)&REAL(sigsetjmp_symname), 0,
  ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:626:3: note: use of undeclared identifier 'InterceptFunction'
  InterceptFunction("__sigsetjmp", (uptr*)&REAL(__sigsetjmp), 0, 0);
  ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:1058:3: note: unknown type name '__sanitizer_pthread_attr_t'
  __sanitizer_pthread_attr_t myattr;
  ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:1080:48: note: use of undeclared identifier 'IsStateDetached'
    p.tid = ThreadCreate(thr, pc, *(uptr *)th, IsStateDetached(detached));
                                               ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:1200:32: note: use of undeclared identifier 'pthread_cond_t_sz'
  void *newcond = WRAP(malloc)(pthread_cond_t_sz);
                               ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:1201:31: note: use of undeclared identifier 'pthread_cond_t_sz'
  internal_memset(newcond, 0, pthread_cond_t_sz);
                              ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:1626:46: note: no member named 'pthread_mutex_t_sz' in namespace '__sanitizer'
          ((void *)((char *)o + __sanitizer::pthread_mutex_t_sz));
                                ~~~~~~~~~~~~~^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:1684:7: note: use of undeclared identifier 'OpenReadsVaArgs'
  if (OpenReadsVaArgs(oflag)) {
      ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:1695:7: note: use of undeclared identifier 'OpenReadsVaArgs'
  if (OpenReadsVaArgs(oflag))
      ^
    /home/david/Code/zig/lib/libtsan/tsan_interceptors_posix.cpp:1954:16: note: use of undeclared identifier 'stderr'
  REAL(fflush)(stderr);
               ^
    :1:1: note: too many errors emitted, stopping now
error: error(compilation): clang failed with stderr: /home/david/Code/zig/lib/libtsan/tsan_rtl_aarch64.S:14:1: error: unknown directive
.hidden __tsan_setjmp
^
/home/david/Code/zig/lib/libtsan/tsan_rtl_aarch64.S:17:7: error: expected absolute expression
.type setjmp, %function
      ^
/home/david/Code/zig/lib/libtsan/tsan_rtl_aarch64.S:64:1: error: unknown directive
.size setjmp, .-setjmp
^
/home/david/Code/zig/lib/libtsan/tsan_rtl_aarch64.S:68:7: error: expected absolute expression
.type _setjmp, %function
      ^
/home/david/Code/zig/lib/libtsan/tsan_rtl_aarch64.S:115:1: error: unknown directive
.size _setjmp, .-_setjmp
^
/home/david/Code/zig/lib/libtsan/tsan_rtl_aarch64.S:119:7: error: expected absolute expression
.type sigsetjmp, %function
      ^
/home/david/Code/zig/lib/libtsan/tsan_rtl_aarch64.S:167:1: error: unknown directive
.size sigsetjmp, .-sigsetjmp
^
/home/david/Code/zig/lib/libtsan/tsan_rtl_aarch64.S:172:7: error: expected absolute expression
.type __sigsetjmp, %function
      ^
/home/david/Code/zig/lib/libtsan/tsan_rtl_aarch64.S:220:1: error: unknown directive
.size __sigsetjmp, .-__sigsetjmp
^


auto-merge was automatically disabled August 7, 2025 21:27

Head branch was pushed to by a user without write access

@alexrp alexrp enabled auto-merge August 7, 2025 21:29
@alexrp
Copy link
Member

alexrp commented Aug 8, 2025

Are you a magnet for ELF linker bugs? 🤔

@Rexicon226
Copy link
Contributor Author

I try my best.

auto-merge was automatically disabled August 8, 2025 04:27

Head branch was pushed to by a user without write access

@Rexicon226 Rexicon226 force-pushed the tsan-fix branch 7 times, most recently from bb451bd to 8b77408 Compare August 10, 2025 02:10
@alexrp alexrp self-assigned this Aug 10, 2025
@alexrp
Copy link
Member

alexrp commented Aug 10, 2025

Remaining failures look like #24754.

@alexrp alexrp merged commit 662303d into ziglang:master Aug 13, 2025
23 of 26 checks passed
@Rexicon226 Rexicon226 deleted the tsan-fix branch August 13, 2025 14:08
@alexrp alexrp removed their assignment Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants