This is an archive of the discontinued LLVM Phabricator instance.

Move several exception derived classes to c++abi library
Needs ReviewPublic

Authored by zibi on Nov 29 2022, 2:08 PM.

Details

Reviewers
SeanP
muiez
EricWF
ldionne
daltenty
philnik
compnerd
Group Reviewers
Restricted Project
Restricted Project
Summary

This moves classes derived from std::exception which have what() member function from libc++ to litc++abi. In addition of moving it also drops __1 namespace from bad_weak_ptr class.

Diff Detail

Event Timeline

zibi created this revision.Nov 29 2022, 2:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 29 2022, 2:08 PM
Herald added a subscriber: nemanjai. · View Herald Transcript
zibi requested review of this revision.Nov 29 2022, 2:08 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptNov 29 2022, 2:08 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Herald added a reviewer: Restricted Project. · View Herald Transcript

Isn't this an abi break?

We will end up with undefined symbols when using libsupc++/libcxxrt?

nm --demangle /usr/lib/gcc/x86_64-linux-gnu/12/libsupc++.a | grep what
nm: atexit_arm.o: no symbols
0000000000000000 T std::bad_alloc::what() const
0000000000000000 T std::bad_array_length::what() const
0000000000000000 T std::bad_array_new_length::what() const
0000000000000000 T std::bad_cast::what() const
0000000000000000 T std::bad_typeid::what() const
0000000000000000 W __gnu_cxx::__concurrence_lock_error::what() const
0000000000000000 W __gnu_cxx::__concurrence_unlock_error::what() const
0000000000000000 T transaction clone for std::bad_exception::what() const
0000000000000000 T transaction clone for std::exception::what() const
0000000000000000 T std::bad_exception::what() const
0000000000000000 T std::exception::what() const
zibi updated this revision to Diff 479159.Nov 30 2022, 9:25 PM
  • Move several exception derived classes to c++abi library
  • Remove _LIBCPP_EXCEPTION_ABI from classes those symbols are moved to c++abi.
zibi updated this revision to Diff 480239.Dec 5 2022, 2:11 PM
  • Keep _LIBCPP_EXCEPTION_ABI for classes in experimental namespace.
compnerd requested changes to this revision.Dec 8 2022, 10:26 AM
compnerd added a subscriber: compnerd.
compnerd added inline comments.
libcxxabi/src/exceptions.cpp
26

These really are not part of the ABI: https://itanium-cxx-abi.github.io/cxx-abi/abi.html. This makes it harder to combine libc++ with an alternative ABI implementation (e.g. libsupc++ or libcxxrt). Additionally, libc++ can be built with vcruntime and does not use libc++abi on Windows, so this will result in breaking the Window support.

This revision now requires changes to proceed.Dec 8 2022, 10:26 AM
zibi updated this revision to Diff 482554.Dec 13 2022, 10:41 AM
  • Revert 47b49b5f6d40 and 57b747c55d15
zibi added inline comments.Dec 13 2022, 11:14 AM
libcxxabi/src/exceptions.cpp
26

Is vcruntime officially supported? It's not listed in https://releases.llvm.org/3.8.0/projects/libcxx/docs/BuildingLibcxx.html#abi-library-specific-options.
Is the CI currently set it up use vcruntime on Windows and not relying on libcxxabi at all?

I will rely on @ldionne and @EricWF to help out since the original solution was shot down and they proposed to move those symbols to abi. I'm not sure if an alternative ABI implementations were considered or how to address the removal of symbols from libcxx and make them available in libcxxabi.

libcxx/src/optional.cpp