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

Logan Chien tzuhsiang.chien at gmail.com
Wed Apr 16 04:58:12 PDT 2014


Hi Jonathan and Nick,

I was trying to build libc++abi from repository but failed.  May you
provide some instruction to cross compile libc++abi for ARM Linux?  Thanks.

Logan


On Tue, Apr 15, 2014 at 5:23 AM, Jonathan Roelofs <jonathan at codesourcery.com
> wrote:

>
>
> On 4/14/14, 1:51 PM, Nick Kledzik wrote:
>
>>
>> On Apr 13, 2014, at 3:16 AM, Logan Chien <tzuhsiang.chien at gmail.com>
>> wrote:
>>
>>  Hi,
>>>
>>> I have worked on ARM EHABI zero-cost exception handling for libc++abi.
>>>
>>> With the attached patch, I can compile and run all libc++abi unittests
>>> on ARM Linux.
>>>
>>> Is it OK to commit?  Thanks.
>>>
>>>
>>  diff --git a/include/unwind.h b/include/unwind.h
>>> index c5acd93..e57d756 100644
>>> --- a/include/unwind.h
>>> +++ b/include/unwind.h
>>> @@ -23,8 +23,24 @@
>>>   #define LIBUNWIND_UNAVAIL
>>>   #endif
>>>
>>> +#if !defined(LIBCXXABI_SJLJ)
>>> +#  if defined(__arm__)
>>> +#    if defined(__APPLE__)
>>> +#      define LIBCXXABI_ARM_EHABI 0
>>> +#      define LIBCXXABI_SJLJ 1
>>> +#    else
>>> +#      define LIBCXXABI_ARM_EHABI 1
>>> +#      define LIBCXXABI_SJLJ 0
>>> +#    endif
>>> +#  else
>>> +#    define LIBCXXABI_ARM_EHABI 0
>>> +#    define LIBCXXABI_SJLJ 0
>>> +#  endif
>>> +#endif
>>>
>> I recently found that the compiler has a built-in define
>>  __USING_SJLJ_EXCEPTIONS__ that is set when compiling for setjump/longjump
>> based exceptions.  Is there are similar built-in for ARM EHABI?  If so, we
>> can set these up without testing for __arm__ or __APPLE__.  In fact,
>> LIBCXXABI_SJLJ can be replaced with __USING_SJLJ_EXCEPTIONS__.  And perhaps
>> LIBCXXABI_ARM_EHABI can be replaced with some built-in?
>>
> __ARM_EABI_UNWINDER__ perhaps?  I'm not exactly sure what the semantics of
> it are, and I don't see a definition for it in Clang.  In libgcc's unwinder
> it's defined in one of the arm config files. I suppose that makes it not a
> builtin then....
>
>>
>>  diff --git a/src/cxa_exception.cpp b/src/cxa_exception.cpp
>>> index 744dddd..27a55c5 100644
>>> --- a/src/cxa_exception.cpp
>>> +++ b/src/cxa_exception.cpp
>>> @@ -232,7 +232,7 @@ __cxa_throw(void* thrown_object, std::type_info*
>>> tinfo, void (*dest)(void*))
>>>       globals->uncaughtExceptions += 1;   // Not atomically, since
>>> globals are thread-local
>>>
>>>       exception_header->unwindHeader.exception_cleanup =
>>> exception_cleanup_func;
>>> -#if __arm__
>>> +#if LIBCXXABI_SJLJ
>>>       _Unwind_SjLj_RaiseException(&exception_header->unwindHeader);
>>>   #else
>>>
>> I like the conditional test for SJLJ instead of the processor, but as I
>> recently discovered, most of the existing __arm__ tests can be changed to
>> __USING_SJLJ_EXCEPTIONS__ tests.
>>
>> -Nick
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
>>
> --
> Jon Roelofs
> jonathan at codesourcery.com
> CodeSourcery / Mentor Embedded
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140416/09ba0414/attachment.html>


More information about the cfe-commits mailing list