diff --git a/compiler-rt/lib/asan/asan_posix.cc b/compiler-rt/lib/asan/asan_posix.cc index 5c5e0359ad6c..f3fbda07ac5e 100644 --- a/compiler-rt/lib/asan/asan_posix.cc +++ b/compiler-rt/lib/asan/asan_posix.cc @@ -39,8 +39,8 @@ void AsanOnDeadlySignal(int signo, void *siginfo, void *context) { // ---------------------- TSD ---------------- {{{1 -#if SANITIZER_NETBSD || SANITIZER_FREEBSD -// Thread Static Data cannot be used in early init on NetBSD and FreeBSD. +#if SANITIZER_NETBSD +// Thread Static Data cannot be used in early init on NetBSD. // Reuse the Asan TSD API for compatibility with existing code // with an alternative implementation. diff --git a/compiler-rt/lib/msan/msan_linux.cc b/compiler-rt/lib/msan/msan_linux.cc index 3b6e6cb85f33..056783088225 100644 --- a/compiler-rt/lib/msan/msan_linux.cc +++ b/compiler-rt/lib/msan/msan_linux.cc @@ -174,8 +174,8 @@ void InstallAtExitHandler() { // ---------------------- TSD ---------------- {{{1 -#if SANITIZER_NETBSD || SANITIZER_FREEBSD -// Thread Static Data cannot be used in early init on NetBSD and FreeBSD. +#if SANITIZER_NETBSD +// Thread Static Data cannot be used in early init on NetBSD. // Reuse the MSan TSD API for compatibility with existing code // with an alternative implementation. diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc index 88ab0979bb05..455fd4c861de 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc @@ -779,7 +779,11 @@ int internal_sysctl(const int *name, unsigned int namelen, void *oldp, #if SANITIZER_FREEBSD int internal_sysctlbyname(const char *sname, void *oldp, uptr *oldlenp, const void *newp, uptr newlen) { - return sysctlbyname(sname, oldp, (size_t *)oldlenp, newp, (size_t)newlen); + static decltype(sysctlbyname) *real = nullptr; + if (!real) + real = (decltype(sysctlbyname) *)dlsym(RTLD_NEXT, "sysctlbyname"); + CHECK(real); + return real(sname, oldp, (size_t *)oldlenp, newp, (size_t)newlen); } #endif #endif diff --git a/compiler-rt/test/asan/TestCases/Posix/fread_fwrite.cc b/compiler-rt/test/asan/TestCases/Posix/fread_fwrite.cc index 640248860179..c0629260418a 100644 --- a/compiler-rt/test/asan/TestCases/Posix/fread_fwrite.cc +++ b/compiler-rt/test/asan/TestCases/Posix/fread_fwrite.cc @@ -1,9 +1,6 @@ // RUN: %clangxx_asan -g %s -o %t // RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-FWRITE // RUN: not %run %t 1 2>&1 | FileCheck %s --check-prefix=CHECK-FREAD -// -// On FreeBSD stack overflow error instead -// XFAIL: freebsd #include #include diff --git a/compiler-rt/test/asan/TestCases/Posix/tsd_dtor_leak.cc b/compiler-rt/test/asan/TestCases/Posix/tsd_dtor_leak.cc index 26109fe1a5f4..860f3459e5a8 100644 --- a/compiler-rt/test/asan/TestCases/Posix/tsd_dtor_leak.cc +++ b/compiler-rt/test/asan/TestCases/Posix/tsd_dtor_leak.cc @@ -3,8 +3,6 @@ // RUN: %clangxx_asan -O1 %s -pthread -o %t // RUN: %env_asan_opts=quarantine_size_mb=0 %run %t // XFAIL: x86_64-netbsd -// Assertion fails -// XFAIL: x86_64-freebsd #include #include #include diff --git a/compiler-rt/test/msan/tzset.cc b/compiler-rt/test/msan/tzset.cc index 86805cd56c5d..05915e047e15 100644 --- a/compiler-rt/test/msan/tzset.cc +++ b/compiler-rt/test/msan/tzset.cc @@ -1,5 +1,4 @@ // RUN: %clangxx_msan -O0 %s -o %t && %run %t -// XFAIL: freebsd #include #include