[PATCH] D119034: [TSan] Handle FreeBSD specific indirection of libpthread functions

Dmitry Vyukov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 4 23:27:04 PST 2022


dvyukov added inline comments.


================
Comment at: compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:294
 # define TSAN_INTERCEPT_VER(func, ver) INTERCEPT_FUNCTION(func)
-# define TSAN_MAYBE_INTERCEPT_NETBSD_ALIAS(func)
-# define TSAN_MAYBE_INTERCEPT_NETBSD_ALIAS_THR(func)
+#  define TSAN_MAYBE_INTERCEPT_FREEBSD_ALIAS(func) \
+    INTERCEPT_FUNCTION(_pthread_##func)
----------------
I think it's better to do these netbsd/freebsd-specific macros as:

    #if SANIFIZER_SOMEBSD
    #  define ... real definition...
    #else
    #  define ... empty definition
    #endif

I see how the current #elif-based structure makes sense for TSAN_INTERCEPT_VER, but it leads to duplication and easy to get wrong for macros that make sense for only 1 OS.




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119034/new/

https://reviews.llvm.org/D119034



More information about the llvm-commits mailing list