mirror of
https://github.com/hanzoai/datastore.git
synced 2026-09-26 13:55:07 +00:00
Previously, `<sanitizer/asan_interface.h>`, `<sanitizer/msan_interface.h>`, `<xray/xray_interface.h>` and similar headers were taken from the host compiler's resource directory. When sanitizers are enabled, XRay is disabled, so the include path added by `xray_instrumentation.cmake` was absent and the compiler's own headers were used silently. This change: - Adds `contrib/llvm-project/compiler-rt/include` as a global `-isystem` path in `cmake/sanitize.cmake` (which is always included). The compiler searches `-isystem` paths before its implicit resource directory, so our bundled headers take precedence without breaking `#include_next` chains that libcxx relies on. - Removes the now-redundant `include_directories` call from `cmake/xray_instrumentation.cmake`, which previously only covered the case when XRay was enabled. - Changes the default of `USE_SYSTEM_COMPILER_RT` from `ON` to `OFF` so that compiler-rt libraries are always built from our bundled source instead of whatever the host compiler ships. Related: https://github.com/ClickHouse/ClickHouse/issues/91475 Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
16 lines
677 B
CMake
16 lines
677 B
CMake
# https://llvm.org/docs/XRay.html
|
|
|
|
if (TARGET ch_contrib::llvm)
|
|
# The target clang must support XRay, otherwise it should error on invalid option
|
|
# Explicitly disable all XRay modes to avoid linking against xray-basic and xray-fdr.
|
|
# Emit instrumentation only for function-entry and function-exit.
|
|
set (XRAY_FLAGS "-fxray-instrument -fxray-modes=none -fxray-instrumentation-bundle=function")
|
|
set (USE_XRAY 1)
|
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${XRAY_FLAGS}")
|
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${XRAY_FLAGS}")
|
|
|
|
message (STATUS "Using LLVM XRay")
|
|
else()
|
|
message (STATUS "Not using LLVM XRay because LLVM is not built along")
|
|
endif()
|