[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
Wed Sep 30 14:49:25 PDT 2020


ldionne updated this revision to Diff 295416.
ldionne added a comment.
Herald added a reviewer: libc++.
Herald added a project: libc++abi.
Herald added a reviewer: libc++abi.

Rebase on top of master.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68269/new/

https://reviews.llvm.org/D68269

Files:
  libcxx/docs/ReleaseNotes.rst
  libcxx/utils/libcxx/test/config.py
  libcxxabi/CMakeLists.txt


Index: libcxxabi/CMakeLists.txt
===================================================================
--- libcxxabi/CMakeLists.txt
+++ libcxxabi/CMakeLists.txt
@@ -72,13 +72,9 @@
 library to try comparing the type_info names to see if they are equal \
 instead." 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.
-# See https://reviews.llvm.org/D68269 for more details.
 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/utils/libcxx/test/config.py
===================================================================
--- libcxx/utils/libcxx/test/config.py
+++ libcxx/utils/libcxx/test/config.py
@@ -386,6 +386,10 @@
                 self.cxx.link_flags += ['-nostdlib']
             self.configure_link_flags_cxx_library()
             self.configure_link_flags_abi_library()
+            # With GCC's linker, re-linking libc++ after libc++abi is necessary
+            # since libc++abi depends on new/delete, which is provided in libc++.
+            # With other linkers, this is redundant but harmless.
+            self.configure_link_flags_cxx_library()
             self.configure_extra_library_flags()
         elif self.cxx_stdlib_under_test == 'libstdc++':
             self.cxx.link_flags += ['-lstdc++fs', '-lm', '-pthread']
Index: libcxx/docs/ReleaseNotes.rst
===================================================================
--- libcxx/docs/ReleaseNotes.rst
+++ libcxx/docs/ReleaseNotes.rst
@@ -42,4 +42,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.295416.patch
Type: text/x-patch
Size: 2353 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200930/577ea9ca/attachment.bin>


More information about the libcxx-commits mailing list