Index: cmake/Modules/CompilerRTUtils.cmake =================================================================== --- cmake/Modules/CompilerRTUtils.cmake +++ cmake/Modules/CompilerRTUtils.cmake @@ -162,6 +162,8 @@ check_symbol_exists(__powerpc64le__ "" __PPC64LE) check_symbol_exists(__riscv "" __RISCV) check_symbol_exists(__s390x__ "" __S390X) + check_symbol_exists(__sparc "" __SPARC) + check_symbol_exists(__sparcv9 "" __SPARCV9) check_symbol_exists(__wasm32__ "" __WEBASSEMBLY32) check_symbol_exists(__wasm64__ "" __WEBASSEMBLY64) if(__ARM) @@ -190,6 +192,10 @@ endif() elseif(__S390X) add_default_target_arch(s390x) + elseif(__SPARCV9) + add_default_target_arch(sparcv9) + elseif(__SPARC) + add_default_target_arch(sparc) elseif(__WEBASSEMBLY32) add_default_target_arch(wasm32) elseif(__WEBASSEMBLY64) Index: cmake/base-config-ix.cmake =================================================================== --- cmake/base-config-ix.cmake +++ cmake/base-config-ix.cmake @@ -185,6 +185,9 @@ endif() elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "s390x") test_target_arch(s390x "" "") + elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "sparc") + test_target_arch(sparc "" "-m32") + test_target_arch(sparcv9 "" "-m64") elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "mipsel|mips64el") # Gcc doesn't accept -m32/-m64 so we do the next best thing and use # -mips32r2/-mips64r2. We don't use -mips1/-mips3 because we want to match Index: cmake/builtin-config-ix.cmake =================================================================== --- cmake/builtin-config-ix.cmake +++ cmake/builtin-config-ix.cmake @@ -33,6 +33,8 @@ set(PPC64 powerpc64 powerpc64le) set(RISCV32 riscv32) set(RISCV64 riscv64) +set(SPARC sparc) +set(SPARCV9 sparcv9) set(WASM32 wasm32) set(WASM64 wasm64) @@ -43,7 +45,7 @@ endif() set(ALL_BUILTIN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} - ${HEXAGON} ${MIPS32} ${MIPS64} ${PPC64} ${RISCV32} ${RISCV64} ${WASM32} ${WASM64}) + ${HEXAGON} ${MIPS32} ${MIPS64} ${PPC64} ${RISCV32} ${RISCV64} ${SPARC} ${SPARCV9} ${WASM32} ${WASM64}) include(CompilerRTUtils) include(CompilerRTDarwinUtils) Index: cmake/config-ix.cmake =================================================================== --- cmake/config-ix.cmake +++ cmake/config-ix.cmake @@ -219,6 +219,8 @@ set(RISCV32 riscv32) set(RISCV64 riscv64) set(S390X s390x) +set(SPARC sparc) +set(SPARCV9 sparcv9) set(WASM32 wasm32) set(WASM64 wasm64) @@ -229,9 +231,9 @@ endif() set(ALL_SANITIZER_COMMON_SUPPORTED_ARCH ${X86} ${X86_64} ${PPC64} - ${ARM32} ${ARM64} ${MIPS32} ${MIPS64} ${S390X}) + ${ARM32} ${ARM64} ${MIPS32} ${MIPS64} ${S390X} ${SPARC} ${SPARCV9}) set(ALL_ASAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} - ${MIPS32} ${MIPS64} ${PPC64} ${S390X}) + ${MIPS32} ${MIPS64} ${PPC64} ${S390X} ${SPARC} ${SPARCV9}) set(ALL_CRT_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64}) set(ALL_DFSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64}) @@ -256,10 +258,10 @@ set(ALL_MSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64} ${PPC64}) set(ALL_HWASAN_SUPPORTED_ARCH ${X86_64} ${ARM64}) set(ALL_PROFILE_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${PPC64} - ${MIPS32} ${MIPS64} ${S390X}) + ${MIPS32} ${MIPS64} ${S390X} ${SPARC} ${SPARCV9}) set(ALL_TSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64} ${PPC64}) set(ALL_UBSAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} - ${MIPS32} ${MIPS64} ${PPC64} ${S390X}) + ${MIPS32} ${MIPS64} ${PPC64} ${S390X} ${SPARC} ${SPARCV9}) set(ALL_SAFESTACK_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM64} ${MIPS32} ${MIPS64}) set(ALL_CFI_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${MIPS64}) set(ALL_SCUDO_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${MIPS32} ${MIPS64} ${PPC64}) Index: lib/asan/tests/CMakeLists.txt =================================================================== --- lib/asan/tests/CMakeLists.txt +++ lib/asan/tests/CMakeLists.txt @@ -227,6 +227,7 @@ if(APPLE) darwin_filter_host_archs(ASAN_SUPPORTED_ARCH ASAN_TEST_ARCH) endif() + list(REMOVE_ITEM ASAN_TEST_ARCH sparc sparcv9) if(OS_NAME MATCHES "SunOS") list(REMOVE_ITEM ASAN_TEST_ARCH x86_64) endif() Index: lib/builtins/CMakeLists.txt =================================================================== --- lib/builtins/CMakeLists.txt +++ lib/builtins/CMakeLists.txt @@ -556,6 +556,9 @@ ) set(riscv64_SOURCES ${riscv_SOURCES}) +set(sparc_SOURCES ${GENERIC_SOURCES} ${GENERIC_TF_SOURCES}) +set(sparcv9_SOURCES ${GENERIC_SOURCES} ${GENERIC_TF_SOURCES}) + set(wasm32_SOURCES ${GENERIC_TF_SOURCES} ${GENERIC_SOURCES} Index: lib/builtins/fp_lib.h =================================================================== --- lib/builtins/fp_lib.h +++ lib/builtins/fp_lib.h @@ -100,7 +100,7 @@ COMPILER_RT_ABI fp_t __adddf3(fp_t a, fp_t b); #elif defined QUAD_PRECISION -#if __LDBL_MANT_DIG__ == 113 +#if __LDBL_MANT_DIG__ == 113 && defined(__SIZEOF_INT128__) #define CRT_LDBL_128BIT typedef __uint128_t rep_t; typedef __int128_t srep_t; @@ -193,7 +193,7 @@ #undef Word_HiMask #undef Word_LoMask #undef Word_FullMask -#endif // __LDBL_MANT_DIG__ == 113 +#endif // __LDBL_MANT_DIG__ == 113 && __SIZEOF_INT128__ #else #error SINGLE_PRECISION, DOUBLE_PRECISION or QUAD_PRECISION must be defined. #endif Index: test/asan/CMakeLists.txt =================================================================== --- test/asan/CMakeLists.txt +++ test/asan/CMakeLists.txt @@ -18,9 +18,9 @@ endif() macro(get_bits_for_arch arch bits) - if (${arch} MATCHES "x86_64|powerpc64|powerpc64le|aarch64|arm64|mips64|mips64el|s390x") + if (${arch} MATCHES "x86_64|powerpc64|powerpc64le|aarch64|arm64|mips64|mips64el|s390x|sparcv9") set(${bits} 64) - elseif (${arch} MATCHES "i386|arm|mips|mipsel") + elseif (${arch} MATCHES "i386|arm|mips|mipsel|sparc") set(${bits} 32) else() message(FATAL_ERROR "Unknown target architecture: ${arch}") @@ -40,6 +40,7 @@ if(APPLE) darwin_filter_host_archs(ASAN_SUPPORTED_ARCH ASAN_TEST_ARCH) endif() +list(REMOVE_ITEM ASAN_TEST_ARCH sparc sparcv9) if(OS_NAME MATCHES "SunOS") list(REMOVE_ITEM ASAN_TEST_ARCH x86_64) endif() Index: test/ubsan/CMakeLists.txt =================================================================== --- test/ubsan/CMakeLists.txt +++ test/ubsan/CMakeLists.txt @@ -46,10 +46,11 @@ if(COMPILER_RT_HAS_ASAN AND ";${ASAN_SUPPORTED_ARCH};" MATCHES ";${arch};") # TODO(wwchrome): Re-enable ubsan for asan win 64-bit when ready. - # Disable ubsan with AddressSanitizer tests for Windows 64-bit and - # 64-bit Solaris/x86. + # Disable ubsan with AddressSanitizer tests for Windows 64-bit, + # 64-bit Solaris/x86, and SPARC. if((NOT (OS_NAME MATCHES "Windows" AND CMAKE_SIZEOF_VOID_P EQUAL 8)) AND - (NOT (OS_NAME MATCHES "SunOS" AND ${arch} MATCHES x86_64))) + (NOT (OS_NAME MATCHES "SunOS" AND ${arch} MATCHES x86_64)) AND + (NOT ${arch} MATCHES sparc)) add_ubsan_testsuites("AddressSanitizer" asan ${arch}) endif() endif()