From 305fdd72040244ed7b5a6024d7b87d9879e11896 Mon Sep 17 00:00:00 2001 From: Romain Thomas Date: Sun, 19 Apr 2026 12:10:59 +0200 Subject: [PATCH] Fix TSAN runtime library --- CMakeLists.txt | 2 -- api/python/CMakeLists.txt | 4 ++++ examples/cpp/CMakeLists.txt | 4 ++++ profiling/CMakeLists.txt | 4 ++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d507e77d0..1dc673984 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -345,8 +345,6 @@ if(LIEF_TSAN) list(APPEND SANITIZER_FLAGS -fsanitize=thread) target_link_options(LIB_LIEF PUBLIC -fsanitize=thread) - - target_link_libraries(LIB_LIEF INTERFACE tsan) endif() if(LIEF_USAN) diff --git a/api/python/CMakeLists.txt b/api/python/CMakeLists.txt index a0155b3a0..d73d24c52 100644 --- a/api/python/CMakeLists.txt +++ b/api/python/CMakeLists.txt @@ -135,6 +135,10 @@ if (LIEF_ASAN) target_link_libraries(pyLIEF INTERFACE libclang_rt.asan.so) endif() +if (LIEF_TSAN) + target_link_libraries(pyLIEF INTERFACE libclang_rt.tsan.so) +endif() + if (LIEF_PYTHON_STATIC) install(TARGETS nanobind-static pyLIEF DESTINATION lib/python-${Python_VERSION}) diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt index 6b144a677..d570f70e0 100644 --- a/examples/cpp/CMakeLists.txt +++ b/examples/cpp/CMakeLists.txt @@ -87,6 +87,10 @@ foreach(example ${LIEF_CPP_EXAMPLES}) target_link_libraries(${output_name} INTERFACE libclang_rt.asan.a) endif() + if (LIEF_TSAN) + target_link_libraries(${output_name} INTERFACE libclang_rt.tsan.a) + endif() + if (CMAKE_BUILD_TYPE MATCHES "Release") if (UNIX AND NOT APPLE) add_custom_command( diff --git a/profiling/CMakeLists.txt b/profiling/CMakeLists.txt index 12145b569..e0d4f989a 100644 --- a/profiling/CMakeLists.txt +++ b/profiling/CMakeLists.txt @@ -23,4 +23,8 @@ foreach(src_target ${SRC_TARGETS}) if (LIEF_ASAN) target_link_libraries(${output_name} INTERFACE libclang_rt.asan.a) endif() + + if (LIEF_TSAN) + target_link_libraries(${output_name} INTERFACE libclang_rt.tsan.a) + endif() endforeach()