[libcxx] r347395 - [libcxx] Make sure we can build with -fvisibility=hidden on Linux
Louis Dionne
ldionne at apple.com
Wed Nov 21 08:24:46 PST 2018
Author: ldionne
Date: Wed Nov 21 08:24:46 2018
New Revision: 347395
URL: http://llvm.org/viewvc/llvm-project?rev=347395&view=rev
Log:
[libcxx] Make sure we can build with -fvisibility=hidden on Linux
Summary:
This commit marks a few functions as hidden and removes them from the ABI list
on Linux such that libc++ can be built with -fvisibility=hidden. The functions
marked as hidden by this patch were exported from the shared object only
because they were implicitly instantiated function templates. It is safe
to stop exporting those symbols from the shared object because nobody could
actually depend on them: implicit instantiations are not taken from shared
objects.
The symbols removed in this commit are basically the same that had been
removed in https://reviews.llvm.org/D53868, but that patch had to be reverted
because it broke the build (because the functions were not marked as hidden
like this patch does).
Reviewers: EricWF, mclow.lists
Subscribers: christof, jkorous, dexonsmith, libcxx-commits
Differential Revision: https://reviews.llvm.org/D54639
Modified:
libcxx/trunk/include/algorithm
libcxx/trunk/include/locale
libcxx/trunk/include/string
libcxx/trunk/lib/abi/CHANGELOG.TXT
libcxx/trunk/lib/abi/x86_64-unknown-linux-gnu.v1.abilist
Modified: libcxx/trunk/include/algorithm
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/algorithm?rev=347395&r1=347394&r2=347395&view=diff
==============================================================================
--- libcxx/trunk/include/algorithm (original)
+++ libcxx/trunk/include/algorithm Wed Nov 21 08:24:46 2018
@@ -3611,6 +3611,7 @@ __sort4(_ForwardIterator __x1, _ForwardI
// stable, 4-10 compares, 0-9 swaps
template <class _Compare, class _ForwardIterator>
+_LIBCPP_HIDDEN
unsigned
__sort5(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3,
_ForwardIterator __x4, _ForwardIterator __x5, _Compare __c)
Modified: libcxx/trunk/include/locale
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/locale?rev=347395&r1=347394&r2=347395&view=diff
==============================================================================
--- libcxx/trunk/include/locale (original)
+++ libcxx/trunk/include/locale Wed Nov 21 08:24:46 2018
@@ -727,7 +727,7 @@ locale::id
num_get<_CharT, _InputIterator>::id;
template <class _Tp>
-_Tp
+_LIBCPP_HIDDEN _Tp
__num_get_signed_integral(const char* __a, const char* __a_end,
ios_base::iostate& __err, int __base)
{
@@ -762,7 +762,7 @@ __num_get_signed_integral(const char* __
}
template <class _Tp>
-_Tp
+_LIBCPP_HIDDEN _Tp
__num_get_unsigned_integral(const char* __a, const char* __a_end,
ios_base::iostate& __err, int __base)
{
Modified: libcxx/trunk/include/string
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=347395&r1=347394&r2=347395&view=diff
==============================================================================
--- libcxx/trunk/include/string (original)
+++ libcxx/trunk/include/string Wed Nov 21 08:24:46 2018
@@ -4036,6 +4036,7 @@ operator+(_CharT __lhs, const basic_stri
}
template<class _CharT, class _Traits, class _Allocator>
+_LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, _Traits, _Allocator>
operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs)
{
Modified: libcxx/trunk/lib/abi/CHANGELOG.TXT
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/abi/CHANGELOG.TXT?rev=347395&r1=347394&r2=347395&view=diff
==============================================================================
--- libcxx/trunk/lib/abi/CHANGELOG.TXT (original)
+++ libcxx/trunk/lib/abi/CHANGELOG.TXT Wed Nov 21 08:24:46 2018
@@ -16,7 +16,44 @@ New entries should be added directly bel
Version 8.0
-----------
-* r345260 - Making libc++ build under -fvisibility=hidden
+* rXXXXXX - Making libc++ build under -fvisibility=hidden on Linux
+
+ The change marks several function templates as hidden. This removes symbols
+ from the shared library, but this is not an ABI break because it's impossible
+ for programs linking against libc++.so to actually depend on that symbol.
+ The reason is that the symbol is exported from the shared library through
+ an implicit instantiation present in the shared object itself only. Furthermore,
+ if a user's shared object was implicitly instantiating one of these functions,
+ marking that symbol as hidden would not be an ABI break for them because none
+ of their users could actually be using the symbol in their dylib (because
+ it's an implicit instantiation).
+
+ x86_64-linux-gnu
+ ----------------
+ Symbol removed: _ZNSt3__125__num_get_signed_integralIlEET_PKcS3_Rji
+ Symbol removed: _ZNSt3__125__num_get_signed_integralIxEET_PKcS3_Rji
+ Symbol removed: _ZNSt3__127__num_get_unsigned_integralIjEET_PKcS3_Rji
+ Symbol removed: _ZNSt3__127__num_get_unsigned_integralImEET_PKcS3_Rji
+ Symbol removed: _ZNSt3__127__num_get_unsigned_integralItEET_PKcS3_Rji
+ Symbol removed: _ZNSt3__127__num_get_unsigned_integralIyEET_PKcS3_Rji
+ Symbol removed: _ZNSt3__17__sort5IRNS_6__lessIaaEEPaEEjT0_S5_S5_S5_S5_T_
+ Symbol removed: _ZNSt3__17__sort5IRNS_6__lessIccEEPcEEjT0_S5_S5_S5_S5_T_
+ Symbol removed: _ZNSt3__17__sort5IRNS_6__lessIddEEPdEEjT0_S5_S5_S5_S5_T_
+ Symbol removed: _ZNSt3__17__sort5IRNS_6__lessIffEEPfEEjT0_S5_S5_S5_S5_T_
+ Symbol removed: _ZNSt3__17__sort5IRNS_6__lessIhhEEPhEEjT0_S5_S5_S5_S5_T_
+ Symbol removed: _ZNSt3__17__sort5IRNS_6__lessIiiEEPiEEjT0_S5_S5_S5_S5_T_
+ Symbol removed: _ZNSt3__17__sort5IRNS_6__lessIjjEEPjEEjT0_S5_S5_S5_S5_T_
+ Symbol removed: _ZNSt3__17__sort5IRNS_6__lessIllEEPlEEjT0_S5_S5_S5_S5_T_
+ Symbol removed: _ZNSt3__17__sort5IRNS_6__lessImmEEPmEEjT0_S5_S5_S5_S5_T_
+ Symbol removed: _ZNSt3__17__sort5IRNS_6__lessIssEEPsEEjT0_S5_S5_S5_S5_T_
+ Symbol removed: _ZNSt3__17__sort5IRNS_6__lessIttEEPtEEjT0_S5_S5_S5_S5_T_
+ Symbol removed: _ZNSt3__17__sort5IRNS_6__lessIwwEEPwEEjT0_S5_S5_S5_S5_T_
+ Symbol removed: _ZNSt3__17__sort5IRNS_6__lessIxxEEPxEEjT0_S5_S5_S5_S5_T_
+ Symbol removed: _ZNSt3__17__sort5IRNS_6__lessIyyEEPyEEjT0_S5_S5_S5_S5_T_
+ Symbol removed: _ZNSt3__1plIcNS_11char_traitsIcEENS_9allocatorIcEEEENS_12basic_stringIT_T0_T1_EERKS9_PKS6_
+ Symbol removed: _ZSt18make_exception_ptrINSt3__112future_errorEESt13exception_ptrT_
+
+* r345260 - Making libc++ build under -fvisibility=hidden on Mac OS
The change marks __thread_specific_ptr<__thread_struct>::__at_thread_exit(void*)
with hidden visibility. This removes a symbol from the shared libraries,
Modified: libcxx/trunk/lib/abi/x86_64-unknown-linux-gnu.v1.abilist
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/abi/x86_64-unknown-linux-gnu.v1.abilist?rev=347395&r1=347394&r2=347395&view=diff
==============================================================================
--- libcxx/trunk/lib/abi/x86_64-unknown-linux-gnu.v1.abilist (original)
+++ libcxx/trunk/lib/abi/x86_64-unknown-linux-gnu.v1.abilist Wed Nov 21 08:24:46 2018
@@ -1123,8 +1123,6 @@
{'name': '_ZNSt3__124__libcpp_debug_exceptionD0Ev', 'is_defined': True, 'type': 'FUNC'}
{'name': '_ZNSt3__124__libcpp_debug_exceptionD1Ev', 'is_defined': True, 'type': 'FUNC'}
{'name': '_ZNSt3__124__libcpp_debug_exceptionD2Ev', 'is_defined': True, 'type': 'FUNC'}
-{'name': '_ZNSt3__125__num_get_signed_integralIlEET_PKcS3_Rji', 'is_defined': True, 'type': 'FUNC'}
-{'name': '_ZNSt3__125__num_get_signed_integralIxEET_PKcS3_Rji', 'is_defined': True, 'type': 'FUNC'}
{'name': '_ZNSt3__125notify_all_at_thread_exitERNS_18condition_variableENS_11unique_lockINS_5mutexEEE', 'is_defined': True, 'type': 'FUNC'}
{'name': '_ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIaaEEPaEEbT0_S5_T_', 'is_defined': True, 'type': 'FUNC'}
{'name': '_ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIccEEPcEEbT0_S5_T_', 'is_defined': True, 'type': 'FUNC'}
@@ -1142,10 +1140,6 @@
{'name': '_ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIxxEEPxEEbT0_S5_T_', 'is_defined': True, 'type': 'FUNC'}
{'name': '_ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIyyEEPyEEbT0_S5_T_', 'is_defined': True, 'type': 'FUNC'}
{'name': '_ZNSt3__127__libcpp_set_debug_functionEPFvRKNS_19__libcpp_debug_infoEE', 'is_defined': True, 'type': 'FUNC'}
-{'name': '_ZNSt3__127__num_get_unsigned_integralIjEET_PKcS3_Rji', 'is_defined': True, 'type': 'FUNC'}
-{'name': '_ZNSt3__127__num_get_unsigned_integralImEET_PKcS3_Rji', 'is_defined': True, 'type': 'FUNC'}
-{'name': '_ZNSt3__127__num_get_unsigned_integralItEET_PKcS3_Rji', 'is_defined': True, 'type': 'FUNC'}
-{'name': '_ZNSt3__127__num_get_unsigned_integralIyEET_PKcS3_Rji', 'is_defined': True, 'type': 'FUNC'}
{'name': '_ZNSt3__129__libcpp_abort_debug_functionERKNS_19__libcpp_debug_infoE', 'is_defined': True, 'type': 'FUNC'}
{'name': '_ZNSt3__129__libcpp_throw_debug_functionERKNS_19__libcpp_debug_infoE', 'is_defined': True, 'type': 'FUNC'}
{'name': '_ZNSt3__13cinE', 'is_defined': True, 'type': 'OBJECT', 'size': 168}
@@ -1262,21 +1256,7 @@
{'name': '_ZNSt3__16thread6detachEv', 'is_defined': True, 'type': 'FUNC'}
{'name': '_ZNSt3__16threadD1Ev', 'is_defined': True, 'type': 'FUNC'}
{'name': '_ZNSt3__16threadD2Ev', 'is_defined': True, 'type': 'FUNC'}
-{'name': '_ZNSt3__17__sort5IRNS_6__lessIaaEEPaEEjT0_S5_S5_S5_S5_T_', 'is_defined': True, 'type': 'FUNC'}
-{'name': '_ZNSt3__17__sort5IRNS_6__lessIccEEPcEEjT0_S5_S5_S5_S5_T_', 'is_defined': True, 'type': 'FUNC'}
-{'name': '_ZNSt3__17__sort5IRNS_6__lessIddEEPdEEjT0_S5_S5_S5_S5_T_', 'is_defined': True, 'type': 'FUNC'}
{'name': '_ZNSt3__17__sort5IRNS_6__lessIeeEEPeEEjT0_S5_S5_S5_S5_T_', 'is_defined': True, 'type': 'FUNC'}
-{'name': '_ZNSt3__17__sort5IRNS_6__lessIffEEPfEEjT0_S5_S5_S5_S5_T_', 'is_defined': True, 'type': 'FUNC'}
-{'name': '_ZNSt3__17__sort5IRNS_6__lessIhhEEPhEEjT0_S5_S5_S5_S5_T_', 'is_defined': True, 'type': 'FUNC'}
-{'name': '_ZNSt3__17__sort5IRNS_6__lessIiiEEPiEEjT0_S5_S5_S5_S5_T_', 'is_defined': True, 'type': 'FUNC'}
-{'name': '_ZNSt3__17__sort5IRNS_6__lessIjjEEPjEEjT0_S5_S5_S5_S5_T_', 'is_defined': True, 'type': 'FUNC'}
-{'name': '_ZNSt3__17__sort5IRNS_6__lessIllEEPlEEjT0_S5_S5_S5_S5_T_', 'is_defined': True, 'type': 'FUNC'}
-{'name': '_ZNSt3__17__sort5IRNS_6__lessImmEEPmEEjT0_S5_S5_S5_S5_T_', 'is_defined': True, 'type': 'FUNC'}
-{'name': '_ZNSt3__17__sort5IRNS_6__lessIssEEPsEEjT0_S5_S5_S5_S5_T_', 'is_defined': True, 'type': 'FUNC'}
-{'name': '_ZNSt3__17__sort5IRNS_6__lessIttEEPtEEjT0_S5_S5_S5_S5_T_', 'is_defined': True, 'type': 'FUNC'}
-{'name': '_ZNSt3__17__sort5IRNS_6__lessIwwEEPwEEjT0_S5_S5_S5_S5_T_', 'is_defined': True, 'type': 'FUNC'}
-{'name': '_ZNSt3__17__sort5IRNS_6__lessIxxEEPxEEjT0_S5_S5_S5_S5_T_', 'is_defined': True, 'type': 'FUNC'}
-{'name': '_ZNSt3__17__sort5IRNS_6__lessIyyEEPyEEjT0_S5_S5_S5_S5_T_', 'is_defined': True, 'type': 'FUNC'}
{'name': '_ZNSt3__17codecvtIDic11__mbstate_tE2idE', 'is_defined': True, 'type': 'OBJECT', 'size': 16}
{'name': '_ZNSt3__17codecvtIDic11__mbstate_tED0Ev', 'is_defined': True, 'type': 'FUNC'}
{'name': '_ZNSt3__17codecvtIDic11__mbstate_tED1Ev', 'is_defined': True, 'type': 'FUNC'}
@@ -1447,7 +1427,6 @@
{'name': '_ZNSt3__19to_stringEx', 'is_defined': True, 'type': 'FUNC'}
{'name': '_ZNSt3__19to_stringEy', 'is_defined': True, 'type': 'FUNC'}
{'name': '_ZNSt3__1plIcNS_11char_traitsIcEENS_9allocatorIcEEEENS_12basic_stringIT_T0_T1_EEPKS6_RKS9_', 'is_defined': True, 'type': 'FUNC'}
-{'name': '_ZNSt3__1plIcNS_11char_traitsIcEENS_9allocatorIcEEEENS_12basic_stringIT_T0_T1_EERKS9_PKS6_', 'is_defined': True, 'type': 'FUNC'}
{'name': '_ZNSt8bad_castC1Ev', 'is_defined': False, 'type': 'FUNC'}
{'name': '_ZNSt8bad_castD1Ev', 'is_defined': False, 'type': 'FUNC'}
{'name': '_ZNSt8bad_castD2Ev', 'is_defined': False, 'type': 'FUNC'}
@@ -1458,7 +1437,6 @@
{'name': '_ZSt17__throw_bad_allocv', 'is_defined': True, 'type': 'FUNC'}
{'name': '_ZSt17current_exceptionv', 'is_defined': True, 'type': 'FUNC'}
{'name': '_ZSt17rethrow_exceptionSt13exception_ptr', 'is_defined': True, 'type': 'FUNC'}
-{'name': '_ZSt18make_exception_ptrINSt3__112future_errorEESt13exception_ptrT_', 'is_defined': True, 'type': 'FUNC'}
{'name': '_ZSt18uncaught_exceptionv', 'is_defined': True, 'type': 'FUNC'}
{'name': '_ZSt19uncaught_exceptionsv', 'is_defined': True, 'type': 'FUNC'}
{'name': '_ZSt7nothrow', 'is_defined': True, 'type': 'OBJECT', 'size': 1}
More information about the libcxx-commits
mailing list