[libcxx-commits] [libcxx] 80c7e93 - [libc++] Add a bunch of missing _LIBCPP_HIDE_FROM_ABI

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Sat Aug 13 13:41:28 PDT 2022


Author: Nikolas Klauser
Date: 2022-08-13T22:41:22+02:00
New Revision: 80c7e93a2a8448fa16fe28b99c733e93ec64df51

URL: https://github.com/llvm/llvm-project/commit/80c7e93a2a8448fa16fe28b99c733e93ec64df51
DIFF: https://github.com/llvm/llvm-project/commit/80c7e93a2a8448fa16fe28b99c733e93ec64df51.diff

LOG: [libc++] Add a bunch of missing _LIBCPP_HIDE_FROM_ABI

Reviewed By: ldionne, Mordante, var-const, huixie90, #libc

Spies: jloser, libcxx-commits, arichardson, miyuki

Differential Revision: https://reviews.llvm.org/D129968

Added: 
    libcxx/test/libcxx/clang_query.sh.cpp
    libcxx/test/libcxx/clang_query/README.md
    libcxx/test/libcxx/clang_query/hide_from_abi_or_visible.query

Modified: 
    libcxx/docs/TestingLibcxx.rst
    libcxx/include/__algorithm/find_end.h
    libcxx/include/__algorithm/find_first_of.h
    libcxx/include/__algorithm/inplace_merge.h
    libcxx/include/__algorithm/is_partitioned.h
    libcxx/include/__algorithm/lexicographical_compare.h
    libcxx/include/__algorithm/merge.h
    libcxx/include/__algorithm/minmax_element.h
    libcxx/include/__algorithm/next_permutation.h
    libcxx/include/__algorithm/nth_element.h
    libcxx/include/__algorithm/partial_sort.h
    libcxx/include/__algorithm/partial_sort_copy.h
    libcxx/include/__algorithm/partition.h
    libcxx/include/__algorithm/partition_copy.h
    libcxx/include/__algorithm/partition_point.h
    libcxx/include/__algorithm/prev_permutation.h
    libcxx/include/__algorithm/remove.h
    libcxx/include/__algorithm/remove_if.h
    libcxx/include/__algorithm/rotate.h
    libcxx/include/__algorithm/shuffle.h
    libcxx/include/__algorithm/sift_down.h
    libcxx/include/__algorithm/sort.h
    libcxx/include/__algorithm/stable_partition.h
    libcxx/include/__algorithm/stable_sort.h
    libcxx/include/__bit_reference
    libcxx/include/__chrono/duration.h
    libcxx/include/__format/formatter_floating_point.h
    libcxx/include/__functional/invoke.h
    libcxx/include/__iterator/common_iterator.h
    libcxx/include/__iterator/counted_iterator.h
    libcxx/include/__memory/shared_ptr.h
    libcxx/include/__memory/temporary_buffer.h
    libcxx/include/__memory/uninitialized_algorithms.h
    libcxx/include/__numeric/midpoint.h
    libcxx/include/__random/bernoulli_distribution.h
    libcxx/include/__random/binomial_distribution.h
    libcxx/include/__random/cauchy_distribution.h
    libcxx/include/__random/chi_squared_distribution.h
    libcxx/include/__random/discard_block_engine.h
    libcxx/include/__random/discrete_distribution.h
    libcxx/include/__random/exponential_distribution.h
    libcxx/include/__random/extreme_value_distribution.h
    libcxx/include/__random/fisher_f_distribution.h
    libcxx/include/__random/gamma_distribution.h
    libcxx/include/__random/generate_canonical.h
    libcxx/include/__random/geometric_distribution.h
    libcxx/include/__random/independent_bits_engine.h
    libcxx/include/__random/linear_congruential_engine.h
    libcxx/include/__random/mersenne_twister_engine.h
    libcxx/include/__random/negative_binomial_distribution.h
    libcxx/include/__random/normal_distribution.h
    libcxx/include/__random/piecewise_constant_distribution.h
    libcxx/include/__random/piecewise_linear_distribution.h
    libcxx/include/__random/poisson_distribution.h
    libcxx/include/__random/shuffle_order_engine.h
    libcxx/include/__random/student_t_distribution.h
    libcxx/include/__random/subtract_with_carry_engine.h
    libcxx/include/__random/uniform_int_distribution.h
    libcxx/include/__random/uniform_real_distribution.h
    libcxx/include/__random/weibull_distribution.h
    libcxx/include/__ranges/iota_view.h
    libcxx/include/__string/char_traits.h
    libcxx/include/__tree
    libcxx/include/__type_traits/is_constant_evaluated.h
    libcxx/include/__utility/as_const.h
    libcxx/include/bitset
    libcxx/include/cmath
    libcxx/include/complex
    libcxx/include/cstddef
    libcxx/include/deque
    libcxx/include/exception
    libcxx/include/experimental/iterator
    libcxx/include/experimental/simd
    libcxx/include/ext/hash_map
    libcxx/include/ext/hash_set
    libcxx/include/forward_list
    libcxx/include/future
    libcxx/include/iomanip
    libcxx/include/ios
    libcxx/include/istream
    libcxx/include/mutex
    libcxx/include/ostream
    libcxx/include/regex
    libcxx/include/string
    libcxx/include/string_view
    libcxx/include/thread
    libcxx/include/unordered_map
    libcxx/include/unordered_set
    libcxx/include/variant
    libcxx/utils/libcxx/test/features.py
    libcxx/utils/libcxx/test/params.py

Removed: 
    


################################################################################
diff  --git a/libcxx/docs/TestingLibcxx.rst b/libcxx/docs/TestingLibcxx.rst
index 9d73b7056b3cd..9f185479c2590 100644
--- a/libcxx/docs/TestingLibcxx.rst
+++ b/libcxx/docs/TestingLibcxx.rst
@@ -92,6 +92,15 @@ configuration easier.
      $ make -C <build> cxx-test-depends
      $ <build>/bin/llvm-lit -sv libcxx/test # will use your custom config file
 
+Additional tools
+----------------
+
+The libc++ test suite uses a few optional tools to improve the code quality.
+
+These tools are:
+- clang-query
+- clang-tidy
+
 Writing Tests
 -------------
 

diff  --git a/libcxx/include/__algorithm/find_end.h b/libcxx/include/__algorithm/find_end.h
index 65e9f29b1c1f2..ea358094ebbbb 100644
--- a/libcxx/include/__algorithm/find_end.h
+++ b/libcxx/include/__algorithm/find_end.h
@@ -91,7 +91,7 @@ template <
     class _Sent2,
     class _Proj1,
     class _Proj2>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 _Iter1 __find_end(
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _Iter1 __find_end(
     _Iter1 __first1,
     _Sent1 __sent1,
     _Iter2 __first2,
@@ -144,7 +144,7 @@ template <
     class _Sent2,
     class _Proj1,
     class _Proj2>
-_LIBCPP_CONSTEXPR_AFTER_CXX11 _Iter1 __find_end(
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 _Iter1 __find_end(
     _Iter1 __first1,
     _Sent1 __sent1,
     _Iter2 __first2,

diff  --git a/libcxx/include/__algorithm/find_first_of.h b/libcxx/include/__algorithm/find_first_of.h
index 2096b0f0c9a53..e0c2f1ad72369 100644
--- a/libcxx/include/__algorithm/find_first_of.h
+++ b/libcxx/include/__algorithm/find_first_of.h
@@ -21,6 +21,7 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
+_LIBCPP_HIDE_FROM_ABI
 _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator1 __find_first_of_ce(_ForwardIterator1 __first1,
                                                                    _ForwardIterator1 __last1,
                                                                    _ForwardIterator2 __first2,

diff  --git a/libcxx/include/__algorithm/inplace_merge.h b/libcxx/include/__algorithm/inplace_merge.h
index 0890639f49523..01a871af1da6e 100644
--- a/libcxx/include/__algorithm/inplace_merge.h
+++ b/libcxx/include/__algorithm/inplace_merge.h
@@ -56,6 +56,7 @@ class __invert // invert the sense of a comparison
 
 template <class _AlgPolicy, class _Compare, class _InputIterator1, class _Sent1,
           class _InputIterator2, class _Sent2, class _OutputIterator>
+_LIBCPP_HIDE_FROM_ABI
 void __half_inplace_merge(_InputIterator1 __first1, _Sent1 __last1,
                           _InputIterator2 __first2, _Sent2 __last2,
                           _OutputIterator __result, _Compare&& __comp)
@@ -83,6 +84,7 @@ void __half_inplace_merge(_InputIterator1 __first1, _Sent1 __last1,
 }
 
 template <class _AlgPolicy, class _Compare, class _BidirectionalIterator>
+_LIBCPP_HIDE_FROM_ABI
 void __buffered_inplace_merge(
     _BidirectionalIterator __first,
     _BidirectionalIterator __middle,

diff  --git a/libcxx/include/__algorithm/is_partitioned.h b/libcxx/include/__algorithm/is_partitioned.h
index b4f421cfc0538..1d609840dde22 100644
--- a/libcxx/include/__algorithm/is_partitioned.h
+++ b/libcxx/include/__algorithm/is_partitioned.h
@@ -18,7 +18,7 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _InputIterator, class _Predicate>
-_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
+_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
 is_partitioned(_InputIterator __first, _InputIterator __last, _Predicate __pred)
 {
     for (; __first != __last; ++__first)

diff  --git a/libcxx/include/__algorithm/lexicographical_compare.h b/libcxx/include/__algorithm/lexicographical_compare.h
index 30ddf24081202..072705680a13d 100644
--- a/libcxx/include/__algorithm/lexicographical_compare.h
+++ b/libcxx/include/__algorithm/lexicographical_compare.h
@@ -21,7 +21,7 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _Compare, class _InputIterator1, class _InputIterator2>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 bool
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
 __lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
                           _InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp)
 {

diff  --git a/libcxx/include/__algorithm/merge.h b/libcxx/include/__algorithm/merge.h
index 48360ed5b4451..75ee2b6ab5dd5 100644
--- a/libcxx/include/__algorithm/merge.h
+++ b/libcxx/include/__algorithm/merge.h
@@ -22,7 +22,7 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator>
-_LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
 _OutputIterator
 __merge(_InputIterator1 __first1, _InputIterator1 __last1,
         _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)

diff  --git a/libcxx/include/__algorithm/minmax_element.h b/libcxx/include/__algorithm/minmax_element.h
index cf67184e0b4cb..055af89585ab9 100644
--- a/libcxx/include/__algorithm/minmax_element.h
+++ b/libcxx/include/__algorithm/minmax_element.h
@@ -79,7 +79,7 @@ pair<_Iter, _Iter> __minmax_element_impl(_Iter __first, _Sent __last, _Comp& __c
 }
 
 template <class _ForwardIterator, class _Compare>
-_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX11
+_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
 pair<_ForwardIterator, _ForwardIterator>
 minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) {
   static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value,

diff  --git a/libcxx/include/__algorithm/next_permutation.h b/libcxx/include/__algorithm/next_permutation.h
index b58dcf4e1a913..c9c7086da5da9 100644
--- a/libcxx/include/__algorithm/next_permutation.h
+++ b/libcxx/include/__algorithm/next_permutation.h
@@ -25,8 +25,7 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _AlgPolicy, class _Compare, class _BidirectionalIterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_AFTER_CXX17
-pair<_BidirectionalIterator, bool>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_BidirectionalIterator, bool>
 __next_permutation(_BidirectionalIterator __first, _Sentinel __last, _Compare&& __comp)
 {
     using _Result = pair<_BidirectionalIterator, bool>;

diff  --git a/libcxx/include/__algorithm/nth_element.h b/libcxx/include/__algorithm/nth_element.h
index 688398dee814c..e5ead7bccbee9 100644
--- a/libcxx/include/__algorithm/nth_element.h
+++ b/libcxx/include/__algorithm/nth_element.h
@@ -26,7 +26,7 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template<class _Compare, class _RandomAccessIterator>
-_LIBCPP_CONSTEXPR_AFTER_CXX11 bool
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 bool
 __nth_element_find_guard(_RandomAccessIterator& __i, _RandomAccessIterator& __j,
                          _RandomAccessIterator __m, _Compare __comp)
 {
@@ -42,7 +42,7 @@ __nth_element_find_guard(_RandomAccessIterator& __i, _RandomAccessIterator& __j,
 }
 
 template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
-_LIBCPP_CONSTEXPR_AFTER_CXX11 void
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 void
 __nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Compare __comp)
 {
     using _Ops = _IterOps<_AlgPolicy>;

diff  --git a/libcxx/include/__algorithm/partial_sort.h b/libcxx/include/__algorithm/partial_sort.h
index dff0cd01f35a1..f4034f1112974 100644
--- a/libcxx/include/__algorithm/partial_sort.h
+++ b/libcxx/include/__algorithm/partial_sort.h
@@ -29,7 +29,7 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _AlgPolicy, class _Compare, class _RandomAccessIterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
 _RandomAccessIterator __partial_sort_impl(
     _RandomAccessIterator __first, _RandomAccessIterator __middle, _Sentinel __last, _Compare&& __comp) {
   if (__first == __middle) {
@@ -55,7 +55,7 @@ _RandomAccessIterator __partial_sort_impl(
 }
 
 template <class _AlgPolicy, class _Compare, class _RandomAccessIterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
 _RandomAccessIterator __partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _Sentinel __last,
                                      _Compare& __comp) {
   if (__first == __middle)

diff  --git a/libcxx/include/__algorithm/partial_sort_copy.h b/libcxx/include/__algorithm/partial_sort_copy.h
index 55edf31b0f921..7b38624404f80 100644
--- a/libcxx/include/__algorithm/partial_sort_copy.h
+++ b/libcxx/include/__algorithm/partial_sort_copy.h
@@ -33,7 +33,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 template <class _AlgPolicy, class _Compare,
           class _InputIterator, class _Sentinel1, class _RandomAccessIterator, class _Sentinel2,
           class _Proj1, class _Proj2>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_InputIterator, _RandomAccessIterator>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_InputIterator, _RandomAccessIterator>
 __partial_sort_copy(_InputIterator __first, _Sentinel1 __last,
                     _RandomAccessIterator __result_first, _Sentinel2 __result_last,
                     _Compare&& __comp, _Proj1&& __proj1, _Proj2&& __proj2)

diff  --git a/libcxx/include/__algorithm/partition.h b/libcxx/include/__algorithm/partition.h
index 60b4e290ebebc..708c8ffa3db3c 100644
--- a/libcxx/include/__algorithm/partition.h
+++ b/libcxx/include/__algorithm/partition.h
@@ -23,7 +23,7 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _Predicate, class _AlgPolicy, class _ForwardIterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_ForwardIterator, _ForwardIterator>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_ForwardIterator, _ForwardIterator>
 __partition_impl(_ForwardIterator __first, _Sentinel __last, _Predicate __pred, forward_iterator_tag)
 {
     while (true)
@@ -48,7 +48,7 @@ __partition_impl(_ForwardIterator __first, _Sentinel __last, _Predicate __pred,
 }
 
 template <class _Predicate, class _AlgPolicy, class _BidirectionalIterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_BidirectionalIterator, _BidirectionalIterator>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_BidirectionalIterator, _BidirectionalIterator>
 __partition_impl(_BidirectionalIterator __first, _Sentinel __sentinel, _Predicate __pred,
             bidirectional_iterator_tag)
 {

diff  --git a/libcxx/include/__algorithm/partition_copy.h b/libcxx/include/__algorithm/partition_copy.h
index cacde0bfd47bb..26bf9bc48fc1d 100644
--- a/libcxx/include/__algorithm/partition_copy.h
+++ b/libcxx/include/__algorithm/partition_copy.h
@@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _InputIterator, class _OutputIterator1,
           class _OutputIterator2, class _Predicate>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_OutputIterator1, _OutputIterator2>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_OutputIterator1, _OutputIterator2>
 partition_copy(_InputIterator __first, _InputIterator __last,
                _OutputIterator1 __out_true, _OutputIterator2 __out_false,
                _Predicate __pred)

diff  --git a/libcxx/include/__algorithm/partition_point.h b/libcxx/include/__algorithm/partition_point.h
index 1675534e60d5a..4bc35e0488de1 100644
--- a/libcxx/include/__algorithm/partition_point.h
+++ b/libcxx/include/__algorithm/partition_point.h
@@ -22,7 +22,7 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template<class _ForwardIterator, class _Predicate>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
 partition_point(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
 {
     typedef typename iterator_traits<_ForwardIterator>::
diff erence_type 
diff erence_type;

diff  --git a/libcxx/include/__algorithm/prev_permutation.h b/libcxx/include/__algorithm/prev_permutation.h
index 698506372b6f1..3a48f655948d6 100644
--- a/libcxx/include/__algorithm/prev_permutation.h
+++ b/libcxx/include/__algorithm/prev_permutation.h
@@ -25,7 +25,7 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _AlgPolicy, class _Compare, class _BidirectionalIterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
 pair<_BidirectionalIterator, bool>
 __prev_permutation(_BidirectionalIterator __first, _Sentinel __last, _Compare&& __comp)
 {

diff  --git a/libcxx/include/__algorithm/remove.h b/libcxx/include/__algorithm/remove.h
index 8a7e99ba09a16..dfae846857995 100644
--- a/libcxx/include/__algorithm/remove.h
+++ b/libcxx/include/__algorithm/remove.h
@@ -21,7 +21,7 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _ForwardIterator, class _Tp>
-_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
+_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
 remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
 {
     __first = _VSTD::find(__first, __last, __value);

diff  --git a/libcxx/include/__algorithm/remove_if.h b/libcxx/include/__algorithm/remove_if.h
index 0ae131498d22d..f687c81dfbbc5 100644
--- a/libcxx/include/__algorithm/remove_if.h
+++ b/libcxx/include/__algorithm/remove_if.h
@@ -20,7 +20,7 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _ForwardIterator, class _Predicate>
-_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
+_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
 remove_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
 {
     __first = _VSTD::find_if<_ForwardIterator, _Predicate&>(__first, __last, __pred);

diff  --git a/libcxx/include/__algorithm/rotate.h b/libcxx/include/__algorithm/rotate.h
index beb5409d5b886..fa8568038d5f7 100644
--- a/libcxx/include/__algorithm/rotate.h
+++ b/libcxx/include/__algorithm/rotate.h
@@ -26,7 +26,7 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _AlgPolicy, class _ForwardIterator>
-_LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator
 __rotate_left(_ForwardIterator __first, _ForwardIterator __last)
 {
     typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
@@ -40,7 +40,7 @@ __rotate_left(_ForwardIterator __first, _ForwardIterator __last)
 }
 
 template <class _AlgPolicy, class _BidirectionalIterator>
-_LIBCPP_CONSTEXPR_AFTER_CXX11 _BidirectionalIterator
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 _BidirectionalIterator
 __rotate_right(_BidirectionalIterator __first, _BidirectionalIterator __last)
 {
     typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
@@ -54,7 +54,7 @@ __rotate_right(_BidirectionalIterator __first, _BidirectionalIterator __last)
 }
 
 template <class _AlgPolicy, class _ForwardIterator>
-_LIBCPP_CONSTEXPR_AFTER_CXX14 _ForwardIterator
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 _ForwardIterator
 __rotate_forward(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last)
 {
     _ForwardIterator __i = __middle;
@@ -103,7 +103,7 @@ __algo_gcd(_Integral __x, _Integral __y)
 }
 
 template <class _AlgPolicy, typename _RandomAccessIterator>
-_LIBCPP_CONSTEXPR_AFTER_CXX14 _RandomAccessIterator
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 _RandomAccessIterator
 __rotate_gcd(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last)
 {
     typedef typename iterator_traits<_RandomAccessIterator>::
diff erence_type 
diff erence_type;

diff  --git a/libcxx/include/__algorithm/shuffle.h b/libcxx/include/__algorithm/shuffle.h
index e32c6a7608ba0..b5ce291e7a97a 100644
--- a/libcxx/include/__algorithm/shuffle.h
+++ b/libcxx/include/__algorithm/shuffle.h
@@ -93,7 +93,7 @@ class _LIBCPP_TYPE_VIS __rs_default
 _LIBCPP_FUNC_VIS __rs_default __rs_get();
 
 template <class _RandomAccessIterator>
-_LIBCPP_DEPRECATED_IN_CXX14 void
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX14 void
 random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
 {
     typedef typename iterator_traits<_RandomAccessIterator>::
diff erence_type 
diff erence_type;
@@ -114,7 +114,7 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
 }
 
 template <class _RandomAccessIterator, class _RandomNumberGenerator>
-_LIBCPP_DEPRECATED_IN_CXX14 void
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX14 void
 random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
 #ifndef _LIBCPP_CXX03_LANG
                _RandomNumberGenerator&& __rand)
@@ -137,7 +137,7 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
 #endif
 
 template <class _AlgPolicy, class _RandomAccessIterator, class _Sentinel, class _UniformRandomNumberGenerator>
-_RandomAccessIterator __shuffle(
+_LIBCPP_HIDE_FROM_ABI _RandomAccessIterator __shuffle(
     _RandomAccessIterator __first, _Sentinel __last_sentinel, _UniformRandomNumberGenerator&& __g) {
     typedef typename iterator_traits<_RandomAccessIterator>::
diff erence_type 
diff erence_type;
     typedef uniform_int_distribution<ptr
diff _t> _Dp;
@@ -161,8 +161,8 @@ _RandomAccessIterator __shuffle(
 }
 
 template <class _RandomAccessIterator, class _UniformRandomNumberGenerator>
-void shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
-             _UniformRandomNumberGenerator&& __g) {
+_LIBCPP_HIDE_FROM_ABI void
+shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, _UniformRandomNumberGenerator&& __g) {
   (void)std::__shuffle<_ClassicAlgPolicy>(
       std::move(__first), std::move(__last), std::forward<_UniformRandomNumberGenerator>(__g));
 }

diff  --git a/libcxx/include/__algorithm/sift_down.h b/libcxx/include/__algorithm/sift_down.h
index 06811239f84fd..f2917d39522e0 100644
--- a/libcxx/include/__algorithm/sift_down.h
+++ b/libcxx/include/__algorithm/sift_down.h
@@ -22,7 +22,7 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
-_LIBCPP_CONSTEXPR_AFTER_CXX11 void
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 void
 __sift_down(_RandomAccessIterator __first, _Compare&& __comp,
             typename iterator_traits<_RandomAccessIterator>::
diff erence_type __len,
             _RandomAccessIterator __start)
@@ -78,7 +78,7 @@ __sift_down(_RandomAccessIterator __first, _Compare&& __comp,
 }
 
 template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
-_LIBCPP_CONSTEXPR_AFTER_CXX11 _RandomAccessIterator
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 _RandomAccessIterator
 __floyd_sift_down(_RandomAccessIterator __first, _Compare&& __comp,
                   typename iterator_traits<_RandomAccessIterator>::
diff erence_type __len)
 {

diff  --git a/libcxx/include/__algorithm/sort.h b/libcxx/include/__algorithm/sort.h
index 1ca2f1b81712a..588b391752958 100644
--- a/libcxx/include/__algorithm/sort.h
+++ b/libcxx/include/__algorithm/sort.h
@@ -80,6 +80,7 @@ struct _UnwrapAlgPolicy<_WrapAlgPolicy<_Ts...> > {
 // stable, 2-3 compares, 0-2 swaps
 
 template <class _AlgPolicy, class _Compare, class _ForwardIterator>
+_LIBCPP_HIDE_FROM_ABI
 _LIBCPP_CONSTEXPR_AFTER_CXX11 unsigned __sort3(_ForwardIterator __x, _ForwardIterator __y, _ForwardIterator __z,
                                                _Compare __c) {
   using _Ops = _IterOps<_AlgPolicy>;
@@ -118,6 +119,7 @@ _LIBCPP_CONSTEXPR_AFTER_CXX11 unsigned __sort3(_ForwardIterator __x, _ForwardIte
 // stable, 3-6 compares, 0-5 swaps
 
 template <class _AlgPolicy, class _Compare, class _ForwardIterator>
+_LIBCPP_HIDE_FROM_ABI
 unsigned __sort4(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3, _ForwardIterator __x4,
                  _Compare __c) {
   using _Ops = _IterOps<_AlgPolicy>;
@@ -281,6 +283,7 @@ __sort5_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2,
 
 // Assumes size > 0
 template <class _AlgPolicy, class _Compare, class _BidirectionalIterator>
+_LIBCPP_HIDE_FROM_ABI
 _LIBCPP_CONSTEXPR_AFTER_CXX11 void __selection_sort(_BidirectionalIterator __first, _BidirectionalIterator __last,
                                                     _Compare __comp) {
   _BidirectionalIterator __lm1 = __last;
@@ -292,6 +295,7 @@ _LIBCPP_CONSTEXPR_AFTER_CXX11 void __selection_sort(_BidirectionalIterator __fir
 }
 
 template <class _AlgPolicy, class _Compare, class _BidirectionalIterator>
+_LIBCPP_HIDE_FROM_ABI
 void __insertion_sort(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) {
   using _Ops = _IterOps<_AlgPolicy>;
 
@@ -309,6 +313,7 @@ void __insertion_sort(_BidirectionalIterator __first, _BidirectionalIterator __l
 }
 
 template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
+_LIBCPP_HIDE_FROM_ABI
 void __insertion_sort_3(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
   using _Ops = _IterOps<_AlgPolicy>;
 
@@ -332,7 +337,7 @@ void __insertion_sort_3(_RandomAccessIterator __first, _RandomAccessIterator __l
 }
 
 template <class _WrappedComp, class _RandomAccessIterator>
-bool __insertion_sort_incomplete(
+_LIBCPP_HIDDEN bool __insertion_sort_incomplete(
     _RandomAccessIterator __first, _RandomAccessIterator __last, _WrappedComp __wrapped_comp) {
   using _Unwrap = _UnwrapAlgPolicy<_WrappedComp>;
   using _AlgPolicy = typename _Unwrap::_AlgPolicy;
@@ -387,6 +392,7 @@ bool __insertion_sort_incomplete(
 }
 
 template <class _AlgPolicy, class _Compare, class _BidirectionalIterator>
+_LIBCPP_HIDE_FROM_ABI
 void __insertion_sort_move(_BidirectionalIterator __first1, _BidirectionalIterator __last1,
                            typename iterator_traits<_BidirectionalIterator>::value_type* __first2, _Compare __comp) {
   using _Ops = _IterOps<_AlgPolicy>;
@@ -616,7 +622,7 @@ inline _LIBCPP_HIDE_FROM_ABI _Number __log2i(_Number __n) {
 }
 
 template <class _WrappedComp, class _RandomAccessIterator>
-void __sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _WrappedComp __wrapped_comp) {
+_LIBCPP_HIDDEN void __sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _WrappedComp __wrapped_comp) {
   typedef typename iterator_traits<_RandomAccessIterator>::
diff erence_type 
diff erence_type;
   
diff erence_type __depth_limit = 2 * __log2i(__last - __first);
 

diff  --git a/libcxx/include/__algorithm/stable_partition.h b/libcxx/include/__algorithm/stable_partition.h
index c7aa3f07a88ce..a5c7e862203e6 100644
--- a/libcxx/include/__algorithm/stable_partition.h
+++ b/libcxx/include/__algorithm/stable_partition.h
@@ -25,7 +25,7 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _AlgPolicy, class _Predicate, class _ForwardIterator, class _Distance, class _Pair>
-_ForwardIterator
+_LIBCPP_HIDE_FROM_ABI _ForwardIterator
 __stable_partition_impl(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred,
                    _Distance __len, _Pair __p, forward_iterator_tag __fit)
 {
@@ -114,7 +114,7 @@ __stable_partition_impl(_ForwardIterator __first, _ForwardIterator __last, _Pred
 }
 
 template <class _AlgPolicy, class _Predicate, class _ForwardIterator>
-_ForwardIterator
+_LIBCPP_HIDE_FROM_ABI _ForwardIterator
 __stable_partition_impl(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred,
                    forward_iterator_tag)
 {
@@ -259,7 +259,7 @@ __stable_partition_impl(_BidirectionalIterator __first, _BidirectionalIterator _
 }
 
 template <class _AlgPolicy, class _Predicate, class _BidirectionalIterator>
-_BidirectionalIterator
+_LIBCPP_HIDE_FROM_ABI _BidirectionalIterator
 __stable_partition_impl(_BidirectionalIterator __first, _BidirectionalIterator __last, _Predicate __pred,
                    bidirectional_iterator_tag)
 {

diff  --git a/libcxx/include/__algorithm/stable_sort.h b/libcxx/include/__algorithm/stable_sort.h
index fb149eeb65dc0..dfd428f8ec365 100644
--- a/libcxx/include/__algorithm/stable_sort.h
+++ b/libcxx/include/__algorithm/stable_sort.h
@@ -27,7 +27,7 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _AlgPolicy, class _Compare, class _InputIterator1, class _InputIterator2>
-void
+_LIBCPP_HIDE_FROM_ABI void
 __merge_move_construct(_InputIterator1 __first1, _InputIterator1 __last1,
         _InputIterator2 __first2, _InputIterator2 __last2,
         typename iterator_traits<_InputIterator1>::value_type* __result, _Compare __comp)
@@ -69,7 +69,7 @@ __merge_move_construct(_InputIterator1 __first1, _InputIterator1 __last1,
 }
 
 template <class _AlgPolicy, class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator>
-void
+_LIBCPP_HIDE_FROM_ABI void
 __merge_move_assign(_InputIterator1 __first1, _InputIterator1 __last1,
         _InputIterator2 __first2, _InputIterator2 __last2,
         _OutputIterator __result, _Compare __comp)

diff  --git a/libcxx/include/__bit_reference b/libcxx/include/__bit_reference
index 60f57d665a1cb..025b86644b090 100644
--- a/libcxx/include/__bit_reference
+++ b/libcxx/include/__bit_reference
@@ -176,7 +176,7 @@ private:
 // find
 
 template <class _Cp, bool _IsConst>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 __bit_iterator<_Cp, _IsConst>
+_LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI __bit_iterator<_Cp, _IsConst>
 __find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
 {
     typedef __bit_iterator<_Cp, _IsConst> _It;
@@ -212,7 +212,7 @@ __find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
 }
 
 template <class _Cp, bool _IsConst>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 __bit_iterator<_Cp, _IsConst>
+_LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI __bit_iterator<_Cp, _IsConst>
 __find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
 {
     typedef __bit_iterator<_Cp, _IsConst> _It;
@@ -263,7 +263,7 @@ find(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last
 // count
 
 template <class _Cp, bool _IsConst>
-typename __bit_iterator<_Cp, _IsConst>::
diff erence_type
+_LIBCPP_HIDE_FROM_ABI typename __bit_iterator<_Cp, _IsConst>::
diff erence_type
 __count_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
 {
     typedef __bit_iterator<_Cp, _IsConst> _It;
@@ -294,7 +294,7 @@ __count_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
 }
 
 template <class _Cp, bool _IsConst>
-typename __bit_iterator<_Cp, _IsConst>::
diff erence_type
+_LIBCPP_HIDE_FROM_ABI typename __bit_iterator<_Cp, _IsConst>::
diff erence_type
 __count_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
 {
     typedef __bit_iterator<_Cp, _IsConst> _It;
@@ -337,7 +337,7 @@ count(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __las
 // fill_n
 
 template <class _Cp>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 void
+_LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI void
 __fill_n_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
 {
     typedef __bit_iterator<_Cp, false> _It;
@@ -367,7 +367,7 @@ __fill_n_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
 }
 
 template <class _Cp>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 void
+_LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI void
 __fill_n_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
 {
     typedef __bit_iterator<_Cp, false> _It;
@@ -424,8 +424,7 @@ fill(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, bool
 // copy
 
 template <class _Cp, bool _IsConst>
-_LIBCPP_CONSTEXPR_AFTER_CXX17
-__bit_iterator<_Cp, false>
+_LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI __bit_iterator<_Cp, false>
 __copy_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
                                                      __bit_iterator<_Cp, false> __result)
 {
@@ -472,8 +471,7 @@ __copy_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsCon
 }
 
 template <class _Cp, bool _IsConst>
-_LIBCPP_CONSTEXPR_AFTER_CXX17
-__bit_iterator<_Cp, false>
+_LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI __bit_iterator<_Cp, false>
 __copy_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
                                                        __bit_iterator<_Cp, false> __result)
 {
@@ -563,7 +561,7 @@ copy(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last
 // copy_backward
 
 template <class _Cp, bool _IsConst>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 __bit_iterator<_Cp, false>
+_LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI __bit_iterator<_Cp, false>
 __copy_backward_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
                                                      __bit_iterator<_Cp, false> __result)
 {
@@ -610,7 +608,7 @@ __copy_backward_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_C
 }
 
 template <class _Cp, bool _IsConst>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 __bit_iterator<_Cp, false>
+_LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI __bit_iterator<_Cp, false>
 __copy_backward_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
                                                        __bit_iterator<_Cp, false> __result)
 {
@@ -728,7 +726,7 @@ move_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsCons
 // swap_ranges
 
 template <class __C1, class __C2>
-__bit_iterator<__C2, false>
+_LIBCPP_HIDE_FROM_ABI __bit_iterator<__C2, false>
 __swap_ranges_aligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1, false> __last,
                       __bit_iterator<__C2, false> __result)
 {
@@ -778,7 +776,7 @@ __swap_ranges_aligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1,
 }
 
 template <class __C1, class __C2>
-__bit_iterator<__C2, false>
+_LIBCPP_HIDE_FROM_ABI __bit_iterator<__C2, false>
 __swap_ranges_unaligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1, false> __last,
                         __bit_iterator<__C2, false> __result)
 {
@@ -923,7 +921,7 @@ struct __bit_array
 };
 
 template <class _Cp>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 __bit_iterator<_Cp, false>
+_LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI __bit_iterator<_Cp, false>
 rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle, __bit_iterator<_Cp, false> __last)
 {
     typedef __bit_iterator<_Cp, false> _I1;
@@ -974,7 +972,7 @@ rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle,
 // equal
 
 template <class _Cp, bool _IC1, bool _IC2>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 bool
+_LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool
 __equal_unaligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1,
                   __bit_iterator<_Cp, _IC2> __first2)
 {
@@ -1056,7 +1054,7 @@ __equal_unaligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1>
 }
 
 template <class _Cp, bool _IC1, bool _IC2>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 bool
+_LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool
 __equal_aligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1,
                 __bit_iterator<_Cp, _IC2> __first2)
 {

diff  --git a/libcxx/include/__chrono/duration.h b/libcxx/include/__chrono/duration.h
index c502574fb267d..4345fffbc1564 100644
--- a/libcxx/include/__chrono/duration.h
+++ b/libcxx/include/__chrono/duration.h
@@ -534,67 +534,67 @@ inline namespace literals
   inline namespace chrono_literals
   {
 
-    constexpr chrono::hours operator""h(unsigned long long __h)
+    _LIBCPP_HIDE_FROM_ABI constexpr chrono::hours operator""h(unsigned long long __h)
     {
         return chrono::hours(static_cast<chrono::hours::rep>(__h));
     }
 
-    constexpr chrono::duration<long double, ratio<3600,1>> operator""h(long double __h)
+    _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, ratio<3600,1>> operator""h(long double __h)
     {
         return chrono::duration<long double, ratio<3600,1>>(__h);
     }
 
 
-    constexpr chrono::minutes operator""min(unsigned long long __m)
+    _LIBCPP_HIDE_FROM_ABI constexpr chrono::minutes operator""min(unsigned long long __m)
     {
         return chrono::minutes(static_cast<chrono::minutes::rep>(__m));
     }
 
-    constexpr chrono::duration<long double, ratio<60,1>> operator""min(long double __m)
+    _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, ratio<60,1>> operator""min(long double __m)
     {
         return chrono::duration<long double, ratio<60,1>> (__m);
     }
 
 
-    constexpr chrono::seconds operator""s(unsigned long long __s)
+    _LIBCPP_HIDE_FROM_ABI constexpr chrono::seconds operator""s(unsigned long long __s)
     {
         return chrono::seconds(static_cast<chrono::seconds::rep>(__s));
     }
 
-    constexpr chrono::duration<long double> operator""s(long double __s)
+    _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double> operator""s(long double __s)
     {
         return chrono::duration<long double> (__s);
     }
 
 
-    constexpr chrono::milliseconds operator""ms(unsigned long long __ms)
+    _LIBCPP_HIDE_FROM_ABI constexpr chrono::milliseconds operator""ms(unsigned long long __ms)
     {
         return chrono::milliseconds(static_cast<chrono::milliseconds::rep>(__ms));
     }
 
-    constexpr chrono::duration<long double, milli> operator""ms(long double __ms)
+    _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, milli> operator""ms(long double __ms)
     {
         return chrono::duration<long double, milli>(__ms);
     }
 
 
-    constexpr chrono::microseconds operator""us(unsigned long long __us)
+    _LIBCPP_HIDE_FROM_ABI constexpr chrono::microseconds operator""us(unsigned long long __us)
     {
         return chrono::microseconds(static_cast<chrono::microseconds::rep>(__us));
     }
 
-    constexpr chrono::duration<long double, micro> operator""us(long double __us)
+    _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, micro> operator""us(long double __us)
     {
         return chrono::duration<long double, micro> (__us);
     }
 
 
-    constexpr chrono::nanoseconds operator""ns(unsigned long long __ns)
+    _LIBCPP_HIDE_FROM_ABI constexpr chrono::nanoseconds operator""ns(unsigned long long __ns)
     {
         return chrono::nanoseconds(static_cast<chrono::nanoseconds::rep>(__ns));
     }
 
-    constexpr chrono::duration<long double, nano> operator""ns(long double __ns)
+    _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, nano> operator""ns(long double __ns)
     {
         return chrono::duration<long double, nano> (__ns);
     }

diff  --git a/libcxx/include/__format/formatter_floating_point.h b/libcxx/include/__format/formatter_floating_point.h
index 90a76193196e7..16be89347b8ac 100644
--- a/libcxx/include/__format/formatter_floating_point.h
+++ b/libcxx/include/__format/formatter_floating_point.h
@@ -103,7 +103,7 @@ template <class _Tp>
 struct __traits;
 
 template <floating_point _Fp>
-static constexpr size_t __float_buffer_size(int __precision) {
+_LIBCPP_HIDE_FROM_ABI constexpr size_t __float_buffer_size(int __precision) {
   using _Traits = __traits<_Fp>;
   return 4 + _Traits::__max_integral + __precision + _Traits::__max_fractional_value;
 }

diff  --git a/libcxx/include/__functional/invoke.h b/libcxx/include/__functional/invoke.h
index d56a0accdbcef..ca3e9dc900f56 100644
--- a/libcxx/include/__functional/invoke.h
+++ b/libcxx/include/__functional/invoke.h
@@ -524,7 +524,7 @@ template <class _Fn, class... _Args>
 using invoke_result_t = typename invoke_result<_Fn, _Args...>::type;
 
 template <class _Fn, class ..._Args>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 invoke_result_t<_Fn, _Args...>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 invoke_result_t<_Fn, _Args...>
 invoke(_Fn&& __f, _Args&&... __args)
     noexcept(is_nothrow_invocable_v<_Fn, _Args...>)
 {

diff  --git a/libcxx/include/__iterator/common_iterator.h b/libcxx/include/__iterator/common_iterator.h
index abcc0b675e635..4de57c5d67c08 100644
--- a/libcxx/include/__iterator/common_iterator.h
+++ b/libcxx/include/__iterator/common_iterator.h
@@ -147,6 +147,7 @@ class common_iterator {
 
   template<class _I2, sentinel_for<_Iter> _S2>
     requires sentinel_for<_Sent, _I2>
+  _LIBCPP_HIDE_FROM_ABI
   friend constexpr bool operator==(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) {
     _LIBCPP_ASSERT(!__x.__hold_.valueless_by_exception(), "Attempted to compare a valueless common_iterator");
     _LIBCPP_ASSERT(!__y.__hold_.valueless_by_exception(), "Attempted to compare a valueless common_iterator");
@@ -165,6 +166,7 @@ class common_iterator {
 
   template<class _I2, sentinel_for<_Iter> _S2>
     requires sentinel_for<_Sent, _I2> && equality_comparable_with<_Iter, _I2>
+  _LIBCPP_HIDE_FROM_ABI
   friend constexpr bool operator==(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) {
     _LIBCPP_ASSERT(!__x.__hold_.valueless_by_exception(), "Attempted to compare a valueless common_iterator");
     _LIBCPP_ASSERT(!__y.__hold_.valueless_by_exception(), "Attempted to compare a valueless common_iterator");
@@ -186,6 +188,7 @@ class common_iterator {
 
   template<sized_sentinel_for<_Iter> _I2, sized_sentinel_for<_Iter> _S2>
     requires sized_sentinel_for<_Sent, _I2>
+  _LIBCPP_HIDE_FROM_ABI
   friend constexpr iter_
diff erence_t<_I2> operator-(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) {
     _LIBCPP_ASSERT(!__x.__hold_.valueless_by_exception(), "Attempted to subtract from a valueless common_iterator");
     _LIBCPP_ASSERT(!__y.__hold_.valueless_by_exception(), "Attempted to subtract a valueless common_iterator");
@@ -205,7 +208,7 @@ class common_iterator {
     return _VSTD::__unchecked_get<_Sent>(__x.__hold_) - _VSTD::__unchecked_get<_I2>(__y.__hold_);
   }
 
-  friend constexpr iter_rvalue_reference_t<_Iter> iter_move(const common_iterator& __i)
+  _LIBCPP_HIDE_FROM_ABI friend constexpr iter_rvalue_reference_t<_Iter> iter_move(const common_iterator& __i)
     noexcept(noexcept(ranges::iter_move(declval<const _Iter&>())))
       requires input_iterator<_Iter>
   {
@@ -214,7 +217,7 @@ class common_iterator {
   }
 
   template<indirectly_swappable<_Iter> _I2, class _S2>
-  friend constexpr void iter_swap(const common_iterator& __x, const common_iterator<_I2, _S2>& __y)
+  _LIBCPP_HIDE_FROM_ABI friend constexpr void iter_swap(const common_iterator& __x, const common_iterator<_I2, _S2>& __y)
       noexcept(noexcept(ranges::iter_swap(declval<const _Iter&>(), declval<const _I2&>())))
   {
     _LIBCPP_ASSERT(holds_alternative<_Iter>(__x.__hold_), "Attempted to iter_swap a non-dereferenceable common_iterator");

diff  --git a/libcxx/include/__iterator/counted_iterator.h b/libcxx/include/__iterator/counted_iterator.h
index b0f5c66ecf21b..28b3e36bdc000 100644
--- a/libcxx/include/__iterator/counted_iterator.h
+++ b/libcxx/include/__iterator/counted_iterator.h
@@ -263,7 +263,7 @@ class counted_iterator
   }
 
   template<common_with<_Iter> _I2>
-  friend constexpr strong_ordering operator<=>(
+  _LIBCPP_HIDE_FROM_ABI friend constexpr strong_ordering operator<=>(
     const counted_iterator& __lhs, const counted_iterator<_I2>& __rhs)
   {
     return __rhs.__count_ <=> __lhs.__count_;

diff  --git a/libcxx/include/__memory/shared_ptr.h b/libcxx/include/__memory/shared_ptr.h
index a450cba89318e..609dec709c8cb 100644
--- a/libcxx/include/__memory/shared_ptr.h
+++ b/libcxx/include/__memory/shared_ptr.h
@@ -1383,7 +1383,7 @@ dynamic_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT
 }
 
 template<class _Tp, class _Up>
-shared_ptr<_Tp>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>
 const_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT
 {
     typedef typename shared_ptr<_Tp>::element_type _RTp;
@@ -1391,7 +1391,7 @@ const_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT
 }
 
 template<class _Tp, class _Up>
-shared_ptr<_Tp>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>
 reinterpret_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT
 {
     return shared_ptr<_Tp>(__r,
@@ -1825,7 +1825,7 @@ atomic_is_lock_free(const shared_ptr<_Tp>*)
 
 template <class _Tp>
 _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
-shared_ptr<_Tp>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>
 atomic_load(const shared_ptr<_Tp>* __p)
 {
     __sp_mut& __m = __get_sp_mut(__p);
@@ -1846,7 +1846,7 @@ atomic_load_explicit(const shared_ptr<_Tp>* __p, memory_order)
 
 template <class _Tp>
 _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
-void
+_LIBCPP_HIDE_FROM_ABI void
 atomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r)
 {
     __sp_mut& __m = __get_sp_mut(__p);
@@ -1866,7 +1866,7 @@ atomic_store_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order)
 
 template <class _Tp>
 _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
-shared_ptr<_Tp>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>
 atomic_exchange(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r)
 {
     __sp_mut& __m = __get_sp_mut(__p);
@@ -1887,7 +1887,7 @@ atomic_exchange_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order
 
 template <class _Tp>
 _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
-bool
+_LIBCPP_HIDE_FROM_ABI bool
 atomic_compare_exchange_strong(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w)
 {
     shared_ptr<_Tp> __temp;

diff  --git a/libcxx/include/__memory/temporary_buffer.h b/libcxx/include/__memory/temporary_buffer.h
index b1f7a126299f6..c917f041a0147 100644
--- a/libcxx/include/__memory/temporary_buffer.h
+++ b/libcxx/include/__memory/temporary_buffer.h
@@ -23,7 +23,7 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _Tp>
-_LIBCPP_NODISCARD_EXT _LIBCPP_NO_CFI _LIBCPP_DEPRECATED_IN_CXX17
+_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI _LIBCPP_DEPRECATED_IN_CXX17
 pair<_Tp*, ptr
diff _t>
 get_temporary_buffer(ptr
diff _t __n) _NOEXCEPT
 {

diff  --git a/libcxx/include/__memory/uninitialized_algorithms.h b/libcxx/include/__memory/uninitialized_algorithms.h
index 4f3d4e90cb6e2..48c75762073c6 100644
--- a/libcxx/include/__memory/uninitialized_algorithms.h
+++ b/libcxx/include/__memory/uninitialized_algorithms.h
@@ -64,6 +64,7 @@ __uninitialized_copy(_InputIterator __ifirst, _Sentinel1 __ilast,
 }
 
 template <class _InputIterator, class _ForwardIterator>
+_LIBCPP_HIDE_FROM_ABI
 _ForwardIterator uninitialized_copy(_InputIterator __ifirst, _InputIterator __ilast,
                                     _ForwardIterator __ofirst) {
   typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;

diff  --git a/libcxx/include/__numeric/midpoint.h b/libcxx/include/__numeric/midpoint.h
index 668030c46bcba..d8cce7929bf79 100644
--- a/libcxx/include/__numeric/midpoint.h
+++ b/libcxx/include/__numeric/midpoint.h
@@ -55,12 +55,12 @@ midpoint(_TPtr __a, _TPtr __b) noexcept
 
 
 template <typename _Tp>
-constexpr int __sign(_Tp __val) {
+_LIBCPP_HIDE_FROM_ABI constexpr int __sign(_Tp __val) {
     return (_Tp(0) < __val) - (__val < _Tp(0));
 }
 
 template <typename _Fp>
-constexpr _Fp __fp_abs(_Fp __f) { return __f >= 0 ? __f : -__f; }
+_LIBCPP_HIDE_FROM_ABI constexpr _Fp __fp_abs(_Fp __f) { return __f >= 0 ? __f : -__f; }
 
 template <class _Fp>
 _LIBCPP_INLINE_VISIBILITY constexpr

diff  --git a/libcxx/include/__random/bernoulli_distribution.h b/libcxx/include/__random/bernoulli_distribution.h
index e97d53f5a4210..e38d3dfb894a3 100644
--- a/libcxx/include/__random/bernoulli_distribution.h
+++ b/libcxx/include/__random/bernoulli_distribution.h
@@ -110,7 +110,7 @@ bernoulli_distribution::operator()(_URNG& __g, const param_type& __p)
 }
 
 template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os, const bernoulli_distribution& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__os);
@@ -123,7 +123,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bernoulli_distribution& _
 }
 
 template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is, bernoulli_distribution& __x)
 {
     typedef bernoulli_distribution _Eng;

diff  --git a/libcxx/include/__random/binomial_distribution.h b/libcxx/include/__random/binomial_distribution.h
index af60fa2a38e06..28f176e14f0d2 100644
--- a/libcxx/include/__random/binomial_distribution.h
+++ b/libcxx/include/__random/binomial_distribution.h
@@ -189,7 +189,7 @@ binomial_distribution<_IntType>::operator()(_URNG& __g, const param_type& __pr)
 }
 
 template <class _CharT, class _Traits, class _IntType>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            const binomial_distribution<_IntType>& __x)
 {
@@ -203,7 +203,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
 }
 
 template <class _CharT, class _Traits, class _IntType>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is,
            binomial_distribution<_IntType>& __x)
 {

diff  --git a/libcxx/include/__random/cauchy_distribution.h b/libcxx/include/__random/cauchy_distribution.h
index 5bc44ee8dd4ca..2fda6b5383767 100644
--- a/libcxx/include/__random/cauchy_distribution.h
+++ b/libcxx/include/__random/cauchy_distribution.h
@@ -124,7 +124,7 @@ cauchy_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
 }
 
 template <class _CharT, class _Traits, class _RT>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            const cauchy_distribution<_RT>& __x)
 {
@@ -139,7 +139,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
 }
 
 template <class _CharT, class _Traits, class _RT>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is,
            cauchy_distribution<_RT>& __x)
 {

diff  --git a/libcxx/include/__random/chi_squared_distribution.h b/libcxx/include/__random/chi_squared_distribution.h
index b98488c20d280..f2922b64dd6cf 100644
--- a/libcxx/include/__random/chi_squared_distribution.h
+++ b/libcxx/include/__random/chi_squared_distribution.h
@@ -107,7 +107,7 @@ class _LIBCPP_TEMPLATE_VIS chi_squared_distribution
 };
 
 template <class _CharT, class _Traits, class _RT>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            const chi_squared_distribution<_RT>& __x)
 {
@@ -120,7 +120,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
 }
 
 template <class _CharT, class _Traits, class _RT>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is,
            chi_squared_distribution<_RT>& __x)
 {

diff  --git a/libcxx/include/__random/discard_block_engine.h b/libcxx/include/__random/discard_block_engine.h
index c58d66b588696..57f454b560d22 100644
--- a/libcxx/include/__random/discard_block_engine.h
+++ b/libcxx/include/__random/discard_block_engine.h
@@ -164,7 +164,7 @@ operator!=(const discard_block_engine<_Eng, _Pp, _Rp>& __x,
 
 template <class _CharT, class _Traits,
           class _Eng, size_t _Pp, size_t _Rp>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            const discard_block_engine<_Eng, _Pp, _Rp>& __x)
 {
@@ -178,7 +178,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
 
 template <class _CharT, class _Traits,
           class _Eng, size_t _Pp, size_t _Rp>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is,
            discard_block_engine<_Eng, _Pp, _Rp>& __x)
 {

diff  --git a/libcxx/include/__random/discrete_distribution.h b/libcxx/include/__random/discrete_distribution.h
index 8dc63c0e98b49..03f49ba872394 100644
--- a/libcxx/include/__random/discrete_distribution.h
+++ b/libcxx/include/__random/discrete_distribution.h
@@ -221,7 +221,7 @@ discrete_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p)
 }
 
 template <class _CharT, class _Traits, class _IT>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            const discrete_distribution<_IT>& __x)
 {
@@ -239,7 +239,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
 }
 
 template <class _CharT, class _Traits, class _IT>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is,
            discrete_distribution<_IT>& __x)
 {

diff  --git a/libcxx/include/__random/exponential_distribution.h b/libcxx/include/__random/exponential_distribution.h
index 1c9e9e0d9ef1b..8edf1ac3f68c7 100644
--- a/libcxx/include/__random/exponential_distribution.h
+++ b/libcxx/include/__random/exponential_distribution.h
@@ -121,7 +121,7 @@ exponential_distribution<_RealType>::operator()(_URNG& __g, const param_type& __
 }
 
 template <class _CharT, class _Traits, class _RealType>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            const exponential_distribution<_RealType>& __x)
 {
@@ -133,7 +133,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
 }
 
 template <class _CharT, class _Traits, class _RealType>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is,
            exponential_distribution<_RealType>& __x)
 {

diff  --git a/libcxx/include/__random/extreme_value_distribution.h b/libcxx/include/__random/extreme_value_distribution.h
index ba30aa5b88c31..b3cba392490b0 100644
--- a/libcxx/include/__random/extreme_value_distribution.h
+++ b/libcxx/include/__random/extreme_value_distribution.h
@@ -123,7 +123,7 @@ extreme_value_distribution<_RealType>::operator()(_URNG& __g, const param_type&
 }
 
 template <class _CharT, class _Traits, class _RT>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            const extreme_value_distribution<_RT>& __x)
 {
@@ -138,7 +138,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
 }
 
 template <class _CharT, class _Traits, class _RT>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is,
            extreme_value_distribution<_RT>& __x)
 {

diff  --git a/libcxx/include/__random/fisher_f_distribution.h b/libcxx/include/__random/fisher_f_distribution.h
index 60c7f28c0bb0f..b5479acb47c6b 100644
--- a/libcxx/include/__random/fisher_f_distribution.h
+++ b/libcxx/include/__random/fisher_f_distribution.h
@@ -122,7 +122,7 @@ fisher_f_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
 }
 
 template <class _CharT, class _Traits, class _RT>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            const fisher_f_distribution<_RT>& __x)
 {
@@ -137,7 +137,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
 }
 
 template <class _CharT, class _Traits, class _RT>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is,
            fisher_f_distribution<_RT>& __x)
 {

diff  --git a/libcxx/include/__random/gamma_distribution.h b/libcxx/include/__random/gamma_distribution.h
index 986d79b67aa33..0d7fc3f828006 100644
--- a/libcxx/include/__random/gamma_distribution.h
+++ b/libcxx/include/__random/gamma_distribution.h
@@ -175,7 +175,7 @@ gamma_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
 }
 
 template <class _CharT, class _Traits, class _RT>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            const gamma_distribution<_RT>& __x)
 {
@@ -190,7 +190,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
 }
 
 template <class _CharT, class _Traits, class _RT>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is,
            gamma_distribution<_RT>& __x)
 {

diff  --git a/libcxx/include/__random/generate_canonical.h b/libcxx/include/__random/generate_canonical.h
index 84efa7803c945..5fada6df5903b 100644
--- a/libcxx/include/__random/generate_canonical.h
+++ b/libcxx/include/__random/generate_canonical.h
@@ -27,7 +27,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 // generate_canonical
 
 template<class _RealType, size_t __bits, class _URNG>
-_RealType
+_LIBCPP_HIDE_FROM_ABI _RealType
 generate_canonical(_URNG& __g)
 {
     const size_t _Dt = numeric_limits<_RealType>::digits;

diff  --git a/libcxx/include/__random/geometric_distribution.h b/libcxx/include/__random/geometric_distribution.h
index 751cf7860e66f..8f9bdffc7c201 100644
--- a/libcxx/include/__random/geometric_distribution.h
+++ b/libcxx/include/__random/geometric_distribution.h
@@ -108,7 +108,7 @@ class _LIBCPP_TEMPLATE_VIS geometric_distribution
 };
 
 template <class _CharT, class _Traits, class _IntType>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            const geometric_distribution<_IntType>& __x)
 {
@@ -120,7 +120,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
 }
 
 template <class _CharT, class _Traits, class _IntType>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is,
            geometric_distribution<_IntType>& __x)
 {

diff  --git a/libcxx/include/__random/independent_bits_engine.h b/libcxx/include/__random/independent_bits_engine.h
index e80d6eec49cbc..983918a3c2873 100644
--- a/libcxx/include/__random/independent_bits_engine.h
+++ b/libcxx/include/__random/independent_bits_engine.h
@@ -244,7 +244,7 @@ operator!=(
 
 template <class _CharT, class _Traits,
           class _Eng, size_t _Wp, class _UInt>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            const independent_bits_engine<_Eng, _Wp, _UInt>& __x)
 {
@@ -253,7 +253,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
 
 template <class _CharT, class _Traits,
           class _Eng, size_t _Wp, class _UInt>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is,
            independent_bits_engine<_Eng, _Wp, _UInt>& __x)
 {

diff  --git a/libcxx/include/__random/linear_congruential_engine.h b/libcxx/include/__random/linear_congruential_engine.h
index 42b40813e0ac8..0d91f14120b64 100644
--- a/libcxx/include/__random/linear_congruential_engine.h
+++ b/libcxx/include/__random/linear_congruential_engine.h
@@ -198,7 +198,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
 
 template <class _CharT, class _Traits,
           class _Up, _Up _Ap, _Up _Cp, _Up _Np>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is,
            linear_congruential_engine<_Up, _Ap, _Cp, _Np>& __x);
 
@@ -372,7 +372,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
 
 template <class _CharT, class _Traits,
           class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is,
            linear_congruential_engine<_UIntType, __a, __c, __m>& __x)
 {

diff  --git a/libcxx/include/__random/mersenne_twister_engine.h b/libcxx/include/__random/mersenne_twister_engine.h
index 8bceac05dce99..3a58e311b0019 100644
--- a/libcxx/include/__random/mersenne_twister_engine.h
+++ b/libcxx/include/__random/mersenne_twister_engine.h
@@ -36,7 +36,7 @@ class _LIBCPP_TEMPLATE_VIS mersenne_twister_engine;
 template <class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
           _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
           _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
-bool
+_LIBCPP_HIDE_FROM_ABI bool
 operator==(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
                                          _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
            const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
@@ -56,7 +56,7 @@ template <class _CharT, class _Traits,
           class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
           _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
           _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
                                          _Bp, _Tp, _Cp, _Lp, _Fp>& __x);
@@ -65,7 +65,7 @@ template <class _CharT, class _Traits,
           class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
           _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
           _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is,
            mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
                                    _Bp, _Tp, _Cp, _Lp, _Fp>& __x);
@@ -416,7 +416,7 @@ mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b,
 template <class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
           _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
           _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
-bool
+_LIBCPP_HIDE_FROM_ABI bool
 operator==(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
                                          _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
            const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
@@ -474,7 +474,7 @@ template <class _CharT, class _Traits,
           class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
           _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
           _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
                                          _Bp, _Tp, _Cp, _Lp, _Fp>& __x)
@@ -496,7 +496,7 @@ template <class _CharT, class _Traits,
           class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
           _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
           _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is,
            mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
                                    _Bp, _Tp, _Cp, _Lp, _Fp>& __x)

diff  --git a/libcxx/include/__random/negative_binomial_distribution.h b/libcxx/include/__random/negative_binomial_distribution.h
index 90d3f01789146..333c9350cd726 100644
--- a/libcxx/include/__random/negative_binomial_distribution.h
+++ b/libcxx/include/__random/negative_binomial_distribution.h
@@ -144,7 +144,7 @@ negative_binomial_distribution<_IntType>::operator()(_URNG& __urng, const param_
 }
 
 template <class _CharT, class _Traits, class _IntType>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            const negative_binomial_distribution<_IntType>& __x)
 {
@@ -158,7 +158,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
 }
 
 template <class _CharT, class _Traits, class _IntType>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is,
            negative_binomial_distribution<_IntType>& __x)
 {

diff  --git a/libcxx/include/__random/normal_distribution.h b/libcxx/include/__random/normal_distribution.h
index 0431df9272001..3df62d65d1c21 100644
--- a/libcxx/include/__random/normal_distribution.h
+++ b/libcxx/include/__random/normal_distribution.h
@@ -160,7 +160,7 @@ normal_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
 }
 
 template <class _CharT, class _Traits, class _RT>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            const normal_distribution<_RT>& __x)
 {
@@ -177,7 +177,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
 }
 
 template <class _CharT, class _Traits, class _RT>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is,
            normal_distribution<_RT>& __x)
 {

diff  --git a/libcxx/include/__random/piecewise_constant_distribution.h b/libcxx/include/__random/piecewise_constant_distribution.h
index 9c9e14b16d6e3..a1f3ef9df50ea 100644
--- a/libcxx/include/__random/piecewise_constant_distribution.h
+++ b/libcxx/include/__random/piecewise_constant_distribution.h
@@ -294,7 +294,7 @@ piecewise_constant_distribution<_RealType>::operator()(_URNG& __g, const param_t
 }
 
 template <class _CharT, class _Traits, class _RT>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            const piecewise_constant_distribution<_RT>& __x)
 {
@@ -320,7 +320,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
 }
 
 template <class _CharT, class _Traits, class _RT>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is,
            piecewise_constant_distribution<_RT>& __x)
 {

diff  --git a/libcxx/include/__random/piecewise_linear_distribution.h b/libcxx/include/__random/piecewise_linear_distribution.h
index 05f00cef06efe..fc2eb47c7b0fc 100644
--- a/libcxx/include/__random/piecewise_linear_distribution.h
+++ b/libcxx/include/__random/piecewise_linear_distribution.h
@@ -310,7 +310,7 @@ piecewise_linear_distribution<_RealType>::operator()(_URNG& __g, const param_typ
 }
 
 template <class _CharT, class _Traits, class _RT>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            const piecewise_linear_distribution<_RT>& __x)
 {
@@ -336,7 +336,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
 }
 
 template <class _CharT, class _Traits, class _RT>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is,
            piecewise_linear_distribution<_RT>& __x)
 {

diff  --git a/libcxx/include/__random/poisson_distribution.h b/libcxx/include/__random/poisson_distribution.h
index ef55b1be48444..334c6102b3410 100644
--- a/libcxx/include/__random/poisson_distribution.h
+++ b/libcxx/include/__random/poisson_distribution.h
@@ -245,7 +245,7 @@ poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr
 }
 
 template <class _CharT, class _Traits, class _IntType>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            const poisson_distribution<_IntType>& __x)
 {
@@ -257,7 +257,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
 }
 
 template <class _CharT, class _Traits, class _IntType>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is,
            poisson_distribution<_IntType>& __x)
 {

diff  --git a/libcxx/include/__random/shuffle_order_engine.h b/libcxx/include/__random/shuffle_order_engine.h
index c2f76f609ae57..fc7a4721520ca 100644
--- a/libcxx/include/__random/shuffle_order_engine.h
+++ b/libcxx/include/__random/shuffle_order_engine.h
@@ -215,7 +215,7 @@ template<class _Engine, size_t __k>
     _LIBCPP_CONSTEXPR const size_t shuffle_order_engine<_Engine, __k>::table_size;
 
 template<class _Eng, size_t _Kp>
-bool
+_LIBCPP_HIDE_FROM_ABI bool
 operator==(
     const shuffle_order_engine<_Eng, _Kp>& __x,
     const shuffle_order_engine<_Eng, _Kp>& __y)
@@ -236,7 +236,7 @@ operator!=(
 
 template <class _CharT, class _Traits,
           class _Eng, size_t _Kp>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            const shuffle_order_engine<_Eng, _Kp>& __x)
 {
@@ -253,7 +253,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
 
 template <class _CharT, class _Traits,
           class _Eng, size_t _Kp>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is,
            shuffle_order_engine<_Eng, _Kp>& __x)
 {

diff  --git a/libcxx/include/__random/student_t_distribution.h b/libcxx/include/__random/student_t_distribution.h
index 9e95f97cefabe..64847aa66ae71 100644
--- a/libcxx/include/__random/student_t_distribution.h
+++ b/libcxx/include/__random/student_t_distribution.h
@@ -118,7 +118,7 @@ student_t_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
 }
 
 template <class _CharT, class _Traits, class _RT>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            const student_t_distribution<_RT>& __x)
 {
@@ -131,7 +131,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
 }
 
 template <class _CharT, class _Traits, class _RT>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is,
            student_t_distribution<_RT>& __x)
 {

diff  --git a/libcxx/include/__random/subtract_with_carry_engine.h b/libcxx/include/__random/subtract_with_carry_engine.h
index fdbe2d2e9be34..b25ca84e3afd7 100644
--- a/libcxx/include/__random/subtract_with_carry_engine.h
+++ b/libcxx/include/__random/subtract_with_carry_engine.h
@@ -33,7 +33,7 @@ template<class _UIntType, size_t __w, size_t __s, size_t __r>
 class _LIBCPP_TEMPLATE_VIS subtract_with_carry_engine;
 
 template<class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
-bool
+_LIBCPP_HIDE_FROM_ABI bool
 operator==(
     const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
     const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y);
@@ -47,13 +47,13 @@ operator!=(
 
 template <class _CharT, class _Traits,
           class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x);
 
 template <class _CharT, class _Traits,
           class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is,
            subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x);
 
@@ -251,7 +251,7 @@ subtract_with_carry_engine<_UIntType, __w, __s, __r>::operator()()
 }
 
 template<class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
-bool
+_LIBCPP_HIDE_FROM_ABI bool
 operator==(
     const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
     const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y)
@@ -305,7 +305,7 @@ operator!=(
 
 template <class _CharT, class _Traits,
           class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x)
 {
@@ -325,7 +325,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
 
 template <class _CharT, class _Traits,
           class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is,
            subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x)
 {

diff  --git a/libcxx/include/__random/uniform_int_distribution.h b/libcxx/include/__random/uniform_int_distribution.h
index 46b627f45da93..51e3a915484f7 100644
--- a/libcxx/include/__random/uniform_int_distribution.h
+++ b/libcxx/include/__random/uniform_int_distribution.h
@@ -178,8 +178,10 @@ class uniform_int_distribution
         result_type a() const {return __a_;}
         result_type b() const {return __b_;}
 
+        _LIBCPP_HIDE_FROM_ABI
         friend bool operator==(const param_type& __x, const param_type& __y)
             {return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;}
+        _LIBCPP_HIDE_FROM_ABI
         friend bool operator!=(const param_type& __x, const param_type& __y)
             {return !(__x == __y);}
     };
@@ -218,9 +220,11 @@ class uniform_int_distribution
     result_type min() const {return a();}
     result_type max() const {return b();}
 
+    _LIBCPP_HIDE_FROM_ABI
     friend bool operator==(const uniform_int_distribution& __x,
                            const uniform_int_distribution& __y)
         {return __x.__p_ == __y.__p_;}
+    _LIBCPP_HIDE_FROM_ABI
     friend bool operator!=(const uniform_int_distribution& __x,
                            const uniform_int_distribution& __y)
             {return !(__x == __y);}
@@ -255,7 +259,7 @@ _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
 }
 
 template <class _CharT, class _Traits, class _IT>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            const uniform_int_distribution<_IT>& __x)
 {
@@ -268,7 +272,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
 }
 
 template <class _CharT, class _Traits, class _IT>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is,
            uniform_int_distribution<_IT>& __x)
 {

diff  --git a/libcxx/include/__random/uniform_real_distribution.h b/libcxx/include/__random/uniform_real_distribution.h
index 7d2ecda732fed..b52b68977f826 100644
--- a/libcxx/include/__random/uniform_real_distribution.h
+++ b/libcxx/include/__random/uniform_real_distribution.h
@@ -123,7 +123,7 @@ uniform_real_distribution<_RealType>::operator()(_URNG& __g, const param_type& _
 }
 
 template <class _CharT, class _Traits, class _RT>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            const uniform_real_distribution<_RT>& __x)
 {
@@ -137,7 +137,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
 }
 
 template <class _CharT, class _Traits, class _RT>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is,
            uniform_real_distribution<_RT>& __x)
 {

diff  --git a/libcxx/include/__random/weibull_distribution.h b/libcxx/include/__random/weibull_distribution.h
index 85bae65096cba..df834e6557c83 100644
--- a/libcxx/include/__random/weibull_distribution.h
+++ b/libcxx/include/__random/weibull_distribution.h
@@ -115,7 +115,7 @@ class _LIBCPP_TEMPLATE_VIS weibull_distribution
 };
 
 template <class _CharT, class _Traits, class _RT>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            const weibull_distribution<_RT>& __x)
 {
@@ -130,7 +130,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
 }
 
 template <class _CharT, class _Traits, class _RT>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is,
            weibull_distribution<_RT>& __x)
 {

diff  --git a/libcxx/include/__ranges/iota_view.h b/libcxx/include/__ranges/iota_view.h
index e1f03bafa03a7..bb967e62015e8 100644
--- a/libcxx/include/__ranges/iota_view.h
+++ b/libcxx/include/__ranges/iota_view.h
@@ -221,6 +221,7 @@ namespace ranges {
         return !(__x < __y);
       }
 
+      _LIBCPP_HIDE_FROM_ABI
       friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y)
         requires totally_ordered<_Start> && three_way_comparable<_Start>
       {

diff  --git a/libcxx/include/__string/char_traits.h b/libcxx/include/__string/char_traits.h
index 7635835a6510c..f272a24d2b074 100644
--- a/libcxx/include/__string/char_traits.h
+++ b/libcxx/include/__string/char_traits.h
@@ -166,7 +166,7 @@ char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a)
 }
 
 template <class _CharT>
-static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_HIDE_FROM_ABI static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
 _CharT* __char_traits_move(_CharT* __dest, const _CharT* __source, size_t __n) _NOEXCEPT
 {
 #ifdef _LIBCPP_COMPILER_GCC
@@ -729,7 +729,7 @@ __str_find(const _CharT *__p, _SizeT __sz,
 }
 
 template <class _CharT, class _Traits>
-inline _LIBCPP_CONSTEXPR_AFTER_CXX11 const _CharT *
+_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR_AFTER_CXX11 const _CharT *
 __search_substring(const _CharT *__first1, const _CharT *__last1,
                    const _CharT *__first2, const _CharT *__last2) _NOEXCEPT {
   // Take advantage of knowing source and pattern lengths.

diff  --git a/libcxx/include/__tree b/libcxx/include/__tree
index 59525a03047ae..dac1596de1baa 100644
--- a/libcxx/include/__tree
+++ b/libcxx/include/__tree
@@ -126,7 +126,7 @@ __tree_sub_invariant(_NodePtr __x)
 //    __root == nullptr is a proper tree.  Returns true is __root is a proper
 //    red black tree, else returns false.
 template <class _NodePtr>
-bool
+_LIBCPP_HIDE_FROM_ABI bool
 __tree_invariant(_NodePtr __root)
 {
     if (__root == nullptr)
@@ -169,7 +169,7 @@ __tree_max(_NodePtr __x) _NOEXCEPT
 
 // Returns:  pointer to the next in-order node after __x.
 template <class _NodePtr>
-_NodePtr
+_LIBCPP_HIDE_FROM_ABI _NodePtr
 __tree_next(_NodePtr __x) _NOEXCEPT
 {
     _LIBCPP_ASSERT(__x != nullptr, "node shouldn't be null");
@@ -211,7 +211,7 @@ __tree_prev_iter(_EndNodePtr __x) _NOEXCEPT
 
 // Returns:  pointer to a node which has no children
 template <class _NodePtr>
-_NodePtr
+_LIBCPP_HIDE_FROM_ABI _NodePtr
 __tree_leaf(_NodePtr __x) _NOEXCEPT
 {
     _LIBCPP_ASSERT(__x != nullptr, "node shouldn't be null");
@@ -235,7 +235,7 @@ __tree_leaf(_NodePtr __x) _NOEXCEPT
 // Effects:  Makes __x->__right_ the subtree root with __x as its left child
 //           while preserving in-order order.
 template <class _NodePtr>
-void
+_LIBCPP_HIDE_FROM_ABI void
 __tree_left_rotate(_NodePtr __x) _NOEXCEPT
 {
     _LIBCPP_ASSERT(__x != nullptr, "node shouldn't be null");
@@ -256,7 +256,7 @@ __tree_left_rotate(_NodePtr __x) _NOEXCEPT
 // Effects:  Makes __x->__left_ the subtree root with __x as its right child
 //           while preserving in-order order.
 template <class _NodePtr>
-void
+_LIBCPP_HIDE_FROM_ABI void
 __tree_right_rotate(_NodePtr __x) _NOEXCEPT
 {
     _LIBCPP_ASSERT(__x != nullptr, "node shouldn't be null");
@@ -282,7 +282,7 @@ __tree_right_rotate(_NodePtr __x) _NOEXCEPT
 // Postcondition: __tree_invariant(end_node->__left_) == true.  end_node->__left_
 //                may be 
diff erent than the value passed in as __root.
 template <class _NodePtr>
-void
+_LIBCPP_HIDE_FROM_ABI void
 __tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT
 {
     _LIBCPP_ASSERT(__root != nullptr, "Root of the tree shouldn't be null");
@@ -352,7 +352,7 @@ __tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT
 //                nor any of its children refer to __z.  end_node->__left_
 //                may be 
diff erent than the value passed in as __root.
 template <class _NodePtr>
-void
+_LIBCPP_HIDE_FROM_ABI void
 __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT
 {
     _LIBCPP_ASSERT(__root != nullptr, "Root node should not be null");

diff  --git a/libcxx/include/__type_traits/is_constant_evaluated.h b/libcxx/include/__type_traits/is_constant_evaluated.h
index de5ff6c43f407..ae903da3487a1 100644
--- a/libcxx/include/__type_traits/is_constant_evaluated.h
+++ b/libcxx/include/__type_traits/is_constant_evaluated.h
@@ -24,7 +24,7 @@ inline constexpr bool is_constant_evaluated() noexcept {
 }
 #endif
 
-inline _LIBCPP_CONSTEXPR
+_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR
 bool __libcpp_is_constant_evaluated() _NOEXCEPT { return __builtin_is_constant_evaluated(); }
 
 _LIBCPP_END_NAMESPACE_STD

diff  --git a/libcxx/include/__utility/as_const.h b/libcxx/include/__utility/as_const.h
index be7dd8c7cf23a..e28d7bc1a22ae 100644
--- a/libcxx/include/__utility/as_const.h
+++ b/libcxx/include/__utility/as_const.h
@@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 #if _LIBCPP_STD_VER > 14
 template <class _Tp>
-_LIBCPP_NODISCARD_EXT constexpr add_const_t<_Tp>& as_const(_Tp& __t) noexcept { return __t; }
+_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr add_const_t<_Tp>& as_const(_Tp& __t) noexcept { return __t; }
 
 template <class _Tp>
 void as_const(const _Tp&&) = delete;

diff  --git a/libcxx/include/bitset b/libcxx/include/bitset
index 0f997cef83163..28aad5dc37272 100644
--- a/libcxx/include/bitset
+++ b/libcxx/include/bitset
@@ -1098,11 +1098,11 @@ struct _LIBCPP_TEMPLATE_VIS hash<bitset<_Size> >
 };
 
 template <class _CharT, class _Traits, size_t _Size>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x);
 
 template <class _CharT, class _Traits, size_t _Size>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x);
 
 _LIBCPP_END_NAMESPACE_STD

diff  --git a/libcxx/include/cmath b/libcxx/include/cmath
index 4d81eed339d8f..65a853165a981 100644
--- a/libcxx/include/cmath
+++ b/libcxx/include/cmath
@@ -615,7 +615,7 @@ __libcpp_isfinite_or_builtin(_A1 __lcpp_x) _NOEXCEPT
 
 #if _LIBCPP_STD_VER > 17
 template <typename _Fp>
-constexpr
+_LIBCPP_HIDE_FROM_ABI constexpr
 _Fp __lerp(_Fp __a, _Fp __b, _Fp __t) noexcept {
     if ((__a <= 0 && __b >= 0) || (__a >= 0 && __b <= 0))
         return __t * __b + (1 - __t) * __a;
@@ -628,13 +628,13 @@ _Fp __lerp(_Fp __a, _Fp __b, _Fp __t) noexcept {
         return __x < __b ? __x : __b;
 }
 
-constexpr float
+_LIBCPP_HIDE_FROM_ABI constexpr float
 lerp(float __a, float __b, float __t)                   _NOEXCEPT { return __lerp(__a, __b, __t); }
 
-constexpr double
+_LIBCPP_HIDE_FROM_ABI constexpr double
 lerp(double __a, double __b, double __t)                _NOEXCEPT { return __lerp(__a, __b, __t); }
 
-constexpr long double
+_LIBCPP_HIDE_FROM_ABI constexpr long double
 lerp(long double __a, long double __b, long double __t) _NOEXCEPT { return __lerp(__a, __b, __t); }
 
 template <class _A1, class _A2, class _A3>

diff  --git a/libcxx/include/complex b/libcxx/include/complex
index 87a4e58724978..a14c4c3ba71f8 100644
--- a/libcxx/include/complex
+++ b/libcxx/include/complex
@@ -251,8 +251,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 template<class _Tp> class _LIBCPP_TEMPLATE_VIS complex;
 
-template<class _Tp> complex<_Tp> operator*(const complex<_Tp>& __z, const complex<_Tp>& __w);
-template<class _Tp> complex<_Tp> operator/(const complex<_Tp>& __x, const complex<_Tp>& __y);
+template<class _Tp> _LIBCPP_HIDE_FROM_ABI complex<_Tp> operator*(const complex<_Tp>& __z, const complex<_Tp>& __w);
+template<class _Tp> _LIBCPP_HIDE_FROM_ABI complex<_Tp> operator/(const complex<_Tp>& __x, const complex<_Tp>& __y);
 
 template<class _Tp>
 class _LIBCPP_TEMPLATE_VIS complex
@@ -583,7 +583,7 @@ operator-(const _Tp& __x, const complex<_Tp>& __y)
 }
 
 template<class _Tp>
-complex<_Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp>
 operator*(const complex<_Tp>& __z, const complex<_Tp>& __w)
 {
     _Tp __a = __z.real();
@@ -662,7 +662,7 @@ operator*(const _Tp& __x, const complex<_Tp>& __y)
 }
 
 template<class _Tp>
-complex<_Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp>
 operator/(const complex<_Tp>& __z, const complex<_Tp>& __w)
 {
     int __ilogbw = 0;
@@ -987,7 +987,7 @@ proj(_Tp __re)
 // polar
 
 template<class _Tp>
-complex<_Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp>
 polar(const _Tp& __rho, const _Tp& __theta = _Tp())
 {
     if (__libcpp_isnan_or_builtin(__rho) || signbit(__rho))
@@ -1036,7 +1036,7 @@ log10(const complex<_Tp>& __x)
 // sqrt
 
 template<class _Tp>
-complex<_Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp>
 sqrt(const complex<_Tp>& __x)
 {
     if (__libcpp_isinf_or_builtin(__x.imag()))
@@ -1053,7 +1053,7 @@ sqrt(const complex<_Tp>& __x)
 // exp
 
 template<class _Tp>
-complex<_Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp>
 exp(const complex<_Tp>& __x)
 {
     _Tp __i = __x.imag();
@@ -1137,7 +1137,7 @@ __sqr(const complex<_Tp>& __x)
 // asinh
 
 template<class _Tp>
-complex<_Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp>
 asinh(const complex<_Tp>& __x)
 {
     const _Tp __pi(atan2(+0., -0.));
@@ -1166,7 +1166,7 @@ asinh(const complex<_Tp>& __x)
 // acosh
 
 template<class _Tp>
-complex<_Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp>
 acosh(const complex<_Tp>& __x)
 {
     const _Tp __pi(atan2(+0., -0.));
@@ -1200,7 +1200,7 @@ acosh(const complex<_Tp>& __x)
 // atanh
 
 template<class _Tp>
-complex<_Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp>
 atanh(const complex<_Tp>& __x)
 {
     const _Tp __pi(atan2(+0., -0.));
@@ -1233,7 +1233,7 @@ atanh(const complex<_Tp>& __x)
 // sinh
 
 template<class _Tp>
-complex<_Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp>
 sinh(const complex<_Tp>& __x)
 {
     if (__libcpp_isinf_or_builtin(__x.real()) && !__libcpp_isfinite_or_builtin(__x.imag()))
@@ -1248,7 +1248,7 @@ sinh(const complex<_Tp>& __x)
 // cosh
 
 template<class _Tp>
-complex<_Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp>
 cosh(const complex<_Tp>& __x)
 {
     if (__libcpp_isinf_or_builtin(__x.real()) && !__libcpp_isfinite_or_builtin(__x.imag()))
@@ -1265,7 +1265,7 @@ cosh(const complex<_Tp>& __x)
 // tanh
 
 template<class _Tp>
-complex<_Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp>
 tanh(const complex<_Tp>& __x)
 {
     if (__libcpp_isinf_or_builtin(__x.real()))
@@ -1289,7 +1289,7 @@ tanh(const complex<_Tp>& __x)
 // asin
 
 template<class _Tp>
-complex<_Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp>
 asin(const complex<_Tp>& __x)
 {
     complex<_Tp> __z = asinh(complex<_Tp>(-__x.imag(), __x.real()));
@@ -1299,7 +1299,7 @@ asin(const complex<_Tp>& __x)
 // acos
 
 template<class _Tp>
-complex<_Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp>
 acos(const complex<_Tp>& __x)
 {
     const _Tp __pi(atan2(+0., -0.));
@@ -1336,7 +1336,7 @@ acos(const complex<_Tp>& __x)
 // atan
 
 template<class _Tp>
-complex<_Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp>
 atan(const complex<_Tp>& __x)
 {
     complex<_Tp> __z = atanh(complex<_Tp>(-__x.imag(), __x.real()));
@@ -1346,7 +1346,7 @@ atan(const complex<_Tp>& __x)
 // sin
 
 template<class _Tp>
-complex<_Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp>
 sin(const complex<_Tp>& __x)
 {
     complex<_Tp> __z = sinh(complex<_Tp>(-__x.imag(), __x.real()));
@@ -1366,7 +1366,7 @@ cos(const complex<_Tp>& __x)
 // tan
 
 template<class _Tp>
-complex<_Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp>
 tan(const complex<_Tp>& __x)
 {
     complex<_Tp> __z = tanh(complex<_Tp>(-__x.imag(), __x.real()));
@@ -1374,7 +1374,7 @@ tan(const complex<_Tp>& __x)
 }
 
 template<class _Tp, class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)
 {
     if (__is.good())
@@ -1437,7 +1437,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)
 
 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
 template<class _Tp, class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)
 {
     basic_ostringstream<_CharT, _Traits> __s;
@@ -1455,34 +1455,34 @@ inline namespace literals
 {
   inline namespace complex_literals
   {
-    constexpr complex<long double> operator""il(long double __im)
+    _LIBCPP_HIDE_FROM_ABI constexpr complex<long double> operator""il(long double __im)
     {
         return { 0.0l, __im };
     }
 
-    constexpr complex<long double> operator""il(unsigned long long __im)
+    _LIBCPP_HIDE_FROM_ABI constexpr complex<long double> operator""il(unsigned long long __im)
     {
         return { 0.0l, static_cast<long double>(__im) };
     }
 
 
-    constexpr complex<double> operator""i(long double __im)
+    _LIBCPP_HIDE_FROM_ABI constexpr complex<double> operator""i(long double __im)
     {
         return { 0.0, static_cast<double>(__im) };
     }
 
-    constexpr complex<double> operator""i(unsigned long long __im)
+    _LIBCPP_HIDE_FROM_ABI constexpr complex<double> operator""i(unsigned long long __im)
     {
         return { 0.0, static_cast<double>(__im) };
     }
 
 
-    constexpr complex<float> operator""if(long double __im)
+    _LIBCPP_HIDE_FROM_ABI constexpr complex<float> operator""if(long double __im)
     {
         return { 0.0f, static_cast<float>(__im) };
     }
 
-    constexpr complex<float> operator""if(unsigned long long __im)
+    _LIBCPP_HIDE_FROM_ABI constexpr complex<float> operator""if(unsigned long long __im)
     {
         return { 0.0f, static_cast<float>(__im) };
     }

diff  --git a/libcxx/include/cstddef b/libcxx/include/cstddef
index 8daba076d7db2..7be4348038e15 100644
--- a/libcxx/include/cstddef
+++ b/libcxx/include/cstddef
@@ -62,7 +62,7 @@ namespace std  // purposefully not versioned
 {
 enum class byte : unsigned char {};
 
-constexpr byte  operator| (byte  __lhs, byte __rhs) noexcept
+_LIBCPP_HIDE_FROM_ABI constexpr byte  operator| (byte  __lhs, byte __rhs) noexcept
 {
     return static_cast<byte>(
       static_cast<unsigned char>(
@@ -70,10 +70,10 @@ constexpr byte  operator| (byte  __lhs, byte __rhs) noexcept
     ));
 }
 
-constexpr byte& operator|=(byte& __lhs, byte __rhs) noexcept
+_LIBCPP_HIDE_FROM_ABI constexpr byte& operator|=(byte& __lhs, byte __rhs) noexcept
 { return __lhs = __lhs | __rhs; }
 
-constexpr byte  operator& (byte  __lhs, byte __rhs) noexcept
+_LIBCPP_HIDE_FROM_ABI constexpr byte  operator& (byte  __lhs, byte __rhs) noexcept
 {
     return static_cast<byte>(
       static_cast<unsigned char>(
@@ -81,10 +81,10 @@ constexpr byte  operator& (byte  __lhs, byte __rhs) noexcept
     ));
 }
 
-constexpr byte& operator&=(byte& __lhs, byte __rhs) noexcept
+_LIBCPP_HIDE_FROM_ABI constexpr byte& operator&=(byte& __lhs, byte __rhs) noexcept
 { return __lhs = __lhs & __rhs; }
 
-constexpr byte  operator^ (byte  __lhs, byte __rhs) noexcept
+_LIBCPP_HIDE_FROM_ABI constexpr byte  operator^ (byte  __lhs, byte __rhs) noexcept
 {
     return static_cast<byte>(
       static_cast<unsigned char>(
@@ -92,10 +92,10 @@ constexpr byte  operator^ (byte  __lhs, byte __rhs) noexcept
     ));
 }
 
-constexpr byte& operator^=(byte& __lhs, byte __rhs) noexcept
+_LIBCPP_HIDE_FROM_ABI constexpr byte& operator^=(byte& __lhs, byte __rhs) noexcept
 { return __lhs = __lhs ^ __rhs; }
 
-constexpr byte  operator~ (byte __b) noexcept
+_LIBCPP_HIDE_FROM_ABI constexpr byte  operator~ (byte __b) noexcept
 {
     return static_cast<byte>(
       static_cast<unsigned char>(
@@ -107,27 +107,27 @@ template <class _Tp>
 using _EnableByteOverload = __enable_if_t<is_integral<_Tp>::value, byte>;
 
 template <class _Integer>
-  constexpr _EnableByteOverload<_Integer> &
+_LIBCPP_HIDE_FROM_ABI constexpr _EnableByteOverload<_Integer> &
   operator<<=(byte& __lhs, _Integer __shift) noexcept
   { return __lhs = __lhs << __shift; }
 
 template <class _Integer>
-  constexpr _EnableByteOverload<_Integer>
+_LIBCPP_HIDE_FROM_ABI constexpr _EnableByteOverload<_Integer>
   operator<< (byte  __lhs, _Integer __shift) noexcept
   { return static_cast<byte>(static_cast<unsigned char>(static_cast<unsigned int>(__lhs) << __shift)); }
 
 template <class _Integer>
-  constexpr _EnableByteOverload<_Integer> &
+_LIBCPP_HIDE_FROM_ABI constexpr _EnableByteOverload<_Integer> &
   operator>>=(byte& __lhs, _Integer __shift) noexcept
   { return __lhs = __lhs >> __shift; }
 
 template <class _Integer>
-  constexpr _EnableByteOverload<_Integer>
+_LIBCPP_HIDE_FROM_ABI constexpr _EnableByteOverload<_Integer>
   operator>> (byte  __lhs, _Integer __shift) noexcept
   { return static_cast<byte>(static_cast<unsigned char>(static_cast<unsigned int>(__lhs) >> __shift)); }
 
 template <class _Integer, class = _EnableByteOverload<_Integer> >
-  _LIBCPP_NODISCARD_EXT constexpr _Integer
+_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Integer
   to_integer(byte __b) noexcept { return static_cast<_Integer>(__b); }
 
 } // namespace std

diff  --git a/libcxx/include/deque b/libcxx/include/deque
index 0d7eb9aa9316b..2bb2643c2214f 100644
--- a/libcxx/include/deque
+++ b/libcxx/include/deque
@@ -223,7 +223,7 @@ class _LIBCPP_TEMPLATE_VIS __deque_iterator;
 
 template <class _RAIter,
           class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
-__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+_LIBCPP_HIDE_FROM_ABI __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
 copy(_RAIter __f,
      _RAIter __l,
      __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
@@ -231,21 +231,21 @@ copy(_RAIter __f,
 
 template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
           class _OutputIterator>
-_OutputIterator
+_LIBCPP_HIDE_FROM_ABI _OutputIterator
 copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
      __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
      _OutputIterator __r);
 
 template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
           class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
-__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+_LIBCPP_HIDE_FROM_ABI __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
 copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
      __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
      __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r);
 
 template <class _RAIter,
           class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
-__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+_LIBCPP_HIDE_FROM_ABI __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
 copy_backward(_RAIter __f,
               _RAIter __l,
               __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
@@ -253,21 +253,21 @@ copy_backward(_RAIter __f,
 
 template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
           class _OutputIterator>
-_OutputIterator
+_LIBCPP_HIDE_FROM_ABI _OutputIterator
 copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
               __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
               _OutputIterator __r);
 
 template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
           class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
-__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+_LIBCPP_HIDE_FROM_ABI __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
 copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
               __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
               __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r);
 
 template <class _RAIter,
           class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
-__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+_LIBCPP_HIDE_FROM_ABI __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
 move(_RAIter __f,
      _RAIter __l,
      __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
@@ -275,21 +275,21 @@ move(_RAIter __f,
 
 template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
           class _OutputIterator>
-_OutputIterator
+_LIBCPP_HIDE_FROM_ABI _OutputIterator
 move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
      __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
      _OutputIterator __r);
 
 template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
           class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
-__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+_LIBCPP_HIDE_FROM_ABI __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
 move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
      __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
      __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r);
 
 template <class _RAIter,
           class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
-__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+_LIBCPP_HIDE_FROM_ABI __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
 move_backward(_RAIter __f,
               _RAIter __l,
               __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
@@ -297,14 +297,14 @@ move_backward(_RAIter __f,
 
 template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
           class _OutputIterator>
-_OutputIterator
+_LIBCPP_HIDE_FROM_ABI _OutputIterator
 move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
               __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
               _OutputIterator __r);
 
 template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
           class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
-__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+_LIBCPP_HIDE_FROM_ABI __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
 move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
               __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
               __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r);
@@ -591,7 +591,7 @@ const _DiffType __deque_iterator<_ValueType, _Pointer, _Reference, _MapPointer,
 
 template <class _RAIter,
           class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
-__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+_LIBCPP_HIDE_FROM_ABI __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
 copy(_RAIter __f,
      _RAIter __l,
      __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
@@ -621,7 +621,7 @@ copy(_RAIter __f,
 
 template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
           class _OutputIterator>
-_OutputIterator
+_LIBCPP_HIDE_FROM_ABI _OutputIterator
 copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
      __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
      _OutputIterator __r)
@@ -649,7 +649,7 @@ copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
 
 template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
           class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
-__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+_LIBCPP_HIDE_FROM_ABI __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
 copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
      __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
      __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r)
@@ -679,7 +679,7 @@ copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
 
 template <class _RAIter,
           class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
-__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+_LIBCPP_HIDE_FROM_ABI __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
 copy_backward(_RAIter __f,
               _RAIter __l,
               __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
@@ -709,7 +709,7 @@ copy_backward(_RAIter __f,
 
 template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
           class _OutputIterator>
-_OutputIterator
+_LIBCPP_HIDE_FROM_ABI _OutputIterator
 copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
               __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
               _OutputIterator __r)
@@ -737,7 +737,7 @@ copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
 
 template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
           class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
-__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+_LIBCPP_HIDE_FROM_ABI __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
 copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
               __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
               __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r)
@@ -767,7 +767,7 @@ copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
 
 template <class _RAIter,
           class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
-__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+_LIBCPP_HIDE_FROM_ABI __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
 move(_RAIter __f,
      _RAIter __l,
      __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
@@ -797,7 +797,7 @@ move(_RAIter __f,
 
 template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
           class _OutputIterator>
-_OutputIterator
+_LIBCPP_HIDE_FROM_ABI _OutputIterator
 move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
      __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
      _OutputIterator __r)
@@ -825,7 +825,7 @@ move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
 
 template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
           class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
-__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+_LIBCPP_HIDE_FROM_ABI __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
 move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
      __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
      __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r)
@@ -855,7 +855,7 @@ move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
 
 template <class _RAIter,
           class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
-__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+_LIBCPP_HIDE_FROM_ABI __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
 move_backward(_RAIter __f,
               _RAIter __l,
               __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
@@ -885,7 +885,7 @@ move_backward(_RAIter __f,
 
 template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
           class _OutputIterator>
-_OutputIterator
+_LIBCPP_HIDE_FROM_ABI _OutputIterator
 move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
               __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
               _OutputIterator __r)
@@ -913,7 +913,7 @@ move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
 
 template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
           class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
-__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
+_LIBCPP_HIDE_FROM_ABI __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
 move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
               __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
               __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r)
@@ -1012,10 +1012,10 @@ public:
       }
 
 
-      friend bool operator==(__deque_range const& __lhs, __deque_range const& __rhs) {
+      _LIBCPP_HIDE_FROM_ABI friend bool operator==(__deque_range const& __lhs, __deque_range const& __rhs) {
         return __lhs.__pos_ == __rhs.__pos_;
       }
-      friend bool operator!=(__deque_range const& __lhs, __deque_range const& __rhs) {
+      _LIBCPP_HIDE_FROM_ABI friend bool operator!=(__deque_range const& __lhs, __deque_range const& __rhs) {
         return !(__lhs == __rhs);
       }
     };

diff  --git a/libcxx/include/exception b/libcxx/include/exception
index 7b514e5dca540..8294b6d0cc8df 100644
--- a/libcxx/include/exception
+++ b/libcxx/include/exception
@@ -282,7 +282,7 @@ struct __throw_with_nested<_Tp, _Up, false> {
 #endif
 
 template <class _Tp>
-_LIBCPP_NORETURN
+_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI
 void
 throw_with_nested(_Tp&& __t)
 {

diff  --git a/libcxx/include/experimental/iterator b/libcxx/include/experimental/iterator
index a92bca6a20fa8..b5fd2994203ae 100644
--- a/libcxx/include/experimental/iterator
+++ b/libcxx/include/experimental/iterator
@@ -110,7 +110,7 @@ private:
 
 
 template <class _CharT, class _Traits, class _Delim>
-ostream_joiner<typename decay<_Delim>::type, _CharT, _Traits>
+_LIBCPP_HIDE_FROM_ABI ostream_joiner<typename decay<_Delim>::type, _CharT, _Traits>
 make_ostream_joiner(basic_ostream<_CharT, _Traits>& __os, _Delim && __d)
 { return ostream_joiner<typename decay<_Delim>::type, _CharT, _Traits>(__os, _VSTD::forward<_Delim>(__d)); }
 

diff  --git a/libcxx/include/experimental/simd b/libcxx/include/experimental/simd
index f77ce59bb2699..c474292ffcb9c 100644
--- a/libcxx/include/experimental/simd
+++ b/libcxx/include/experimental/simd
@@ -720,12 +720,12 @@ public:
 
 #ifndef _LIBCPP_HAS_NO_VECTOR_EXTENSION
 
-constexpr size_t __floor_pow_of_2(size_t __val) {
+_LIBCPP_HIDE_FROM_ABI constexpr size_t __floor_pow_of_2(size_t __val) {
   return ((__val - 1) & __val) == 0 ? __val
                                     : __floor_pow_of_2((__val - 1) & __val);
 }
 
-constexpr size_t __ceil_pow_of_2(size_t __val) {
+_LIBCPP_HIDE_FROM_ABI constexpr size_t __ceil_pow_of_2(size_t __val) {
   return __val == 1 ? 1 : __floor_pow_of_2(__val - 1) << 1;
 }
 
@@ -913,17 +913,18 @@ public:
 };
 
 template <class _To, class _From>
-constexpr decltype(_To{std::declval<_From>()}, true)
+_LIBCPP_HIDE_FROM_ABI constexpr decltype(_To{std::declval<_From>()}, true)
 __is_non_narrowing_convertible_impl(_From) {
   return true;
 }
 
 template <class _To>
-constexpr bool __is_non_narrowing_convertible_impl(...) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool __is_non_narrowing_convertible_impl(...) {
   return false;
 }
 
 template <class _From, class _To>
+_LIBCPP_HIDE_FROM_ABI
 constexpr typename std::enable_if<std::is_arithmetic<_To>::value &&
                                       std::is_arithmetic<_From>::value,
                                   bool>::type
@@ -932,6 +933,7 @@ __is_non_narrowing_arithmetic_convertible() {
 }
 
 template <class _From, class _To>
+_LIBCPP_HIDE_FROM_ABI
 constexpr typename std::enable_if<!(std::is_arithmetic<_To>::value &&
                                     std::is_arithmetic<_From>::value),
                                   bool>::type
@@ -940,12 +942,12 @@ __is_non_narrowing_arithmetic_convertible() {
 }
 
 template <class _Tp>
-constexpr _Tp __variadic_sum() {
+_LIBCPP_HIDE_FROM_ABI constexpr _Tp __variadic_sum() {
   return _Tp{};
 }
 
 template <class _Tp, class _Up, class... _Args>
-constexpr _Tp __variadic_sum(_Up __first, _Args... __rest) {
+_LIBCPP_HIDE_FROM_ABI constexpr _Tp __variadic_sum(_Up __first, _Args... __rest) {
   return static_cast<_Tp>(__first) + __variadic_sum<_Tp>(__rest...);
 }
 
@@ -955,7 +957,7 @@ struct __nodeduce {
 };
 
 template <class _Tp>
-constexpr bool __vectorizable() {
+_LIBCPP_HIDE_FROM_ABI constexpr bool __vectorizable() {
   return std::is_arithmetic<_Tp>::value && !std::is_const<_Tp>::value &&
          !std::is_volatile<_Tp>::value && !std::is_same<_Tp, bool>::value;
 }
@@ -1123,13 +1125,13 @@ struct __simd_cast_traits<simd<_Tp, _NewAbi>> {
 };
 
 template <class _Tp, class _Up, class _Abi>
-auto simd_cast(const simd<_Up, _Abi>& __v)
+_LIBCPP_HIDE_FROM_ABI auto simd_cast(const simd<_Up, _Abi>& __v)
     -> decltype(__simd_cast_traits<_Tp>::__apply(__v)) {
   return __simd_cast_traits<_Tp>::__apply(__v);
 }
 
 template <class _Tp, class _Up, class _Abi>
-auto static_simd_cast(const simd<_Up, _Abi>& __v)
+_LIBCPP_HIDE_FROM_ABI auto static_simd_cast(const simd<_Up, _Abi>& __v)
     -> decltype(__static_simd_cast_traits<_Tp>::__apply(__v)) {
   return __static_simd_cast_traits<_Tp>::__apply(__v);
 }

diff  --git a/libcxx/include/ext/hash_map b/libcxx/include/ext/hash_map
index a581d5c550c47..a91716d1e6224 100644
--- a/libcxx/include/ext/hash_map
+++ b/libcxx/include/ext/hash_map
@@ -714,7 +714,7 @@ swap(hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
 }
 
 template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-bool
+_LIBCPP_HIDE_FROM_ABI bool
 operator==(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
            const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
 {
@@ -954,7 +954,7 @@ swap(hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
 }
 
 template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-bool
+_LIBCPP_HIDE_FROM_ABI bool
 operator==(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
            const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
 {

diff  --git a/libcxx/include/ext/hash_set b/libcxx/include/ext/hash_set
index 5823b5fb94769..1c9b5e799aca1 100644
--- a/libcxx/include/ext/hash_set
+++ b/libcxx/include/ext/hash_set
@@ -412,7 +412,7 @@ swap(hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
 }
 
 template <class _Value, class _Hash, class _Pred, class _Alloc>
-bool
+_LIBCPP_HIDE_FROM_ABI bool
 operator==(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
            const hash_set<_Value, _Hash, _Pred, _Alloc>& __y)
 {
@@ -633,7 +633,7 @@ swap(hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
 }
 
 template <class _Value, class _Hash, class _Pred, class _Alloc>
-bool
+_LIBCPP_HIDE_FROM_ABI bool
 operator==(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
            const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
 {

diff  --git a/libcxx/include/forward_list b/libcxx/include/forward_list
index ee90aaa4771f1..f35aa85d454c3 100644
--- a/libcxx/include/forward_list
+++ b/libcxx/include/forward_list
@@ -1702,6 +1702,7 @@ forward_list<_Tp, _Alloc>::reverse() _NOEXCEPT
 }
 
 template <class _Tp, class _Alloc>
+_LIBCPP_HIDE_FROM_ABI
 bool operator==(const forward_list<_Tp, _Alloc>& __x,
                 const forward_list<_Tp, _Alloc>& __y)
 {

diff  --git a/libcxx/include/future b/libcxx/include/future
index cedab3608ad2e..111fb64e8f0a9 100644
--- a/libcxx/include/future
+++ b/libcxx/include/future
@@ -2174,7 +2174,7 @@ inline _LIBCPP_INLINE_VISIBILITY bool __does_policy_contain(launch __policy, lau
 { return (int(__policy) & int(__value)) != 0; }
 
 template <class _Fp, class... _Args>
-_LIBCPP_NODISCARD_AFTER_CXX17
+_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
 future<typename __invoke_of<typename decay<_Fp>::type, typename decay<_Args>::type...>::type>
 async(launch __policy, _Fp&& __f, _Args&&... __args)
 {

diff  --git a/libcxx/include/iomanip b/libcxx/include/iomanip
index ed8334519ae8e..76229fcaa26c1 100644
--- a/libcxx/include/iomanip
+++ b/libcxx/include/iomanip
@@ -278,7 +278,7 @@ setw(int __n)
 template <class _MoneyT> class __iom_t7;
 
 template <class _CharT, class _Traits, class _MoneyT>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x);
 
 template <class _MoneyT>
@@ -298,7 +298,7 @@ public:
 };
 
 template <class _CharT, class _Traits, class _MoneyT>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x)
 {
 #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -338,7 +338,7 @@ get_money(_MoneyT& __mon, bool __intl = false)
 template <class _MoneyT> class __iom_t8;
 
 template <class _CharT, class _Traits, class _MoneyT>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x);
 
 template <class _MoneyT>
@@ -358,7 +358,7 @@ public:
 };
 
 template <class _CharT, class _Traits, class _MoneyT>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x)
 {
 #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -397,7 +397,7 @@ put_money(const _MoneyT& __mon, bool __intl = false)
 template <class _CharT> class __iom_t9;
 
 template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x);
 
 template <class _CharT>
@@ -417,7 +417,7 @@ public:
 };
 
 template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x)
 {
 #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -458,7 +458,7 @@ get_time(tm* __tm, const _CharT* __fmt)
 template <class _CharT> class __iom_t10;
 
 template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x);
 
 template <class _CharT>
@@ -478,7 +478,7 @@ public:
 };
 
 template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x)
 {
 #ifndef _LIBCPP_NO_EXCEPTIONS

diff  --git a/libcxx/include/ios b/libcxx/include/ios
index 7140e00b406a4..0015e573f0d27 100644
--- a/libcxx/include/ios
+++ b/libcxx/include/ios
@@ -842,7 +842,7 @@ basic_ios<_CharT, _Traits>::set_rdbuf(basic_streambuf<char_type, traits_type>* _
     ios_base::set_rdbuf(__sb);
 }
 
-inline
+_LIBCPP_HIDE_FROM_ABI inline
 ios_base&
 boolalpha(ios_base& __str)
 {
@@ -850,7 +850,7 @@ boolalpha(ios_base& __str)
     return __str;
 }
 
-inline
+_LIBCPP_HIDE_FROM_ABI inline
 ios_base&
 noboolalpha(ios_base& __str)
 {
@@ -858,7 +858,7 @@ noboolalpha(ios_base& __str)
     return __str;
 }
 
-inline
+_LIBCPP_HIDE_FROM_ABI inline
 ios_base&
 showbase(ios_base& __str)
 {
@@ -866,7 +866,7 @@ showbase(ios_base& __str)
     return __str;
 }
 
-inline
+_LIBCPP_HIDE_FROM_ABI inline
 ios_base&
 noshowbase(ios_base& __str)
 {
@@ -874,7 +874,7 @@ noshowbase(ios_base& __str)
     return __str;
 }
 
-inline
+_LIBCPP_HIDE_FROM_ABI inline
 ios_base&
 showpoint(ios_base& __str)
 {
@@ -882,7 +882,7 @@ showpoint(ios_base& __str)
     return __str;
 }
 
-inline
+_LIBCPP_HIDE_FROM_ABI inline
 ios_base&
 noshowpoint(ios_base& __str)
 {
@@ -890,7 +890,7 @@ noshowpoint(ios_base& __str)
     return __str;
 }
 
-inline
+_LIBCPP_HIDE_FROM_ABI inline
 ios_base&
 showpos(ios_base& __str)
 {
@@ -898,7 +898,7 @@ showpos(ios_base& __str)
     return __str;
 }
 
-inline
+_LIBCPP_HIDE_FROM_ABI inline
 ios_base&
 noshowpos(ios_base& __str)
 {
@@ -906,7 +906,7 @@ noshowpos(ios_base& __str)
     return __str;
 }
 
-inline
+_LIBCPP_HIDE_FROM_ABI inline
 ios_base&
 skipws(ios_base& __str)
 {
@@ -914,7 +914,7 @@ skipws(ios_base& __str)
     return __str;
 }
 
-inline
+_LIBCPP_HIDE_FROM_ABI inline
 ios_base&
 noskipws(ios_base& __str)
 {
@@ -922,7 +922,7 @@ noskipws(ios_base& __str)
     return __str;
 }
 
-inline
+_LIBCPP_HIDE_FROM_ABI inline
 ios_base&
 uppercase(ios_base& __str)
 {
@@ -930,7 +930,7 @@ uppercase(ios_base& __str)
     return __str;
 }
 
-inline
+_LIBCPP_HIDE_FROM_ABI inline
 ios_base&
 nouppercase(ios_base& __str)
 {
@@ -938,7 +938,7 @@ nouppercase(ios_base& __str)
     return __str;
 }
 
-inline
+_LIBCPP_HIDE_FROM_ABI inline
 ios_base&
 unitbuf(ios_base& __str)
 {
@@ -946,7 +946,7 @@ unitbuf(ios_base& __str)
     return __str;
 }
 
-inline
+_LIBCPP_HIDE_FROM_ABI inline
 ios_base&
 nounitbuf(ios_base& __str)
 {
@@ -954,7 +954,7 @@ nounitbuf(ios_base& __str)
     return __str;
 }
 
-inline
+_LIBCPP_HIDE_FROM_ABI inline
 ios_base&
 internal(ios_base& __str)
 {
@@ -962,7 +962,7 @@ internal(ios_base& __str)
     return __str;
 }
 
-inline
+_LIBCPP_HIDE_FROM_ABI inline
 ios_base&
 left(ios_base& __str)
 {
@@ -970,7 +970,7 @@ left(ios_base& __str)
     return __str;
 }
 
-inline
+_LIBCPP_HIDE_FROM_ABI inline
 ios_base&
 right(ios_base& __str)
 {
@@ -978,7 +978,7 @@ right(ios_base& __str)
     return __str;
 }
 
-inline
+_LIBCPP_HIDE_FROM_ABI inline
 ios_base&
 dec(ios_base& __str)
 {
@@ -986,7 +986,7 @@ dec(ios_base& __str)
     return __str;
 }
 
-inline
+_LIBCPP_HIDE_FROM_ABI inline
 ios_base&
 hex(ios_base& __str)
 {
@@ -994,7 +994,7 @@ hex(ios_base& __str)
     return __str;
 }
 
-inline
+_LIBCPP_HIDE_FROM_ABI inline
 ios_base&
 oct(ios_base& __str)
 {
@@ -1002,7 +1002,7 @@ oct(ios_base& __str)
     return __str;
 }
 
-inline
+_LIBCPP_HIDE_FROM_ABI inline
 ios_base&
 fixed(ios_base& __str)
 {
@@ -1010,7 +1010,7 @@ fixed(ios_base& __str)
     return __str;
 }
 
-inline
+_LIBCPP_HIDE_FROM_ABI inline
 ios_base&
 scientific(ios_base& __str)
 {
@@ -1018,7 +1018,7 @@ scientific(ios_base& __str)
     return __str;
 }
 
-inline
+_LIBCPP_HIDE_FROM_ABI inline
 ios_base&
 hexfloat(ios_base& __str)
 {
@@ -1026,7 +1026,7 @@ hexfloat(ios_base& __str)
     return __str;
 }
 
-inline
+_LIBCPP_HIDE_FROM_ABI inline
 ios_base&
 defaultfloat(ios_base& __str)
 {

diff  --git a/libcxx/include/istream b/libcxx/include/istream
index 7af5dfa474cdf..82776e3a10156 100644
--- a/libcxx/include/istream
+++ b/libcxx/include/istream
@@ -633,7 +633,7 @@ operator>>(basic_istream<char, _Traits>& __is, signed char* __s)
 #endif // _LIBCPP_STD_VER > 17
 
 template<class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
 {
     ios_base::iostate __state = ios_base::goodbit;
@@ -1329,7 +1329,7 @@ basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir)
 }
 
 template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 ws(basic_istream<_CharT, _Traits>& __is)
 {
     ios_base::iostate __state = ios_base::goodbit;
@@ -1442,7 +1442,7 @@ basic_iostream<_CharT, _Traits>::~basic_iostream()
 }
 
 template<class _CharT, class _Traits, class _Allocator>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is,
            basic_string<_CharT, _Traits, _Allocator>& __str)
 {
@@ -1498,7 +1498,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
 }
 
 template<class _CharT, class _Traits, class _Allocator>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 getline(basic_istream<_CharT, _Traits>& __is,
         basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm)
 {
@@ -1578,7 +1578,7 @@ getline(basic_istream<_CharT, _Traits>&& __is,
 }
 
 template <class _CharT, class _Traits, size_t _Size>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
 {
     ios_base::iostate __state = ios_base::goodbit;

diff  --git a/libcxx/include/mutex b/libcxx/include/mutex
index 5dfaad2b35104..23007b19e8b85 100644
--- a/libcxx/include/mutex
+++ b/libcxx/include/mutex
@@ -329,7 +329,7 @@ recursive_timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration
 }
 
 template <class _L0, class _L1>
-int
+_LIBCPP_HIDE_FROM_ABI int
 try_lock(_L0& __l0, _L1& __l1)
 {
     unique_lock<_L0> __u0(__l0, try_to_lock);
@@ -349,7 +349,7 @@ try_lock(_L0& __l0, _L1& __l1)
 #ifndef _LIBCPP_CXX03_LANG
 
 template <class _L0, class _L1, class _L2, class... _L3>
-int
+_LIBCPP_HIDE_FROM_ABI int
 try_lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3)
 {
     int __r = 0;
@@ -368,7 +368,7 @@ try_lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3)
 #endif // _LIBCPP_CXX03_LANG
 
 template <class _L0, class _L1>
-void
+_LIBCPP_HIDE_FROM_ABI void
 lock(_L0& __l0, _L1& __l1)
 {
     while (true)

diff  --git a/libcxx/include/ostream b/libcxx/include/ostream
index 14b49d78cb035..2ef0034ca6623 100644
--- a/libcxx/include/ostream
+++ b/libcxx/include/ostream
@@ -748,7 +748,7 @@ basic_ostream<_CharT, _Traits>::operator<<(const void* __n)
 }
 
 template<class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 __put_character_sequence(basic_ostream<_CharT, _Traits>& __os,
                           const _CharT* __str, size_t __len)
 {
@@ -782,14 +782,14 @@ __put_character_sequence(basic_ostream<_CharT, _Traits>& __os,
 
 
 template<class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c)
 {
     return _VSTD::__put_character_sequence(__os, &__c, 1);
 }
 
 template<class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn)
 {
 #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -822,35 +822,35 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn)
 }
 
 template<class _Traits>
-basic_ostream<char, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>&
 operator<<(basic_ostream<char, _Traits>& __os, char __c)
 {
     return _VSTD::__put_character_sequence(__os, &__c, 1);
 }
 
 template<class _Traits>
-basic_ostream<char, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>&
 operator<<(basic_ostream<char, _Traits>& __os, signed char __c)
 {
     return _VSTD::__put_character_sequence(__os, (char *) &__c, 1);
 }
 
 template<class _Traits>
-basic_ostream<char, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>&
 operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c)
 {
     return _VSTD::__put_character_sequence(__os, (char *) &__c, 1);
 }
 
 template<class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str)
 {
     return _VSTD::__put_character_sequence(__os, __str, _Traits::length(__str));
 }
 
 template<class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn)
 {
 #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -896,14 +896,14 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn)
 }
 
 template<class _Traits>
-basic_ostream<char, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>&
 operator<<(basic_ostream<char, _Traits>& __os, const char* __str)
 {
     return _VSTD::__put_character_sequence(__os, __str, _Traits::length(__str));
 }
 
 template<class _Traits>
-basic_ostream<char, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>&
 operator<<(basic_ostream<char, _Traits>& __os, const signed char* __str)
 {
     const char *__s = (const char *) __str;
@@ -911,7 +911,7 @@ operator<<(basic_ostream<char, _Traits>& __os, const signed char* __str)
 }
 
 template<class _Traits>
-basic_ostream<char, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>&
 operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __str)
 {
     const char *__s = (const char *) __str;
@@ -1032,7 +1032,7 @@ basic_ostream<_CharT, _Traits>::seekp(off_type __off, ios_base::seekdir __dir)
 }
 
 template <class _CharT, class _Traits>
-inline
+_LIBCPP_HIDE_FROM_ABI inline
 basic_ostream<_CharT, _Traits>&
 endl(basic_ostream<_CharT, _Traits>& __os)
 {
@@ -1042,7 +1042,7 @@ endl(basic_ostream<_CharT, _Traits>& __os)
 }
 
 template <class _CharT, class _Traits>
-inline
+_LIBCPP_HIDE_FROM_ABI inline
 basic_ostream<_CharT, _Traits>&
 ends(basic_ostream<_CharT, _Traits>& __os)
 {
@@ -1051,7 +1051,7 @@ ends(basic_ostream<_CharT, _Traits>& __os)
 }
 
 template <class _CharT, class _Traits>
-inline
+_LIBCPP_HIDE_FROM_ABI inline
 basic_ostream<_CharT, _Traits>&
 flush(basic_ostream<_CharT, _Traits>& __os)
 {
@@ -1087,7 +1087,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
 }
 
 template<class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            basic_string_view<_CharT, _Traits> __sv)
 {
@@ -1123,7 +1123,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, unique_ptr<_Yp, _Dp> const& __p
 }
 
 template <class _CharT, class _Traits, size_t _Size>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x)
 {
     return __os << __x.template to_string<_CharT, _Traits>

diff  --git a/libcxx/include/regex b/libcxx/include/regex
index 850fe099df1e0..689d25ecf49d8 100644
--- a/libcxx/include/regex
+++ b/libcxx/include/regex
@@ -833,7 +833,7 @@ enum syntax_option_type
     multiline  = 1 << 10
 };
 
-inline _LIBCPP_CONSTEXPR
+_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR
 syntax_option_type __get_grammar(syntax_option_type __g)
 {
 #ifdef _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO
@@ -5732,7 +5732,7 @@ match_results<_BidirectionalIterator, _Allocator>::swap(match_results& __m)
 }
 
 template <class _BidirectionalIterator, class _Allocator>
-bool
+_LIBCPP_HIDE_FROM_ABI bool
 operator==(const match_results<_BidirectionalIterator, _Allocator>& __x,
            const match_results<_BidirectionalIterator, _Allocator>& __y)
 {
@@ -6224,7 +6224,7 @@ regex_search(const basic_string<_Cp, _ST, _SA>&& __s,
 // regex_match
 
 template <class _BidirectionalIterator, class _Allocator, class _CharT, class _Traits>
-bool
+_LIBCPP_HIDE_FROM_ABI bool
 regex_match(_BidirectionalIterator __first, _BidirectionalIterator __last,
             match_results<_BidirectionalIterator, _Allocator>& __m,
             const basic_regex<_CharT, _Traits>& __e,
@@ -6737,7 +6737,7 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::operator++()
 
 template <class _OutputIterator, class _BidirectionalIterator,
           class _Traits, class _CharT>
-_OutputIterator
+_LIBCPP_HIDE_FROM_ABI _OutputIterator
 regex_replace(_OutputIterator __output_iter,
               _BidirectionalIterator __first, _BidirectionalIterator __last,
               const basic_regex<_CharT, _Traits>& __e, const _CharT* __fmt,

diff  --git a/libcxx/include/string b/libcxx/include/string
index 3723dc8a39380..c3a213091ef11 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -593,17 +593,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 template<class _CharT, class _Traits, class _Allocator>
 basic_string<_CharT, _Traits, _Allocator>
-_LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
 operator+(const basic_string<_CharT, _Traits, _Allocator>& __x,
           const basic_string<_CharT, _Traits, _Allocator>& __y);
 
 template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_HIDDEN _LIBCPP_CONSTEXPR_AFTER_CXX17
 basic_string<_CharT, _Traits, _Allocator>
 operator+(const _CharT* __x, const basic_string<_CharT,_Traits,_Allocator>& __y);
 
 template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
 basic_string<_CharT, _Traits, _Allocator>
 operator+(_CharT __x, const basic_string<_CharT,_Traits,_Allocator>& __y);
 
@@ -613,7 +613,7 @@ basic_string<_CharT, _Traits, _Allocator>
 operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, const _CharT* __y);
 
 template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
 basic_string<_CharT, _Traits, _Allocator>
 operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, _CharT __y);
 
@@ -4346,7 +4346,7 @@ operator>=(const _CharT* __lhs,
 // operator +
 
 template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
 basic_string<_CharT, _Traits, _Allocator>
 operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
           const basic_string<_CharT, _Traits, _Allocator>& __rhs)
@@ -4365,7 +4365,7 @@ operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
 }
 
 template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_HIDDEN _LIBCPP_CONSTEXPR_AFTER_CXX17
 basic_string<_CharT, _Traits, _Allocator>
 operator+(const _CharT* __lhs , const basic_string<_CharT,_Traits,_Allocator>& __rhs)
 {
@@ -4383,7 +4383,7 @@ operator+(const _CharT* __lhs , const basic_string<_CharT,_Traits,_Allocator>& _
 }
 
 template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
 basic_string<_CharT, _Traits, _Allocator>
 operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs)
 {
@@ -4418,7 +4418,7 @@ operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT*
 }
 
 template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_AFTER_CXX17
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
 basic_string<_CharT, _Traits, _Allocator>
 operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, _CharT __rhs)
 {
@@ -4566,17 +4566,17 @@ struct _LIBCPP_TEMPLATE_VIS
 };
 
 template<class _CharT, class _Traits, class _Allocator>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            const basic_string<_CharT, _Traits, _Allocator>& __str);
 
 template<class _CharT, class _Traits, class _Allocator>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 operator>>(basic_istream<_CharT, _Traits>& __is,
            basic_string<_CharT, _Traits, _Allocator>& __str);
 
 template<class _CharT, class _Traits, class _Allocator>
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
 getline(basic_istream<_CharT, _Traits>& __is,
         basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm);
 

diff  --git a/libcxx/include/string_view b/libcxx/include/string_view
index 83ad1a367fe25..6a5b35777688b 100644
--- a/libcxx/include/string_view
+++ b/libcxx/include/string_view
@@ -956,7 +956,7 @@ bool operator>=(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs,
 #endif //  _LIBCPP_STD_VER > 17
 
 template<class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            basic_string_view<_CharT, _Traits> __str);
 

diff  --git a/libcxx/include/thread b/libcxx/include/thread
index 1c8eb198986d1..cde165039b3a2 100644
--- a/libcxx/include/thread
+++ b/libcxx/include/thread
@@ -328,7 +328,7 @@ struct __thread_invoke_pair {
 };
 
 template <class _Fp>
-void* __thread_proxy_cxx03(void* __vp)
+_LIBCPP_HIDE_FROM_ABI void* __thread_proxy_cxx03(void* __vp)
 {
     unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp));
     __thread_local_data().set_pointer(__p->__tsp_.release());
@@ -361,7 +361,7 @@ namespace this_thread
 _LIBCPP_FUNC_VIS void sleep_for(const chrono::nanoseconds& __ns);
 
 template <class _Rep, class _Period>
-void
+_LIBCPP_HIDE_FROM_ABI void
 sleep_for(const chrono::duration<_Rep, _Period>& __d)
 {
     if (__d > chrono::duration<_Rep, _Period>::zero())
@@ -385,7 +385,7 @@ sleep_for(const chrono::duration<_Rep, _Period>& __d)
 }
 
 template <class _Clock, class _Duration>
-void
+_LIBCPP_HIDE_FROM_ABI void
 sleep_until(const chrono::time_point<_Clock, _Duration>& __t)
 {
     mutex __mut;

diff  --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map
index b2a12cb638d89..ebe218076d8b9 100644
--- a/libcxx/include/unordered_map
+++ b/libcxx/include/unordered_map
@@ -1886,7 +1886,7 @@ inline _LIBCPP_INLINE_VISIBILITY
 #endif
 
 template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-bool
+_LIBCPP_HIDE_FROM_ABI bool
 operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
            const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
 {
@@ -2592,7 +2592,7 @@ inline _LIBCPP_INLINE_VISIBILITY
 #endif
 
 template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-bool
+_LIBCPP_HIDE_FROM_ABI bool
 operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
            const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
 {

diff  --git a/libcxx/include/unordered_set b/libcxx/include/unordered_set
index fc6e8e21c0cbd..c3a3bc8107f46 100644
--- a/libcxx/include/unordered_set
+++ b/libcxx/include/unordered_set
@@ -1130,7 +1130,7 @@ inline _LIBCPP_INLINE_VISIBILITY
 #endif
 
 template <class _Value, class _Hash, class _Pred, class _Alloc>
-bool
+_LIBCPP_HIDE_FROM_ABI bool
 operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
            const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
 {
@@ -1768,7 +1768,7 @@ inline _LIBCPP_INLINE_VISIBILITY
 #endif
 
 template <class _Value, class _Hash, class _Pred, class _Alloc>
-bool
+_LIBCPP_HIDE_FROM_ABI bool
 operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
            const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
 {

diff  --git a/libcxx/include/variant b/libcxx/include/variant
index b74416b62d919..765928ad7472f 100644
--- a/libcxx/include/variant
+++ b/libcxx/include/variant
@@ -320,7 +320,7 @@ struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, variant<_Types...>> {
 
 inline constexpr size_t variant_npos = static_cast<size_t>(-1);
 
-constexpr int __choose_index_type(unsigned int __num_elem) {
+_LIBCPP_HIDE_FROM_ABI constexpr int __choose_index_type(unsigned int __num_elem) {
   if (__num_elem < numeric_limits<unsigned char>::max())
     return 0;
   if (__num_elem < numeric_limits<unsigned short>::max())

diff  --git a/libcxx/test/libcxx/clang_query.sh.cpp b/libcxx/test/libcxx/clang_query.sh.cpp
new file mode 100644
index 0000000000000..1364ff8327157
--- /dev/null
+++ b/libcxx/test/libcxx/clang_query.sh.cpp
@@ -0,0 +1,273 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Run clang-query on the headers - see clang_query/README.md for more information
+
+// REQUIRES: has-clang-query
+
+// The attributes hide_from_abi_of_visible.query relies on aren't applied on windows.
+// XFAIL: windows
+
+// RUN: clang-query -f %S/clang_query/hide_from_abi_or_visible.query %s --use-color -- -Wno-unknown-warning-option %{compile_flags} -fno-modules > %t.output
+// RUN: cat %t.output
+// RUN: cat %t.output | wc -l | grep -Fxq 1
+
+// Prevent <ext/hash_map> from generating deprecated warnings for this test.
+#if defined(__DEPRECATED)
+#    undef __DEPRECATED
+#endif
+
+/*
+BEGIN-SCRIPT
+
+for header in public_headers:
+  print("{}#{}include <{}>{}".format(
+    '#if ' + header_restrictions[header] + '\n' if header in header_restrictions else '',
+    3 * ' ' if header in header_restrictions else '',
+    header,
+    '\n#endif' if header in header_restrictions else ''
+  ))
+
+END-SCRIPT
+*/
+
+// DO NOT MANUALLY EDIT ANYTHING BETWEEN THE MARKERS BELOW
+// GENERATED-MARKER
+#include <algorithm>
+#include <any>
+#include <array>
+#include <atomic>
+#if !defined(_LIBCPP_HAS_NO_THREADS)
+#   include <barrier>
+#endif
+#include <bit>
+#include <bitset>
+#include <cassert>
+#include <ccomplex>
+#include <cctype>
+#include <cerrno>
+#include <cfenv>
+#include <cfloat>
+#include <charconv>
+#include <chrono>
+#include <cinttypes>
+#include <ciso646>
+#include <climits>
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#   include <clocale>
+#endif
+#include <cmath>
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#   include <codecvt>
+#endif
+#include <compare>
+#include <complex>
+#include <complex.h>
+#include <concepts>
+#include <condition_variable>
+#include <coroutine>
+#include <csetjmp>
+#include <csignal>
+#include <cstdarg>
+#include <cstdbool>
+#include <cstddef>
+#include <cstdint>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <ctgmath>
+#include <ctime>
+#include <ctype.h>
+#include <cuchar>
+#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
+#   include <cwchar>
+#endif
+#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
+#   include <cwctype>
+#endif
+#include <deque>
+#include <errno.h>
+#include <exception>
+#include <execution>
+#include <fenv.h>
+#if !defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY)
+#   include <filesystem>
+#endif
+#include <float.h>
+#include <format>
+#include <forward_list>
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#   include <fstream>
+#endif
+#include <functional>
+#if !defined(_LIBCPP_HAS_NO_THREADS)
+#   include <future>
+#endif
+#include <initializer_list>
+#include <inttypes.h>
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#   include <iomanip>
+#endif
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#   include <ios>
+#endif
+#include <iosfwd>
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#   include <iostream>
+#endif
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#   include <istream>
+#endif
+#include <iterator>
+#if !defined(_LIBCPP_HAS_NO_THREADS)
+#   include <latch>
+#endif
+#include <limits>
+#include <limits.h>
+#include <list>
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#   include <locale>
+#endif
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#   include <locale.h>
+#endif
+#include <map>
+#include <math.h>
+#include <memory>
+#if !defined(_LIBCPP_HAS_NO_THREADS)
+#   include <mutex>
+#endif
+#include <new>
+#include <numbers>
+#include <numeric>
+#include <optional>
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#   include <ostream>
+#endif
+#include <queue>
+#include <random>
+#include <ranges>
+#include <ratio>
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#   include <regex>
+#endif
+#include <scoped_allocator>
+#if !defined(_LIBCPP_HAS_NO_THREADS)
+#   include <semaphore>
+#endif
+#include <set>
+#include <setjmp.h>
+#if !defined(_LIBCPP_HAS_NO_THREADS)
+#   include <shared_mutex>
+#endif
+#include <span>
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#   include <sstream>
+#endif
+#include <stack>
+#if __cplusplus > 202002L && !defined(_LIBCPP_HAS_NO_THREADS)
+#   include <stdatomic.h>
+#endif
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdexcept>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#   include <streambuf>
+#endif
+#include <string>
+#include <string.h>
+#include <string_view>
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#   include <strstream>
+#endif
+#include <system_error>
+#include <tgmath.h>
+#if !defined(_LIBCPP_HAS_NO_THREADS)
+#   include <thread>
+#endif
+#include <tuple>
+#include <type_traits>
+#include <typeindex>
+#include <typeinfo>
+#include <uchar.h>
+#include <unordered_map>
+#include <unordered_set>
+#include <utility>
+#include <valarray>
+#include <variant>
+#include <vector>
+#include <version>
+#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
+#   include <wchar.h>
+#endif
+#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
+#   include <wctype.h>
+#endif
+#if __cplusplus >= 201103L
+#   include <experimental/algorithm>
+#endif
+#if __cplusplus >= 201103L && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES)
+#   include <experimental/coroutine>
+#endif
+#if __cplusplus >= 201103L
+#   include <experimental/deque>
+#endif
+#if __cplusplus >= 201103L
+#   include <experimental/forward_list>
+#endif
+#if __cplusplus >= 201103L
+#   include <experimental/functional>
+#endif
+#if __cplusplus >= 201103L
+#   include <experimental/iterator>
+#endif
+#if __cplusplus >= 201103L
+#   include <experimental/list>
+#endif
+#if __cplusplus >= 201103L
+#   include <experimental/map>
+#endif
+#if __cplusplus >= 201103L
+#   include <experimental/memory_resource>
+#endif
+#if __cplusplus >= 201103L
+#   include <experimental/propagate_const>
+#endif
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) && __cplusplus >= 201103L
+#   include <experimental/regex>
+#endif
+#if __cplusplus >= 201103L
+#   include <experimental/set>
+#endif
+#if __cplusplus >= 201103L
+#   include <experimental/simd>
+#endif
+#if __cplusplus >= 201103L
+#   include <experimental/string>
+#endif
+#if __cplusplus >= 201103L
+#   include <experimental/type_traits>
+#endif
+#if __cplusplus >= 201103L
+#   include <experimental/unordered_map>
+#endif
+#if __cplusplus >= 201103L
+#   include <experimental/unordered_set>
+#endif
+#if __cplusplus >= 201103L
+#   include <experimental/utility>
+#endif
+#if __cplusplus >= 201103L
+#   include <experimental/vector>
+#endif
+#include <ext/hash_map>
+#include <ext/hash_set>
+// GENERATED-MARKER

diff  --git a/libcxx/test/libcxx/clang_query/README.md b/libcxx/test/libcxx/clang_query/README.md
new file mode 100644
index 0000000000000..27f54b08feccb
--- /dev/null
+++ b/libcxx/test/libcxx/clang_query/README.md
@@ -0,0 +1,4 @@
+
+This directory contains [AST matchers](https://clang.llvm.org/docs/LibASTMatchers.html) for clang-query.
+These allow us to enforce some rules in the libc++ source code which are hard to enforce through other means,
+like clang-tidy or regex matchers.

diff  --git a/libcxx/test/libcxx/clang_query/hide_from_abi_or_visible.query b/libcxx/test/libcxx/clang_query/hide_from_abi_or_visible.query
new file mode 100644
index 0000000000000..d287a09323969
--- /dev/null
+++ b/libcxx/test/libcxx/clang_query/hide_from_abi_or_visible.query
@@ -0,0 +1,37 @@
+#===------------------------------------------------------------------------===#
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+#===------------------------------------------------------------------------===#
+
+# Check that all functions in the libc++ headers are either marked with hidden
+# visibility or default visibility
+
+# TODO: enable the check for all functions once we don't force-inline everything with GCC
+match
+functionDecl(
+  unless(
+    anyOf(
+      hasName("__introsort"),
+      hasName("__inplace_merge"),
+      hasName("__libcpp_snprintf_l"),
+      hasName("__libcpp_asprintf_l"),
+      hasName("__libcpp_sscanf_l"),
+      hasName("__tree_sub_invariant"),
+      hasName("__stable_sort_move"),
+      hasName("__stable_sort"),
+      hasName("__stable_partition"),
+      hasName("__lock_first"),
+      hasName("__stable_partition_impl"),
+      hasAttr("attr::Visibility"),
+      hasAttr("attr::AbiTag"),
+      cxxMethodDecl(), # We have explicitly instantiated classes and some of their methods don't have these attributes
+      isDeleted(),
+      isConsteval(),
+      isExpansionInSystemHeader()
+    )
+  ),
+  isDefinition()
+)

diff  --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py
index dea8b38e7cbe9..e7dc18310b990 100644
--- a/libcxx/utils/libcxx/test/features.py
+++ b/libcxx/utils/libcxx/test/features.py
@@ -24,6 +24,11 @@ def _hasSuitableClangTidy(cfg):
   except ConfigurationRuntimeError:
     return False
 
+def _hasSuitableClangQuery(cfg):
+  try:
+    return int(re.search('[0-9]+', commandOutput(cfg, ['clang-query --version'])).group()) >= 13
+  except ConfigurationRuntimeError:
+    return False
 
 DEFAULT_FEATURES = [
   Feature(name='fcoroutines-ts',
@@ -137,6 +142,8 @@ def _hasSuitableClangTidy(cfg):
           when=lambda cfg: runScriptExitCode(cfg, ['%{exec} bash -c \'bash --version\'']) != 0),
   Feature(name='has-clang-tidy',
           when=_hasSuitableClangTidy),
+  Feature(name='has-clang-query',
+          when=_hasSuitableClangQuery),
 
   Feature(name='apple-clang',                                                                                                      when=_isAppleClang),
   Feature(name=lambda cfg: 'apple-clang-{__clang_major__}'.format(**compilerMacros(cfg)),                                          when=_isAppleClang),

diff  --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py
index 1b2b1a766d6b2..30ebf0e779c0d 100644
--- a/libcxx/utils/libcxx/test/params.py
+++ b/libcxx/utils/libcxx/test/params.py
@@ -38,8 +38,9 @@
   # TODO(mordante) investigate a solution for this issue.
   '-Wno-tautological-compare',
 
-  # -Wstringop-overread seems to be a bit buggy currently
+  # -Wstringop-overread and -Wstringop-overflow seem to be a bit buggy currently
   '-Wno-stringop-overread',
+  '-Wno-stringop-overflow',
 
   # These warnings should be enabled in order to support the MSVC
   # team using the test suite; They enable the warnings below and


        


More information about the libcxx-commits mailing list