[libcxx-commits] [PATCH] D68269: [libc++abi] Do not define new/delete by default

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Oct 1 07:01:34 PDT 2019


ldionne created this revision.
ldionne added a reviewer: EricWF.
Herald added subscribers: libcxx-commits, dexonsmith, jkorous, christof, mgorny.
Herald added a project: libc++.

As the removed comment says, definitions of new/delete are normally
provided in libc++, so it doesn't make sense to provide them in
libc++abi unless requested explicitly.

It appears the only thing preventing us from switching the default to
OFF was GCC 4.9, which we don't support anymore. Vendors wishing to
keep shipping new/delete in libc++abi can do so by asking for it
explicitly when building libc++abi.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68269

Files:
  libcxx/docs/ReleaseNotes.rst
  libcxxabi/CMakeLists.txt


Index: libcxxabi/CMakeLists.txt
===================================================================
--- libcxxabi/CMakeLists.txt
+++ libcxxabi/CMakeLists.txt
@@ -62,12 +62,9 @@
   "Build libc++abi with an externalized threading library.
    This option may only be set to ON when LIBCXXABI_ENABLE_THREADS=ON" OFF)
 
-# FIXME: This option should default to off. Unfortunatly GCC 4.9 fails to link
-# programs to due undefined references to new/delete in libc++abi. Once this
-# has been fixed or worked around the default value should be changed.
 option(LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS
     "Build libc++abi with definitions for operator new/delete. Normally libc++
-    provides these definitions" ON)
+    provides these definitions" OFF)
 option(LIBCXXABI_BUILD_32_BITS "Build 32 bit libc++abi." ${LLVM_BUILD_32_BITS})
 option(LIBCXXABI_INCLUDE_TESTS "Generate build targets for the libc++abi unit tests." ${LLVM_INCLUDE_TESTS})
 set(LIBCXXABI_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING
Index: libcxx/docs/ReleaseNotes.rst
===================================================================
--- libcxx/docs/ReleaseNotes.rst
+++ libcxx/docs/ReleaseNotes.rst
@@ -40,4 +40,8 @@
 
 API Changes
 -----------
-- ...
+- By default, libc++abi will not include the definition for new and delete,
+  since those are provided in libc++. Vendors wishing to provide new and
+  delete in libc++abi can build the library with ``-DLIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS=ON``
+  to get back the old behavior.
+


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68269.222602.patch
Type: text/x-patch
Size: 1514 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20191001/693fe246/attachment.bin>


More information about the libcxx-commits mailing list