Based on patch from Alpine:
https://gitlab.alpinelinux.org/alpine/aports/-/blob/693203c42aa1cde88cb547173ef67a98824973fd/main/llvm-runtimes/compiler-rt-sanitizer-supported-arch.patch

Sanitizer code is broken on armhf, armv7, s390x, x86, and probably riscv64 on musl,
i.e. enable it only on x86_64, aarch64, and ppc64le.

--- a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
+++ b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
@@ -28,9 +28,13 @@
   set(ARM32 ${ARM32} armv7)
 endif()
 
+if (LIBCXX_HAS_MUSL_LIBC)
+set(ALL_SANITIZER_COMMON_SUPPORTED_ARCH ${X86_64} ${ARM64} ${PPC64})
+else()
 set(ALL_SANITIZER_COMMON_SUPPORTED_ARCH ${X86} ${X86_64} ${PPC64} ${RISCV64}
     ${ARM32} ${ARM64} ${MIPS32} ${MIPS64} ${S390X} ${SPARC} ${SPARCV9}
     ${HEXAGON} ${LOONGARCH64})
+endif()
 set(ALL_ASAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64}
     ${MIPS32} ${MIPS64} ${PPC64} ${S390X} ${SPARC} ${SPARCV9} ${HEXAGON}
     ${LOONGARCH64})
