[PATCH] D61571: [libcxx] Don't use -fvisibility-global-new-delete-hidden when not defining them
Petr Hosek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun May 5 18:21:07 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL360003: [libcxx] Don't use -fvisibility-global-new-delete-hidden when not defining them (authored by phosek, committed by ).
Herald added a project: LLVM.
Changed prior to commit:
https://reviews.llvm.org/D61571?vs=198187&id=198207#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61571/new/
https://reviews.llvm.org/D61571
Files:
libcxx/trunk/src/CMakeLists.txt
llvm/trunk/utils/gn/secondary/libcxx/src/BUILD.gn
Index: libcxx/trunk/src/CMakeLists.txt
===================================================================
--- libcxx/trunk/src/CMakeLists.txt
+++ libcxx/trunk/src/CMakeLists.txt
@@ -349,7 +349,12 @@
if (LIBCXX_HERMETIC_STATIC_LIBRARY)
append_flags_if_supported(CXX_STATIC_LIBRARY_FLAGS -fvisibility=hidden)
- append_flags_if_supported(CXX_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 (LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS)
+ append_flags_if_supported(CXX_STATIC_LIBRARY_FLAGS -fvisibility-global-new-delete-hidden)
+ endif()
target_compile_options(cxx_static PRIVATE ${CXX_STATIC_LIBRARY_FLAGS})
target_compile_definitions(cxx_static PRIVATE _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
endif()
Index: llvm/trunk/utils/gn/secondary/libcxx/src/BUILD.gn
===================================================================
--- llvm/trunk/utils/gn/secondary/libcxx/src/BUILD.gn
+++ llvm/trunk/utils/gn/secondary/libcxx/src/BUILD.gn
@@ -84,6 +84,9 @@
"_CRT_STDIO_ISO_WIDE_SPECIFIERS",
]
}
+ if (!libcxx_enable_new_delete_definitions) {
+ defines += [ "_LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS" ]
+ }
if (libcxx_enable_exceptions) {
if (current_os == "win") {
cflags_cc += [ "/EHsc" ]
@@ -97,7 +100,7 @@
} else {
cflags_cc += [ "-fno-exceptions" ]
}
- defines += [ "-D_LIBCPP_NO_EXCEPTIONS" ]
+ defines += [ "_LIBCPP_NO_EXCEPTIONS" ]
}
if (!libcxx_enable_rtti) {
if (current_os == "win") {
@@ -105,7 +108,7 @@
} else {
cflags_cc += [ "-fno-rtti" ]
}
- defines += [ "-D_LIBCPP_NO_RTTI" ]
+ defines += [ "_LIBCPP_NO_RTTI" ]
}
}
@@ -251,7 +254,9 @@
sources = cxx_sources
if (libcxx_hermetic_static_library) {
cflags = [ "-fvisibility=hidden" ]
- cflags_cc = [ "-fvisibility-global-new-delete-hidden" ]
+ if (libcxx_enable_new_delete_definitions) {
+ cflags_cc = [ "-fvisibility-global-new-delete-hidden" ]
+ }
defines = [ "_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS" ]
}
deps = [
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61571.198207.patch
Type: text/x-patch
Size: 2294 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190506/4096e269/attachment.bin>
More information about the llvm-commits
mailing list