[libcxx-commits] [libcxx] r368703 - [libc++] Always build with -fvisibility=hidden
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Aug 13 08:02:54 PDT 2019
Author: ldionne
Date: Tue Aug 13 08:02:53 2019
New Revision: 368703
URL: http://llvm.org/viewvc/llvm-project?rev=368703&view=rev
Log:
[libc++] Always build with -fvisibility=hidden
Summary:
This avoids symbols being accidentally exported from the dylib when they
shouldn't. The next step is to use a pragma to apply hidden visibility
to all declarations (unless otherwise specified), which will allow us
to drop the per-declaration hidden visibility attributes we currently
have.
This also has the nice side effect of making sure the dylib exports the
same symbols regardless of the optimization level.
PR38138
Reviewers: EricWF, mclow.lists
Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D62868
Modified:
libcxx/trunk/include/chrono
libcxx/trunk/include/filesystem
libcxx/trunk/src/CMakeLists.txt
libcxx/trunk/src/valarray.cpp
Modified: libcxx/trunk/include/chrono
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/chrono?rev=368703&r1=368702&r2=368703&view=diff
==============================================================================
--- libcxx/trunk/include/chrono (original)
+++ libcxx/trunk/include/chrono Tue Aug 13 08:02:53 2019
@@ -2934,6 +2934,7 @@ struct _FilesystemClock {
typedef chrono::duration<rep, period> duration;
typedef chrono::time_point<_FilesystemClock> time_point;
+ _LIBCPP_EXPORTED_FROM_ABI
static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = false;
_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS static time_point now() noexcept;
Modified: libcxx/trunk/include/filesystem
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/filesystem?rev=368703&r1=368702&r2=368703&view=diff
==============================================================================
--- libcxx/trunk/include/filesystem (original)
+++ libcxx/trunk/include/filesystem Tue Aug 13 08:02:53 2019
@@ -2583,6 +2583,7 @@ public:
void disable_recursion_pending() { __rec_ = false; }
private:
+ _LIBCPP_FUNC_VIS
recursive_directory_iterator(const path& __p, directory_options __opt,
error_code* __ec);
Modified: libcxx/trunk/src/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/CMakeLists.txt?rev=368703&r1=368702&r2=368703&view=diff
==============================================================================
--- libcxx/trunk/src/CMakeLists.txt (original)
+++ libcxx/trunk/src/CMakeLists.txt Tue Aug 13 08:02:53 2019
@@ -204,6 +204,7 @@ function(cxx_set_common_defines name)
if(LIBCXX_CXX_ABI_HEADER_TARGET)
add_dependencies(${name} ${LIBCXX_CXX_ABI_HEADER_TARGET})
endif()
+ target_compile_options(${name} PRIVATE -fvisibility=hidden)
if(WIN32 AND NOT MINGW)
target_compile_definitions(${name}
PRIVATE
@@ -355,7 +356,6 @@ if (LIBCXX_ENABLE_STATIC)
cxx_set_common_defines(cxx_static)
if (LIBCXX_HERMETIC_STATIC_LIBRARY)
- append_flags_if_supported(CXX_STATIC_LIBRARY_FLAGS -fvisibility=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.
Modified: libcxx/trunk/src/valarray.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/valarray.cpp?rev=368703&r1=368702&r2=368703&view=diff
==============================================================================
--- libcxx/trunk/src/valarray.cpp (original)
+++ libcxx/trunk/src/valarray.cpp Tue Aug 13 08:02:53 2019
@@ -12,8 +12,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// These two symbols are part of the v1 ABI but not part of the >=v2 ABI.
#if _LIBCPP_ABI_VERSION == 1
-template valarray<size_t>::valarray(size_t);
-template valarray<size_t>::~valarray();
+template _LIBCPP_FUNC_VIS valarray<size_t>::valarray(size_t);
+template _LIBCPP_FUNC_VIS valarray<size_t>::~valarray();
#endif
template void valarray<size_t>::resize(size_t, size_t);
More information about the libcxx-commits
mailing list