[libcxx] Link against android_support when needed
libc++ on Android needs to be linked against libandroid_support on API levels less than 21 to provide needed functions that aren't in the libc on those platforms (e.g. posix_memalign for libcxxabi). libc++ from the NDK is a linker script that pulls in libandroid_support, but for building libc++ itself, we need to explicitly add libandroid_support as a dependency. Moreover, libc++ headers reference the functions provided by libandroid_support, so it needs to be added as a public dependency. Differential Revision: https://reviews.llvm.org/D73516
This commit is contained in:
parent
d8f6950828
commit
076da521f3
|
|
@ -779,6 +779,10 @@ function(cxx_link_system_libraries target)
|
||||||
# (e.g. `printfw`/`scanfw`)
|
# (e.g. `printfw`/`scanfw`)
|
||||||
target_link_libraries(${target} PRIVATE iso_stdio_wide_specifiers)
|
target_link_libraries(${target} PRIVATE iso_stdio_wide_specifiers)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (ANDROID AND ANDROID_PLATFORM_LEVEL LESS 21)
|
||||||
|
target_link_libraries(${target} PUBLIC android_support)
|
||||||
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# Windows-related flags =======================================================
|
# Windows-related flags =======================================================
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,9 @@ if (MINGW)
|
||||||
# MINGW_LIBRARIES is defined in config-ix.cmake
|
# MINGW_LIBRARIES is defined in config-ix.cmake
|
||||||
list(APPEND LIBCXXABI_LIBRARIES ${MINGW_LIBRARIES})
|
list(APPEND LIBCXXABI_LIBRARIES ${MINGW_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
if (ANDROID AND ANDROID_PLATFORM_LEVEL LESS 21)
|
||||||
|
list(APPEND LIBCXXABI_LIBRARIES android_support)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (NOT LIBCXXABI_USE_COMPILER_RT)
|
if (NOT LIBCXXABI_USE_COMPILER_RT)
|
||||||
add_library_flags_if(LIBCXXABI_HAS_GCC_LIB gcc)
|
add_library_flags_if(LIBCXXABI_HAS_GCC_LIB gcc)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue