[libc++] Make sure we re-export some missing libc++abi symbols from libc++

Ensure we re-export __cxa_throw_bad_array_new_length and
__cxa_uncaught_exceptions from libc++, since they are now
provided by libc++abi.

Doing this allows us to stop linking explicitly against libc++abi in
the libc++abi tests, since libc++ re-exports all the necessary symbols.
However, there is one caveat to that. We don't want libc++ to re-export
__cxa_uncaught_exception (the singular form), since it's only provided
for backwards compatibility. Hence, for the single test where we check
this backwards compatibility, we explicitly link against libc++abi.


Reviewers: EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

Tags: #libc

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@358690 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/abi/CHANGELOG.TXT b/lib/abi/CHANGELOG.TXT
index 518a212..782a9b7 100644
--- a/lib/abi/CHANGELOG.TXT
+++ b/lib/abi/CHANGELOG.TXT
@@ -16,6 +16,23 @@
 Version 9.0
+* rXXXXX - Re-rexport missing symbols from libc++abi
+  libc++ now re-exports `__cxa_throw_bad_array_new_length` and `__cxa_uncaught_exceptions`,
+  both of which are provided by libc++abi. This is not an ABI break because
+  we're just adding symbols. Also, this does mean that libc++ can't be linked
+  against an older version of libc++abi that doesn't provide those symbols,
+  however doing so is not supported anyway.
+  x86_64-unknown-linux-gnu
+  ------------------------
+  x86_64-apple-apple-darwin
+  -------------------------
+  Symbol added: ___cxa_throw_bad_array_new_length
+  Symbol added: ___cxa_uncaught_exceptions
 * r356518 - Integrate <filesystem> support into the shared library
   This patch introduces support for <filesystem> into the shared library,
diff --git a/lib/abi/x86_64-apple-darwin.v1.abilist b/lib/abi/x86_64-apple-darwin.v1.abilist
index bfcc5c5..2e405c9 100644
--- a/lib/abi/x86_64-apple-darwin.v1.abilist
+++ b/lib/abi/x86_64-apple-darwin.v1.abilist
@@ -2321,7 +2321,10 @@
 {'is_defined': False, 'name': '___cxa_rethrow_primary_exception', 'type': 'U'}
 {'is_defined': False, 'name': '___cxa_throw', 'type': 'U'}
 {'is_defined': True, 'name': '___cxa_throw', 'type': 'I'}
+{'is_defined': False, 'name': '___cxa_throw_bad_array_new_length', 'type': 'U'}
+{'is_defined': True, 'name': '___cxa_throw_bad_array_new_length', 'type': 'I'}
 {'is_defined': False, 'name': '___cxa_uncaught_exceptions', 'type': 'U'}
+{'is_defined': True, 'name': '___cxa_uncaught_exceptions', 'type': 'I'}
 {'is_defined': False, 'name': '___cxa_vec_cctor', 'type': 'U'}
 {'is_defined': True, 'name': '___cxa_vec_cctor', 'type': 'I'}
 {'is_defined': False, 'name': '___cxa_vec_cleanup', 'type': 'U'}
diff --git a/lib/libc++abi.v2.exp b/lib/libc++abi.v2.exp
index 40c055d..dfc308f 100644
--- a/lib/libc++abi.v2.exp
+++ b/lib/libc++abi.v2.exp
@@ -15,6 +15,8 @@
diff --git a/utils/libcxx/test/target_info.py b/utils/libcxx/test/target_info.py
index 2f2e395..6da30e6 100644
--- a/utils/libcxx/test/target_info.py
+++ b/utils/libcxx/test/target_info.py
@@ -156,15 +156,6 @@
             env['DYLD_LIBRARY_PATH'] = ':'.join(library_paths)
     def allow_cxxabi_link(self):
-        # FIXME: PR27405
-        # libc++ *should* export all of the symbols found in libc++abi on OS X.
-        # For this reason LibcxxConfiguration will not link libc++abi in OS X.
-        # However __cxa_throw_bad_new_array_length doesn't get exported into
-        # libc++ yet so we still need to explicitly link libc++abi when testing
-        # libc++abi
-        # See PR22654.
-        if(self.full_config.get_lit_conf('name', '') == 'libc++abi'):
-            return True
         # Don't link libc++abi explicitly on OS X because the symbols
         # should be available in libc++ directly.
         return False