[PATCH][cxxabi] ARM EHABI zero-cost exception handling for libc++abi

Logan Chien tzuhsiang.chien at gmail.com
Mon May 5 10:44:28 PDT 2014


Hi all,

I have uploaded the patch to Phabricator for review.  Please have a look,
and feel free to leave the comments.

http://reviews.llvm.org/D3612 : Small change to unit test so that gcc can
pass the unit test as well.
http://reviews.llvm.org/D3613 : Implement the ARM EHABI exception handling.

Compared with the earlier patch sent to the mailing list, there are some
differences:
(a) __cxa_begin_cleanup() and __cxa_end_cleanup() have been added so that
the code compiled with arm-linux-gnueabi-g++ can link with libcxxabi.
(b) The barrier_cache data has been reordered so that it will be conform to
ARM EHABI (except the __cxa_call_unexpected() which should be completely
rewritten in the future.)
(c) Comments are cleaned up, and fixed various formatting issue.


On Mon, May 5, 2014 at 1:00 AM, Nico Weber wrote:

> I thought we were down to 4 or 6 test failures by now…
>

I'm not sure if this is related to the environment or the compiler.  I am
testing the code on Debian Wheezy armhf on QEMU, and compiling the code
with clang.  Most of the failing test are SIGSEGV and SIGILL, although I
haven't got time to figure out.


On Mon, May 5, 2014 at 10:02 AM, Jonathan Roelofs wrote:

>  This plan sounds OK to me, but I am a little hesitant. I want to be
> careful about how we use the reserved bits of the unwind caches, because
> some of it is implementation details of libgcc_s, and I'd rather not have a
> bunch of "this is unspecified in the spec, but we're doing it this way
> because libgcc's unwinder does it this way" in there permanently.  Can you
> add notes where such assumptions are made in the libc++abi part so that we
> can fix them later?
>

AFAICT, I am using two undocumented APIs:

1. Using __gnu_unwind_frame() to unwind one frame.
2. In order to use _Unwind_GetLanguageSpecificData() and
_Unwind_GetRegionStart() we have to copy the UCB to r12.

Both of them can be fixed if we have our own unwinding library, and I have
written several comments to document these hacks.

Yet another missing part are __aeabi_unwind_cpp_pr0,
__aeabi_unwind_cpp_pr1, and  __aeabi_unwind_cpp_pr2.  Currently, when the
user program references these personality routines, the undefined symbol
will be binded to the corresponding routine in libgcc.  This should be
implemented in libcxxabi in the future; otherwise, link error will be
raised when we replace libgcc with compiler-rt.

Sincerely,
Logan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140506/8972ddd2/attachment.html>


More information about the cfe-commits mailing list