2016-11-14 10:43:12 +08:00
|
|
|
|
2017-01-20 08:57:08 +08:00
|
|
|
if (DEFINED TARGET_TRIPLE)
|
2018-09-23 02:39:38 +08:00
|
|
|
if (TARGET_TRIPLE MATCHES "darwin")
|
|
|
|
# Ignore the major, minor, and patchlevel versions of darwin targets.
|
|
|
|
string(REGEX REPLACE "darwin[0-9]+\\.[0-9]+\\.[0-9]+" "darwin"
|
|
|
|
GENERIC_TARGET_TRIPLE "${TARGET_TRIPLE}")
|
|
|
|
elseif(TARGET_TRIPLE MATCHES "freebsd")
|
|
|
|
# Ignore the major and minor versions of freebsd targets.
|
|
|
|
string(REGEX REPLACE "freebsd[0-9]+\\.[0-9]+" "freebsd"
|
|
|
|
GENERIC_TARGET_TRIPLE "${TARGET_TRIPLE}")
|
|
|
|
else()
|
|
|
|
set(GENERIC_TARGET_TRIPLE "${TARGET_TRIPLE}")
|
|
|
|
endif()
|
2017-01-20 08:57:08 +08:00
|
|
|
endif()
|
|
|
|
|
2016-11-14 10:43:12 +08:00
|
|
|
# Detect if we are building in the same configuration used to generate
|
|
|
|
# the abilist files.
|
2018-07-20 02:02:50 +08:00
|
|
|
set(ABILIST_FILE "${CMAKE_CURRENT_LIST_DIR}/${GENERIC_TARGET_TRIPLE}.v${LIBCXX_ABI_VERSION}.abilist")
|
|
|
|
if (EXISTS "${ABILIST_FILE}"
|
2016-11-14 10:43:12 +08:00
|
|
|
AND TARGET cxx_shared
|
2016-11-14 11:03:13 +08:00
|
|
|
AND ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxabi" OR
|
2017-01-03 09:18:48 +08:00
|
|
|
(APPLE AND "${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "default"))
|
2020-04-20 17:22:20 +08:00
|
|
|
AND NOT LIBCXX_ABI_UNSTABLE
|
2020-10-01 02:58:17 +08:00
|
|
|
AND LIBCXX_ENABLE_EXCEPTIONS
|
[libc++] Define new/delete in libc++abi only by default
Previously, we would define new/delete in both libc++ and libc++abi.
Not only does this cause code bloat, but also it's technically an ODR
violation since we don't know which operator will be selected. Furthermore,
since those are weak definitions, we should strive to have as few of them
as possible (to improve load times).
My preferred choice would have been to put the operators in libc++ only
by default, however that would create a circular dependency between
libc++ and libc++abi, which GNU linkers don't handle.
Folks who want to ship new/delete in libc++ instead of libc++abi are
free to do so by turning on LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS at
CMake configure time.
On Apple platforms, this shouldn't be an ABI break because we re-export
the new/delete symbols from libc++abi. This change actually makes libc++
behave closer to the system libc++ shipped on Apple platforms.
On other platforms, this is an ABI break for people linking against libc++
but not libc++abi. However, vendors have been consulted in D68269 and no
objection was raised. Furthermore, the definitions can be controlled to
appear in libc++ instead with the CMake option.
Differential Revision: https://reviews.llvm.org/D68269
2019-10-01 21:34:58 +08:00
|
|
|
AND NOT LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS)
|
2016-11-14 10:43:12 +08:00
|
|
|
add_custom_target(check-cxx-abilist
|
2020-11-03 00:07:10 +08:00
|
|
|
${Python3_EXECUTABLE} "${LIBCXX_SOURCE_DIR}/utils/sym_diff.py"
|
|
|
|
--only-stdlib-symbols
|
|
|
|
--strict ${ABILIST_FILE}
|
|
|
|
$<TARGET_SONAME_FILE:cxx_shared>
|
2016-11-14 10:43:12 +08:00
|
|
|
DEPENDS cxx_shared
|
|
|
|
COMMENT "Testing ABI compatibility...")
|
2018-07-20 02:02:50 +08:00
|
|
|
else()
|
|
|
|
message(STATUS "there is no pre-generated ABI list for the requested libc++ configuration. "
|
|
|
|
"check-cxx-abilist target is not supported")
|
2016-11-14 10:43:12 +08:00
|
|
|
endif()
|