Revert "[compiler-rt][Android] Stop using detect_target_arch"

This reverts commit 9b7e24c2a5.

See comments in https://reviews.llvm.org/D82148.
This commit is contained in:
Arthur Eubanks 2020-07-14 15:04:30 -07:00
parent 2b42080b51
commit bef00b244c
2 changed files with 57 additions and 5 deletions

View File

@ -151,6 +151,61 @@ macro(test_target_arch arch def)
endif()
endmacro()
macro(detect_target_arch)
check_symbol_exists(__arm__ "" __ARM)
check_symbol_exists(__aarch64__ "" __AARCH64)
check_symbol_exists(__x86_64__ "" __X86_64)
check_symbol_exists(__i386__ "" __I386)
check_symbol_exists(__mips__ "" __MIPS)
check_symbol_exists(__mips64__ "" __MIPS64)
check_symbol_exists(__powerpc64__ "" __PPC64)
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)
check_symbol_exists(__ve__ "" __VE)
if(__ARM)
add_default_target_arch(arm)
elseif(__AARCH64)
add_default_target_arch(aarch64)
elseif(__X86_64)
add_default_target_arch(x86_64)
elseif(__I386)
add_default_target_arch(i386)
elseif(__MIPS64) # must be checked before __MIPS
add_default_target_arch(mips64)
elseif(__MIPS)
add_default_target_arch(mips)
elseif(__PPC64)
add_default_target_arch(powerpc64)
elseif(__PPC64LE)
add_default_target_arch(powerpc64le)
elseif(__RISCV)
if(CMAKE_SIZEOF_VOID_P EQUAL "4")
add_default_target_arch(riscv32)
elseif(CMAKE_SIZEOF_VOID_P EQUAL "8")
add_default_target_arch(riscv64)
else()
message(FATAL_ERROR "Unsupport XLEN for RISC-V")
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)
add_default_target_arch(wasm64)
elseif(__VE)
add_default_target_arch(ve)
endif()
endmacro()
macro(load_llvm_config)
if (NOT LLVM_CONFIG_PATH)
find_program(LLVM_CONFIG_PATH "llvm-config"

View File

@ -163,11 +163,8 @@ macro(test_targets)
# Generate the COMPILER_RT_SUPPORTED_ARCH list.
if(ANDROID)
if(${COMPILER_RT_DEFAULT_TARGET_ARCH} STREQUAL "i686")
add_default_target_arch(i386)
else()
add_default_target_arch(${COMPILER_RT_DEFAULT_TARGET_ARCH})
endif()
# Examine compiler output to determine target architecture.
detect_target_arch()
set(COMPILER_RT_OS_SUFFIX "-android")
elseif(NOT APPLE) # Supported archs for Apple platforms are generated later
if(COMPILER_RT_DEFAULT_TARGET_ONLY)