[libcxx-commits] [PATCH] D61572: [libcxxabi] Don't use -fvisibility-global-new-delete-hidden when not defining them

Petr Hosek via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun May 5 18:24:44 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL360004: [libcxxabi] Don't use -fvisibility-global-new-delete-hidden when not defining… (authored by phosek, committed by ).
Herald added a project: LLVM.

Changed prior to commit:
  https://reviews.llvm.org/D61572?vs=198188&id=198208#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D61572

Files:
  libcxxabi/trunk/src/CMakeLists.txt
  llvm/trunk/utils/gn/secondary/libcxxabi/src/BUILD.gn


Index: llvm/trunk/utils/gn/secondary/libcxxabi/src/BUILD.gn
===================================================================
--- llvm/trunk/utils/gn/secondary/libcxxabi/src/BUILD.gn
+++ llvm/trunk/utils/gn/secondary/libcxxabi/src/BUILD.gn
@@ -116,7 +116,9 @@
     public = cxxabi_headers
     if (libcxxabi_hermetic_static_library) {
       cflags = [ "-fvisibility=hidden" ]
-      cflags_cc = [ "-fvisibility-global-new-delete-hidden" ]
+      if (libcxxabi_enable_new_delete_definitions) {
+        cflags_cc = [ "-fvisibility-global-new-delete-hidden" ]
+      }
       defines = [
         "_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
         "_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
Index: libcxxabi/trunk/src/CMakeLists.txt
===================================================================
--- libcxxabi/trunk/src/CMakeLists.txt
+++ libcxxabi/trunk/src/CMakeLists.txt
@@ -206,7 +206,12 @@
 
   if(LIBCXXABI_HERMETIC_STATIC_LIBRARY)
     append_flags_if_supported(CXXABI_STATIC_LIBRARY_FLAGS -fvisibility=hidden)
-    append_flags_if_supported(CXXABI_STATIC_LIBRARY_FLAGS -fvisibility-global-new-delete-hidden)
+    # If the hermetic library doesn't define the operator new/delete functions
+    # then its code shouldn't declare them with hidden visibility.  They might
+    # actually be provided by a shared library at link time.
+    if (LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS)
+      append_flags_if_supported(CXXABI_STATIC_LIBRARY_FLAGS -fvisibility-global-new-delete-hidden)
+    endif()
     target_compile_options(cxxabi_static PRIVATE ${CXXABI_STATIC_LIBRARY_FLAGS})
     target_compile_definitions(cxxabi_static
       PRIVATE


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61572.198208.patch
Type: text/x-patch
Size: 1652 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190506/b292913b/attachment-0001.bin>


More information about the libcxx-commits mailing list