[libcxx][libcxxabi][libunwind] Use libgcc on Android
Android doesn't have a libgcc_s and uses libgcc instead, so adjust the build accordingly. This matches compiler-rt's build setup. libc++abi and libunwind were already checking for libgcc but in a different context. This change makes them search only for libgcc on Android now, but the code to link against libgcc if it were present was already there. Reviewed By: #libc, #libc_abi, #libunwind, rprichard, srhines Differential Revision: https://reviews.llvm.org/D78787
This commit is contained in:
parent
c14ac8043e
commit
cc259638cb
|
@ -757,6 +757,8 @@ function(cxx_link_system_libraries target)
|
||||||
if (LIBCXX_BUILTINS_LIBRARY)
|
if (LIBCXX_BUILTINS_LIBRARY)
|
||||||
target_link_libraries(${target} PRIVATE "${LIBCXX_BUILTINS_LIBRARY}")
|
target_link_libraries(${target} PRIVATE "${LIBCXX_BUILTINS_LIBRARY}")
|
||||||
endif()
|
endif()
|
||||||
|
elseif (LIBCXX_HAS_GCC_LIB)
|
||||||
|
target_link_libraries(${target} PRIVATE gcc)
|
||||||
elseif (LIBCXX_HAS_GCC_S_LIB)
|
elseif (LIBCXX_HAS_GCC_S_LIB)
|
||||||
target_link_libraries(${target} PRIVATE gcc_s)
|
target_link_libraries(${target} PRIVATE gcc_s)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -15,9 +15,13 @@ endif()
|
||||||
if (NOT LIBCXX_USE_COMPILER_RT)
|
if (NOT LIBCXX_USE_COMPILER_RT)
|
||||||
if(WIN32 AND NOT MINGW)
|
if(WIN32 AND NOT MINGW)
|
||||||
set(LIBCXX_HAS_GCC_S_LIB NO)
|
set(LIBCXX_HAS_GCC_S_LIB NO)
|
||||||
|
else()
|
||||||
|
if(ANDROID)
|
||||||
|
check_library_exists(gcc __gcc_personality_v0 "" LIBCXX_HAS_GCC_LIB)
|
||||||
else()
|
else()
|
||||||
check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
|
check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# libc++ is built with -nodefaultlibs, so we want all our checks to also
|
# libc++ is built with -nodefaultlibs, so we want all our checks to also
|
||||||
|
@ -37,6 +41,8 @@ if (LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
|
||||||
list(APPEND CMAKE_REQUIRED_FLAGS -rtlib=compiler-rt)
|
list(APPEND CMAKE_REQUIRED_FLAGS -rtlib=compiler-rt)
|
||||||
find_compiler_rt_library(builtins LIBCXX_BUILTINS_LIBRARY)
|
find_compiler_rt_library(builtins LIBCXX_BUILTINS_LIBRARY)
|
||||||
list(APPEND CMAKE_REQUIRED_LIBRARIES "${LIBCXX_BUILTINS_LIBRARY}")
|
list(APPEND CMAKE_REQUIRED_LIBRARIES "${LIBCXX_BUILTINS_LIBRARY}")
|
||||||
|
elseif (LIBCXX_HAS_GCC_LIB)
|
||||||
|
list(APPEND CMAKE_REQUIRED_LIBRARIES gcc)
|
||||||
elseif (LIBCXX_HAS_GCC_S_LIB)
|
elseif (LIBCXX_HAS_GCC_S_LIB)
|
||||||
list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s)
|
list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
|
@ -6,8 +6,12 @@ include(CheckCSourceCompiles)
|
||||||
|
|
||||||
check_library_exists(c fopen "" LIBCXXABI_HAS_C_LIB)
|
check_library_exists(c fopen "" LIBCXXABI_HAS_C_LIB)
|
||||||
if (NOT LIBCXXABI_USE_COMPILER_RT)
|
if (NOT LIBCXXABI_USE_COMPILER_RT)
|
||||||
|
if (ANDROID)
|
||||||
|
check_library_exists(gcc __gcc_personality_v0 "" LIBCXXABI_HAS_GCC_LIB)
|
||||||
|
else ()
|
||||||
check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXXABI_HAS_GCC_S_LIB)
|
check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXXABI_HAS_GCC_S_LIB)
|
||||||
check_library_exists(gcc __aeabi_uldivmod "" LIBCXXABI_HAS_GCC_LIB)
|
check_library_exists(gcc __aeabi_uldivmod "" LIBCXXABI_HAS_GCC_LIB)
|
||||||
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# libc++abi is built with -nodefaultlibs, so we want all our checks to also
|
# libc++abi is built with -nodefaultlibs, so we want all our checks to also
|
||||||
|
|
|
@ -8,8 +8,12 @@ include(CheckCSourceCompiles)
|
||||||
check_library_exists(c fopen "" LIBUNWIND_HAS_C_LIB)
|
check_library_exists(c fopen "" LIBUNWIND_HAS_C_LIB)
|
||||||
|
|
||||||
if (NOT LIBUNWIND_USE_COMPILER_RT)
|
if (NOT LIBUNWIND_USE_COMPILER_RT)
|
||||||
|
if (ANDROID)
|
||||||
|
check_library_exists(gcc __gcc_personality_v0 "" LIBUNWIND_HAS_GCC_LIB)
|
||||||
|
else ()
|
||||||
check_library_exists(gcc_s __gcc_personality_v0 "" LIBUNWIND_HAS_GCC_S_LIB)
|
check_library_exists(gcc_s __gcc_personality_v0 "" LIBUNWIND_HAS_GCC_S_LIB)
|
||||||
check_library_exists(gcc __absvdi2 "" LIBUNWIND_HAS_GCC_LIB)
|
check_library_exists(gcc __absvdi2 "" LIBUNWIND_HAS_GCC_LIB)
|
||||||
|
endif ()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# libunwind is built with -nodefaultlibs, so we want all our checks to also
|
# libunwind is built with -nodefaultlibs, so we want all our checks to also
|
||||||
|
|
Loading…
Reference in New Issue