diff options
author | Louis Dionne <ldionne@apple.com> | 2019-04-18 17:18:15 +0000 |
---|---|---|
committer | Louis Dionne <ldionne@apple.com> | 2019-04-18 17:18:15 +0000 |
commit | 549048f39006eb253f9c3bd13215643d3f95e100 (patch) | |
tree | 8d7d8ae15ac77a1b78ce7b1b3b60a8f7d33975e5 | |
parent | bda8482abaa87376f08700876504267bafa09880 (diff) | |
download | bcm5719-llvm-549048f39006eb253f9c3bd13215643d3f95e100.tar.gz bcm5719-llvm-549048f39006eb253f9c3bd13215643d3f95e100.zip |
[libc++] Make sure we re-export some missing libc++abi symbols from libc++
Summary:
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.
PR27405
PR22654
Reviewers: EricWF
Subscribers: christof, jkorous, dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D60424
llvm-svn: 358690
-rw-r--r-- | libcxx/lib/abi/CHANGELOG.TXT | 17 | ||||
-rw-r--r-- | libcxx/lib/abi/x86_64-apple-darwin.v1.abilist | 3 | ||||
-rw-r--r-- | libcxx/lib/libc++abi.v2.exp | 2 | ||||
-rw-r--r-- | libcxx/utils/libcxx/test/target_info.py | 9 | ||||
-rw-r--r-- | libcxxabi/test/uncaught_exception.pass.sh.cpp | 34 | ||||
-rw-r--r-- | libcxxabi/test/uncaught_exceptions.pass.cpp | 22 |
6 files changed, 62 insertions, 25 deletions
diff --git a/libcxx/lib/abi/CHANGELOG.TXT b/libcxx/lib/abi/CHANGELOG.TXT index 518a212eab2..782a9b7015a 100644 --- a/libcxx/lib/abi/CHANGELOG.TXT +++ b/libcxx/lib/abi/CHANGELOG.TXT @@ -16,6 +16,23 @@ New entries should be added directly below the "Version" header. 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 + ------------------------ + TODO + + 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/libcxx/lib/abi/x86_64-apple-darwin.v1.abilist b/libcxx/lib/abi/x86_64-apple-darwin.v1.abilist index bfcc5c53afc..2e405c9657e 100644 --- a/libcxx/lib/abi/x86_64-apple-darwin.v1.abilist +++ b/libcxx/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/libcxx/lib/libc++abi.v2.exp b/libcxx/lib/libc++abi.v2.exp index 40c055dae97..dfc308f8010 100644 --- a/libcxx/lib/libc++abi.v2.exp +++ b/libcxx/lib/libc++abi.v2.exp @@ -15,6 +15,8 @@ ___cxa_pure_virtual ___cxa_deleted_virtual ___cxa_begin_catch ___cxa_throw +___cxa_throw_bad_array_new_length +___cxa_uncaught_exceptions ___cxa_vec_cctor ___cxa_vec_cleanup ___cxa_vec_ctor diff --git a/libcxx/utils/libcxx/test/target_info.py b/libcxx/utils/libcxx/test/target_info.py index 2f2e395b97f..6da30e672e1 100644 --- a/libcxx/utils/libcxx/test/target_info.py +++ b/libcxx/utils/libcxx/test/target_info.py @@ -156,15 +156,6 @@ class DarwinLocalTI(DefaultTargetInfo): 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 diff --git a/libcxxabi/test/uncaught_exception.pass.sh.cpp b/libcxxabi/test/uncaught_exception.pass.sh.cpp new file mode 100644 index 00000000000..ccb10f2eb6b --- /dev/null +++ b/libcxxabi/test/uncaught_exception.pass.sh.cpp @@ -0,0 +1,34 @@ +//===------------------- uncaught_exceptions.pass.cpp ---------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: libcxxabi-no-exceptions + +// This tests that libc++abi still provides __cxa_uncaught_exception() for +// ABI compatibility, even though the Standard doesn't require it to. +// +// We need to explicitly link against libc++abi, because libc++ does not +// re-export this symbol. + +// RUN: %build -lc++abi -o %t.exe +// RUN: %t.exe + +#include <cxxabi.h> +#include <cassert> + +// namespace __cxxabiv1 { +// extern bool __cxa_uncaught_exception () throw(); +// } + +struct A { + ~A() { assert( __cxxabiv1::__cxa_uncaught_exception()); } +}; + +int main () { + try { A a; throw 3; assert(false); } + catch (int) {} +} diff --git a/libcxxabi/test/uncaught_exceptions.pass.cpp b/libcxxabi/test/uncaught_exceptions.pass.cpp index 2a19ca3db36..f4b2d365100 100644 --- a/libcxxabi/test/uncaught_exceptions.pass.cpp +++ b/libcxxabi/test/uncaught_exceptions.pass.cpp @@ -9,29 +9,19 @@ // UNSUPPORTED: libcxxabi-no-exceptions #include <cxxabi.h> -#include <exception> #include <cassert> // namespace __cxxabiv1 { -// extern bool __cxa_uncaught_exception () throw(); -// extern unsigned int __cxa_uncaught_exceptions() throw(); +// extern unsigned int __cxa_uncaught_exceptions() throw(); // } struct A { - ~A() { assert( __cxxabiv1::__cxa_uncaught_exception()); } - }; - -struct B { - B(unsigned cnt) : data_(cnt) {} - ~B() { assert( data_ == __cxxabiv1::__cxa_uncaught_exceptions()); } + A(unsigned cnt) : data_(cnt) {} + ~A() { assert( data_ == __cxxabiv1::__cxa_uncaught_exceptions()); } unsigned data_; - }; +}; -int main () -{ - try { A a; throw 3; assert (false); } - catch (int) {} - - try { B b(1); throw 3; assert (false); } +int main () { + try { A a(1); throw 3; assert(false); } catch (int) {} } |