diff --git a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake --- a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake +++ b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake @@ -74,7 +74,7 @@ set(ALL_SCUDO_STANDALONE_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${MIPS32} ${MIPS64} ${PPC64} ${HEXAGON} ${LOONGARCH64} ${RISCV64}) if(APPLE) -set(ALL_XRAY_SUPPORTED_ARCH ${X86_64}) +set(ALL_XRAY_SUPPORTED_ARCH ${X86_64} ${ARM64}) else() set(ALL_XRAY_SUPPORTED_ARCH ${X86_64} ${ARM32} ${ARM64} ${MIPS32} ${MIPS64} powerpc64le ${HEXAGON}) diff --git a/compiler-rt/lib/xray/CMakeLists.txt b/compiler-rt/lib/xray/CMakeLists.txt --- a/compiler-rt/lib/xray/CMakeLists.txt +++ b/compiler-rt/lib/xray/CMakeLists.txt @@ -78,6 +78,19 @@ xray_trampoline_hexagon.S ) +set(XRAY_SOURCE_ARCHS + x86_64 + arm + armhf + aarch64 + mips + mipsel + mips64 + mips64el + powerpc64le + hexagon + ) + set(XRAY_IMPL_HEADERS xray_allocator.h xray_basic_flags.h @@ -171,19 +184,32 @@ endif() if (APPLE) - set(XRAY_ASM_SOURCES xray_trampoline_x86_64.S) - add_weak_symbols("sanitizer_common" WEAK_SYMBOL_LINK_FLAGS) add_weak_symbols("xray" WEAK_SYMBOL_LINK_FLAGS) add_compiler_rt_object_libraries(RTXray OS ${XRAY_SUPPORTED_OS} ARCHS ${XRAY_SUPPORTED_ARCH} - SOURCES ${XRAY_SOURCES} ${x86_64_SOURCES} + SOURCES ${XRAY_SOURCES} ADDITIONAL_HEADERS ${XRAY_IMPL_HEADERS} CFLAGS ${XRAY_CFLAGS} DEFS ${XRAY_COMMON_DEFINITIONS} DEPS ${XRAY_DEPS}) + set(XRAY_RTXRAY_ARCH_LIBS "") + foreach(arch ${XRAY_SUPPORTED_ARCH}) + if(NOT ${arch} IN_LIST XRAY_SOURCE_ARCHS) + continue() + endif() + add_compiler_rt_object_libraries(RTXray_${arch} + OS ${XRAY_SUPPORTED_OS} + ARCHS ${arch} + SOURCES ${${arch}_SOURCES} + ADDITIONAL_HEADERS ${XRAY_IMPL_HEADERS} + CFLAGS ${XRAY_CFLAGS} + DEFS ${XRAY_COMMON_DEFINITIONS} + DEPS ${XRAY_DEPS}) + list(APPEND XRAY_RTXRAY_ARCH_LIBS RTXray_${arch}) + endforeach() add_compiler_rt_object_libraries(RTXrayFDR OS ${XRAY_SUPPORTED_OS} ARCHS ${XRAY_SUPPORTED_ARCH} @@ -214,9 +240,7 @@ STATIC OS ${XRAY_SUPPORTED_OS} ARCHS ${XRAY_SUPPORTED_ARCH} - OBJECT_LIBS RTXray - RTSanitizerCommon - RTSanitizerCommonLibc + OBJECT_LIBS ${XRAY_COMMON_RUNTIME_OBJECT_LIBS} RTXray ${XRAY_RTXRAY_ARCH_LIBS} CFLAGS ${XRAY_CFLAGS} DEFS ${XRAY_COMMON_DEFINITIONS} LINK_FLAGS ${XRAY_LINK_FLAGS} ${WEAK_SYMBOL_LINK_FLAGS}