Index: compiler-rt/cmake/Modules/AddCompilerRT.cmake =================================================================== --- compiler-rt/cmake/Modules/AddCompilerRT.cmake +++ compiler-rt/cmake/Modules/AddCompilerRT.cmake @@ -77,6 +77,17 @@ list(REMOVE_ITEM target_flags "-msse3") endif() + # Build the macOS sanitizers with Mac Catalyst support. + if (APPLE AND + "${COMPILER_RT_ENABLE_MACCATALYST}" AND + "${libname}" MATCHES ".*\.osx.*") + foreach(arch ${LIB_ARCHS_${libname}}) + list(APPEND target_flags + -target ${arch}-apple-macos${DARWIN_osx_MIN_VER} + -darwin-target-variant ${arch}-apple-ios13.1-macabi) + endforeach() + endif() + set_target_compile_flags(${libname} ${extra_cflags_${libname}} ${target_flags}) set_property(TARGET ${libname} APPEND PROPERTY @@ -225,6 +236,21 @@ set(extra_link_flags_${libname} ${DARWIN_${os}_LINK_FLAGS} ${LIB_LINK_FLAGS}) endif() list_intersect(LIB_ARCHS_${libname} DARWIN_${os}_ARCHS LIB_ARCHS) + + # Build the macOS sanitizers with Mac Catalyst support. + if (APPLE AND + "${COMPILER_RT_ENABLE_MACCATALYST}" AND + "${os}" MATCHES "^(osx)$") + foreach(arch ${LIB_ARCHS_${libname}}) + list(APPEND LIB_CFLAGS + -target ${arch}-apple-macos${DARWIN_osx_MIN_VER} + -darwin-target-variant ${arch}-apple-ios13.1-macabi) + list(APPEND extra_link_flags_${libname} + -target ${arch}-apple-macos${DARWIN_osx_MIN_VER} + -darwin-target-variant ${arch}-apple-ios13.1-macabi) + endforeach() + endif() + if(LIB_ARCHS_${libname}) list(APPEND libnames ${libname}) set(extra_cflags_${libname} ${DARWIN_${os}_CFLAGS} ${NO_LTO_FLAGS} ${NO_PGO_FLAGS} ${LIB_CFLAGS})