Skip to content

Commit 24d45d7

Browse files
committed
[CMake] Look for new libclang_rt.asan.so
Since a while now, Clang installs libclang_rt.asan.so in an architecture dependent directory.
1 parent 6e2a287 commit 24d45d7

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

cmake/modules/SetUpFreeBSD.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL Clang)
9393
if(asan)
9494
# See also core/sanitizer/README.md for what's happening.
9595
execute_process(COMMAND ${CMAKE_CXX_COMPILER} --print-file-name=libclang_rt.asan-x86_64.so OUTPUT_VARIABLE ASAN_RUNTIME_LIBRARY OUTPUT_STRIP_TRAILING_WHITESPACE)
96+
# Since a while now, Clang installs libclang_rt.asan.so in an architecture dependent directory.
97+
if(ASAN_RUNTIME_LIBRARY STREQUAL "libclang_rt.asan-x86_64.so")
98+
execute_process(COMMAND ${CMAKE_CXX_COMPILER} --print-file-name=libclang_rt.asan.so OUTPUT_VARIABLE ASAN_RUNTIME_LIBRARY OUTPUT_STRIP_TRAILING_WHITESPACE)
99+
endif()
96100
set(ASAN_EXTRA_CXX_FLAGS -fsanitize=address -fno-omit-frame-pointer -fsanitize-address-use-after-scope)
97101
set(ASAN_EXTRA_SHARED_LINKER_FLAGS "-fsanitize=address -static-libsan -z undefs")
98102
set(ASAN_EXTRA_EXE_LINKER_FLAGS "-fsanitize=address -static-libsan -z undefs -Wl,--undefined=__asan_default_options -Wl,--undefined=__lsan_default_options -Wl,--undefined=__lsan_default_suppressions")

cmake/modules/SetUpLinux.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL Clang)
106106
if(asan)
107107
# See also core/sanitizer/README.md for what's happening.
108108
execute_process(COMMAND ${CMAKE_CXX_COMPILER} --print-file-name=libclang_rt.asan-x86_64.so OUTPUT_VARIABLE ASAN_RUNTIME_LIBRARY OUTPUT_STRIP_TRAILING_WHITESPACE)
109+
# Since a while now, Clang installs libclang_rt.asan.so in an architecture dependent directory.
110+
if(ASAN_RUNTIME_LIBRARY STREQUAL "libclang_rt.asan-x86_64.so")
111+
execute_process(COMMAND ${CMAKE_CXX_COMPILER} --print-file-name=libclang_rt.asan.so OUTPUT_VARIABLE ASAN_RUNTIME_LIBRARY OUTPUT_STRIP_TRAILING_WHITESPACE)
112+
endif()
109113
set(ASAN_EXTRA_CXX_FLAGS -fsanitize=address -fno-omit-frame-pointer -fsanitize-address-use-after-scope)
110114
set(ASAN_EXTRA_SHARED_LINKER_FLAGS "-fsanitize=address -static-libsan -z undefs")
111115
set(ASAN_EXTRA_EXE_LINKER_FLAGS "-fsanitize=address -static-libsan -z undefs -Wl,--undefined=__asan_default_options -Wl,--undefined=__lsan_default_options -Wl,--undefined=__lsan_default_suppressions")

0 commit comments

Comments
 (0)