-
-
Notifications
You must be signed in to change notification settings - Fork 659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
third_party: Add libcxxabi #1063
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's already bits and pieces of cxxabi in the codebase.
- libc/cxxabi.h
- libc/runtime/cxaguard.c
- libc/thread/__cxa_thread_atexit.c
You need to figure out how to unify things so we don't have multiple implementations.
You also need to write a README.cosmo
file for both libcxxabi and libunwind. If you make any changes to the source code, you need to document them in the README.cosmo
file, under a section called LOCAL MODIFICATIONS
.
I believe that has already been done for this PR (https://github.com/jart/cosmopolitan/pull/1063/files#diff-023909efd99352e621d59379b348b643ec9309ad023c4ee780b38568c874a77a) as well as
This looks hard, unlike the unwind stubs, these implementations here look non-trivial and cannot be simply nuked away. |
73e0fc9
to
934fd65
Compare
Done. The parts with complex implementations in cosmo are for Other parts are either trivial functions or other third-party code ( |
934fd65
to
bc268c6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OUTSTANDING. I'm loving it!
Added libcxxabi from LLVM 17.0.6 The library implements the Itanium C++ exception handling ABI.
Enable `__cxa_thread_atexit` from libcxxabi. `__cxa_thread_atexit_impl` is still implemented by the cosmo libc. The original `__cxa_thread_atexit` has been removed.
Build libcxx with exceptions enabled. - Removed `_LIBCPP_NO_EXCEPTIONS` from `__config`. - Switched the exception implementation to `libcxxabi`. These two files are taken from the same `libcxx` version as mentioned in `README.cosmo`. - Removed `new_handler_fallback` in favor of `libcxxabi` implementation. - Enable `-fexceptions` and `-frtti` for `libcxx`. - Removed `THIRD_PARTY_LIBCXX` dependency from `libcxxabi` and `libunwind`. These libraries do not use any runtime `libcxx` functions, just headers.
- `__cxa_pure_virtual` in `libcxxabi` is also a stub similar to the existing one. - `__cxa_guard_*` from `libcxxabi` is used instead of the ones from Android. Now there should be no more duplicate implementations. `__cxa_thread_atexit_impl`, `__cxa_atexit`, and related supporting functions, are still left to other libraries as in `libcxxabi`. `libcxxabi` is also now added to `cosmopolitan.a` to make up for the removed functions. Affected in-tree libraries (`third_party/double-conversion`) have been updated.
bc268c6
to
37dfc42
Compare
Added libcxxabi from LLVM 17.0.6
The library implements the Itanium C++ exception handling ABI.
The upstream library comes with a comprehensive test set, which I did not add in this commit to prevent it from getting too large.
Part of #1065.