[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 08:34:24 PDT 2019


ldionne updated this revision to Diff 222629.
ldionne added a comment.

Fix linker error with GCC


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
@@ -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/utils/libcxx/test/config.py
===================================================================
--- libcxx/utils/libcxx/test/config.py
+++ libcxx/utils/libcxx/test/config.py
@@ -761,6 +761,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.config.available_features.add('c++experimental')
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.222629.patch
Type: text/x-patch
Size: 2341 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20191001/cb74c7f8/attachment.bin>


More information about the libcxx-commits mailing list