[llvm-branch-commits] [libcxx] d14016d - Define new/delete in libc++ when using libcxxrt
Tom Stellard via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Feb 15 13:54:02 PST 2021
Author: Dimitry Andric
Date: 2021-02-15T13:53:42-08:00
New Revision: d14016d869acac0d0196bd6b846ab45879ea0fa5
URL: https://github.com/llvm/llvm-project/commit/d14016d869acac0d0196bd6b846ab45879ea0fa5
DIFF: https://github.com/llvm/llvm-project/commit/d14016d869acac0d0196bd6b846ab45879ea0fa5.diff
LOG: Define new/delete in libc++ when using libcxxrt
Always turn on LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS, if libcxxrt is used
as the C++ ABI library, since libcxxrt does not provide the full set
ofnew and delete operators. In particular, the aligned versions of these
operators are completely missing. This primarily addresses builds on
FreeBSD, as this platform uses libcxxrt by default.
Also, attempt to provide a FreeBSD.cmake cache file, with hopefully sane
settings, partially copied from the Apple.cmake cache file. This needs
more work, probably some additions to ci build scripts (although I am
not aware of any 'official' FreeBSD build bots).
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D96720
(cherry picked from commit 328261019f50a76b11fa625739cbf32ceb2ce2f7)
Added:
libcxx/cmake/caches/FreeBSD.cmake
Modified:
libcxx/cmake/Modules/HandleLibCXXABI.cmake
Removed:
################################################################################
diff --git a/libcxx/cmake/Modules/HandleLibCXXABI.cmake b/libcxx/cmake/Modules/HandleLibCXXABI.cmake
index c5aa26739e36..5d2764e870e9 100644
--- a/libcxx/cmake/Modules/HandleLibCXXABI.cmake
+++ b/libcxx/cmake/Modules/HandleLibCXXABI.cmake
@@ -121,6 +121,8 @@ elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxrt")
if(NOT LIBCXX_CXX_ABI_INCLUDE_PATHS)
set(LIBCXX_CXX_ABI_INCLUDE_PATHS "/usr/include/c++/v1")
endif()
+ # libcxxrt does not provide aligned new and delete operators
+ set(LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS ON)
setup_abi_lib(
"-DLIBCXXRT"
"cxxrt" "cxxrt" "cxxabi.h;unwind.h;unwind-arm.h;unwind-itanium.h" ""
diff --git a/libcxx/cmake/caches/FreeBSD.cmake b/libcxx/cmake/caches/FreeBSD.cmake
new file mode 100644
index 000000000000..9e66e379864b
--- /dev/null
+++ b/libcxx/cmake/caches/FreeBSD.cmake
@@ -0,0 +1,9 @@
+set(CMAKE_BUILD_TYPE Release CACHE STRING "")
+set(CMAKE_POSITION_INDEPENDENT_CODE ON CACHE BOOL "")
+
+set(LIBCXX_ENABLE_ASSERTIONS OFF CACHE BOOL "")
+set(LIBCXX_ABI_VERSION "1" CACHE STRING "")
+set(LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
+set(LIBCXX_ENABLE_SHARED ON CACHE BOOL "")
+set(LIBCXX_CXX_ABI libcxxrt CACHE STRING "")
+set(LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS ON CACHE BOOL "")
More information about the llvm-branch-commits
mailing list