mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-25 04:56:13 +08:00
[libc++] Make sure we can build libc++ with -fvisibility=hidden
Summary: When building with -fvisibility=hidden, some symbols do not get exported from libc++.dylib. This means that some entities are not explicitly given default visibility in the source code, and that we rely on the fact -fvisibility=default is the default. This commit explicitly gives default visibility to those symbols to avoid being dependent on the command line flags used. The commit also remove symbols from the dylib -- those symbols do not actually need to be exported from the dylib and this should not be an ABI break. Finally, in the future, we may want to mark the whole std:: namespace as having hidden visibility (to switch from opt-out to opt-in), in which case the changes done in this commit will be required. Reviewers: EricWF Subscribers: mgorny, christof, dexonsmith, libcxx-commits Differential Revision: https://reviews.llvm.org/D52662 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345260 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -675,21 +675,23 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD
|
||||
# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
|
||||
# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
|
||||
# define _LIBCPP_OVERRIDABLE_FUNC_VIS
|
||||
# define _LIBCPP_EXPORTED_FROM_ABI
|
||||
#elif defined(_LIBCPP_BUILDING_LIBRARY)
|
||||
# define _LIBCPP_DLL_VIS __declspec(dllexport)
|
||||
# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
|
||||
# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS
|
||||
# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_DLL_VIS
|
||||
# define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllexport)
|
||||
#else
|
||||
# define _LIBCPP_DLL_VIS __declspec(dllimport)
|
||||
# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS
|
||||
# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
|
||||
# define _LIBCPP_OVERRIDABLE_FUNC_VIS
|
||||
# define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_TYPE_VIS _LIBCPP_DLL_VIS
|
||||
#define _LIBCPP_FUNC_VIS _LIBCPP_DLL_VIS
|
||||
#define _LIBCPP_EXTERN_VIS _LIBCPP_DLL_VIS
|
||||
#define _LIBCPP_EXCEPTION_ABI _LIBCPP_DLL_VIS
|
||||
#define _LIBCPP_HIDDEN
|
||||
#define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
@@ -743,8 +745,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_EXTERN_VIS
|
||||
#define _LIBCPP_EXTERN_VIS
|
||||
#ifndef _LIBCPP_EXPORTED_FROM_ABI
|
||||
# define _LIBCPP_EXPORTED_FROM_ABI __attribute__((__visibility__("default")))
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS
|
||||
|
||||
Reference in New Issue
Block a user