Index: libcxx/docs/DesignDocs/VisibilityMacros.rst =================================================================== --- libcxx/docs/DesignDocs/VisibilityMacros.rst +++ libcxx/docs/DesignDocs/VisibilityMacros.rst @@ -61,6 +61,18 @@ ABI, we should create a new _LIBCPP_HIDE_FROM_ABI_AFTER_XXX macro, and we can use it to start removing symbols from the ABI after that stable version. +**_LIBCPP_HIDE_FROM_ABI_PER_TU** + This macro controls whether symbols hidden from the ABI are local to each + translation unit. When enabled, this means that translation units compiled + with different versions of libc++ can be linked together, since all non + ABI-facing functions are local to each translation unit. This allows static + archives built with different versions of libc++ to be linked together. + + When the macro is not defined (the default), there is no guarantee that + translation units compiled with different versions of libc++ can interoperate. + However, this leads to code size improvements, since non ABI-facing functions + can be deduplicated across translation unit boundaries. + **_LIBCPP_TYPE_VIS** Mark a type's typeinfo, vtable and members as having default visibility. This attribute cannot be used on class templates. Index: libcxx/include/__config =================================================================== --- libcxx/include/__config +++ libcxx/include/__config @@ -796,7 +796,11 @@ #endif #ifndef _LIBCPP_HIDE_FROM_ABI -# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_INTERNAL_LINKAGE +# ifdef _LIBCPP_HIDE_FROM_ABI_PER_TU +# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_INTERNAL_LINKAGE +# else +# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_ALWAYS_INLINE +# endif #endif #ifdef _LIBCPP_BUILDING_LIBRARY