[libcxx] r285101 - [libcxx] Build with -fvisibility-inlines-hidden -- Remove 20 inline definitions from the dylib
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 25 12:43:45 PDT 2016
Author: ericwf
Date: Tue Oct 25 14:43:44 2016
New Revision: 285101
URL: http://llvm.org/viewvc/llvm-project?rev=285101&view=rev
Log:
[libcxx] Build with -fvisibility-inlines-hidden -- Remove 20 inline definitions from the dylib
Summary:
This patch turns on `-fvisibility-inlines-hidden` when building the dylib. This is important so that libc++.dylib doesn't accidentally export inline-functions which are ODR used somewhere in the dylib.
On OS X this change has no effect on the current ABI of the dylib. Unfortunately on Linux there are already ~20 inline functions which are unintentionally exported by the dylib. Almost all of these are implicitly generated destructors. I believe removing these function definitions is safe because every "linkage unit" which uses these functions has its own definition, and therefore shouldn't be dependent on libc++.dylib to provide them.
Also could a FreeBSD maintainer comment on the ABI compatibility of this patch?
Reviewers: mclow.lists, emaste, dexonsmith, joker-eph-DISABLED, jroelofs, danalbert, mehdi_amini, compnerd, dim
Subscribers: beanz, mgorny, cfe-commits, modocache
Differential Revision: https://reviews.llvm.org/D25593
Modified:
libcxx/trunk/CMakeLists.txt
libcxx/trunk/lib/abi/CHANGELOG.TXT
libcxx/trunk/lib/abi/x86_64-linux-gnu.abilist
Modified: libcxx/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=285101&r1=285100&r2=285101&view=diff
==============================================================================
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Tue Oct 25 14:43:44 2016
@@ -342,6 +342,11 @@ endif()
# headers
add_compile_flags_if_supported(-nostdinc++)
+# Hide all inline function definitions which have not explicitly been marked
+# visible. This prevents new definitions for inline functions from appearing in
+# the dylib when get ODR used by another function.
+add_compile_flags_if_supported(-fvisibility-inlines-hidden)
+
# Let the library headers know they are currently being used to build the
# library.
add_definitions(-D_LIBCPP_BUILDING_LIBRARY)
Modified: libcxx/trunk/lib/abi/CHANGELOG.TXT
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/abi/CHANGELOG.TXT?rev=285101&r1=285100&r2=285101&view=diff
==============================================================================
--- libcxx/trunk/lib/abi/CHANGELOG.TXT (original)
+++ libcxx/trunk/lib/abi/CHANGELOG.TXT Tue Oct 25 14:43:44 2016
@@ -16,6 +16,41 @@ New entries should be added directly bel
Version 4.0
-----------
+
+* rTBD - Add -fvisibility-inlines-hidden when building libc++.
+
+ Although this change removes symbols, it should still be non-ABI breaking
+ since all of the definitions removed are inline functions. For this reason
+ removing these symbols is safe because every "linkage unit" which uses these
+ functions will contain their own definition.
+
+ x86_64-linux-gnu
+ ----------------
+ SYMBOL REMOVED: _ZNSt12bad_any_castD0Ev
+ SYMBOL REMOVED: _ZNSt12experimental15fundamentals_v112bad_any_castD0Ev
+ SYMBOL REMOVED: _ZNSt3__114__codecvt_utf8IDiED0Ev
+ SYMBOL REMOVED: _ZNSt3__114__codecvt_utf8IDsED0Ev
+ SYMBOL REMOVED: _ZNSt3__114__codecvt_utf8IwED0Ev
+ SYMBOL REMOVED: _ZNSt3__115__codecvt_utf16IDiLb0EED0Ev
+ SYMBOL REMOVED: _ZNSt3__115__codecvt_utf16IDiLb1EED0Ev
+ SYMBOL REMOVED: _ZNSt3__115__codecvt_utf16IDsLb0EED0Ev
+ SYMBOL REMOVED: _ZNSt3__115__codecvt_utf16IDsLb1EED0Ev
+ SYMBOL REMOVED: _ZNSt3__115__codecvt_utf16IwLb0EED0Ev
+ SYMBOL REMOVED: _ZNSt3__115__codecvt_utf16IwLb1EED0Ev
+ SYMBOL REMOVED: _ZNSt3__117__assoc_sub_stateD0Ev
+ SYMBOL REMOVED: _ZNSt3__117__assoc_sub_stateD2Ev
+ SYMBOL REMOVED: _ZNSt3__117__libcpp_sscanf_lEPKcP15__locale_structS1_z
+ SYMBOL REMOVED: _ZNSt3__119__libcpp_asprintf_lEPPcP15__locale_structPKcz
+ SYMBOL REMOVED: _ZNSt3__119__libcpp_snprintf_lEPcmP15__locale_structPKcz
+ SYMBOL REMOVED: _ZNSt3__120__codecvt_utf8_utf16IDiED0Ev
+ SYMBOL REMOVED: _ZNSt3__120__codecvt_utf8_utf16IDsED0Ev
+ SYMBOL REMOVED: _ZNSt3__120__codecvt_utf8_utf16IwED0Ev
+
+ x86_64-apple-darwin16.0
+ -----------------------
+ No Changes - inline symbols are already hidden
+
+
* r284206 - Implement C++17 aligned allocation in <new>
x86_64-linux-gnu
Modified: libcxx/trunk/lib/abi/x86_64-linux-gnu.abilist
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/abi/x86_64-linux-gnu.abilist?rev=285101&r1=285100&r2=285101&view=diff
==============================================================================
--- libcxx/trunk/lib/abi/x86_64-linux-gnu.abilist (original)
+++ libcxx/trunk/lib/abi/x86_64-linux-gnu.abilist Tue Oct 25 14:43:44 2016
@@ -449,8 +449,6 @@
{'type': 'FUNC', 'name': '_ZNSt11logic_errorC2ERKS_'}
{'type': 'FUNC', 'name': '_ZNSt11logic_errorD2Ev'}
{'type': 'FUNC', 'name': '_ZNSt11logic_erroraSERKS_'}
-{'type': 'FUNC', 'name': '_ZNSt12bad_any_castD0Ev'}
-{'type': 'FUNC', 'name': '_ZNSt12experimental15fundamentals_v112bad_any_castD0Ev'}
{'type': 'FUNC', 'name': '_ZNSt12experimental19bad_optional_accessD0Ev'}
{'type': 'FUNC', 'name': '_ZNSt12experimental19bad_optional_accessD1Ev'}
{'type': 'FUNC', 'name': '_ZNSt12experimental19bad_optional_accessD2Ev'}
@@ -893,9 +891,6 @@
{'type': 'FUNC', 'name': '_ZNSt3__113shared_futureIvED1Ev'}
{'type': 'FUNC', 'name': '_ZNSt3__113shared_futureIvED2Ev'}
{'type': 'FUNC', 'name': '_ZNSt3__113shared_futureIvEaSERKS1_'}
-{'type': 'FUNC', 'name': '_ZNSt3__114__codecvt_utf8IDiED0Ev'}
-{'type': 'FUNC', 'name': '_ZNSt3__114__codecvt_utf8IDsED0Ev'}
-{'type': 'FUNC', 'name': '_ZNSt3__114__codecvt_utf8IwED0Ev'}
{'type': 'FUNC', 'name': '_ZNSt3__114__get_const_dbEv'}
{'type': 'FUNC', 'name': '_ZNSt3__114__num_get_base10__get_baseERNS_8ios_baseE'}
{'type': 'OBJECT', 'name': '_ZNSt3__114__num_get_base5__srcE', 'size': 33}
@@ -943,12 +938,6 @@
{'type': 'FUNC', 'name': '_ZNSt3__114error_categoryD0Ev'}
{'type': 'FUNC', 'name': '_ZNSt3__114error_categoryD1Ev'}
{'type': 'FUNC', 'name': '_ZNSt3__114error_categoryD2Ev'}
-{'type': 'FUNC', 'name': '_ZNSt3__115__codecvt_utf16IDiLb0EED0Ev'}
-{'type': 'FUNC', 'name': '_ZNSt3__115__codecvt_utf16IDiLb1EED0Ev'}
-{'type': 'FUNC', 'name': '_ZNSt3__115__codecvt_utf16IDsLb0EED0Ev'}
-{'type': 'FUNC', 'name': '_ZNSt3__115__codecvt_utf16IDsLb1EED0Ev'}
-{'type': 'FUNC', 'name': '_ZNSt3__115__codecvt_utf16IwLb0EED0Ev'}
-{'type': 'FUNC', 'name': '_ZNSt3__115__codecvt_utf16IwLb1EED0Ev'}
{'type': 'FUNC', 'name': '_ZNSt3__115__get_classnameEPKcb'}
{'type': 'FUNC', 'name': '_ZNSt3__115__num_get_floatIdEET_PKcS3_Rj'}
{'type': 'FUNC', 'name': '_ZNSt3__115__num_get_floatIeEET_PKcS3_Rj'}
@@ -1080,9 +1069,6 @@
{'type': 'FUNC', 'name': '_ZNSt3__117__assoc_sub_state4waitEv'}
{'type': 'FUNC', 'name': '_ZNSt3__117__assoc_sub_state9__executeEv'}
{'type': 'FUNC', 'name': '_ZNSt3__117__assoc_sub_state9set_valueEv'}
-{'type': 'FUNC', 'name': '_ZNSt3__117__assoc_sub_stateD0Ev'}
-{'type': 'FUNC', 'name': '_ZNSt3__117__assoc_sub_stateD2Ev'}
-{'type': 'FUNC', 'name': '_ZNSt3__117__libcpp_sscanf_lEPKcP15__locale_structS1_z'}
{'type': 'FUNC', 'name': '_ZNSt3__117__widen_from_utf8ILm16EED0Ev'}
{'type': 'FUNC', 'name': '_ZNSt3__117__widen_from_utf8ILm16EED1Ev'}
{'type': 'FUNC', 'name': '_ZNSt3__117__widen_from_utf8ILm16EED2Ev'}
@@ -1122,8 +1108,6 @@
{'type': 'FUNC', 'name': '_ZNSt3__118shared_timed_mutex8try_lockEv'}
{'type': 'FUNC', 'name': '_ZNSt3__118shared_timed_mutexC1Ev'}
{'type': 'FUNC', 'name': '_ZNSt3__118shared_timed_mutexC2Ev'}
-{'type': 'FUNC', 'name': '_ZNSt3__119__libcpp_asprintf_lEPPcP15__locale_structPKcz'}
-{'type': 'FUNC', 'name': '_ZNSt3__119__libcpp_snprintf_lEPcmP15__locale_structPKcz'}
{'type': 'FUNC', 'name': '_ZNSt3__119__shared_mutex_base11lock_sharedEv'}
{'type': 'FUNC', 'name': '_ZNSt3__119__shared_mutex_base13unlock_sharedEv'}
{'type': 'FUNC', 'name': '_ZNSt3__119__shared_mutex_base15try_lock_sharedEv'}
@@ -1144,9 +1128,6 @@
{'type': 'FUNC', 'name': '_ZNSt3__119__thread_local_dataEv'}
{'type': 'FUNC', 'name': '_ZNSt3__119declare_no_pointersEPcm'}
{'type': 'OBJECT', 'name': '_ZNSt3__119piecewise_constructE', 'size': 1}
-{'type': 'FUNC', 'name': '_ZNSt3__120__codecvt_utf8_utf16IDiED0Ev'}
-{'type': 'FUNC', 'name': '_ZNSt3__120__codecvt_utf8_utf16IDsED0Ev'}
-{'type': 'FUNC', 'name': '_ZNSt3__120__codecvt_utf8_utf16IwED0Ev'}
{'type': 'FUNC', 'name': '_ZNSt3__120__get_collation_nameEPKc'}
{'type': 'FUNC', 'name': '_ZNSt3__120__throw_system_errorEiPKc'}
{'type': 'FUNC', 'name': '_ZNSt3__121__thread_specific_ptrINS_15__thread_structEE16__at_thread_exitEPv'}
More information about the cfe-commits
mailing list