[PATCH][cxxabi] ARM EHABI zero-cost exception handling for libc++abi
Logan Chien
tzuhsiang.chien at gmail.com
Wed Apr 16 05:11:36 PDT 2014
Hi all,
Sorry for the typo.
I was trying to build and test libc++abi from [1] but failed. I have tried
to build the library by compiling all the *.cpp and *.c, but it seems not
working. May you provide some instructions to build it?
BTW, I agree with Jonathan. It seems that __ARM_EABI_UNWINDER__ is not
pre-defined.
I am not sure for __USING_SJLJ_EXCEPTIONS__ at the moment. I will check
out ASAP.
Logan
[1]:
https://github.com/awong-dev/ndk/tree/use-libc%2B%2Babi/sources/cxx-stl/llvm-libc%2B%2Babi/libcxxabi
[2] http://www.sourceware.org/ml/libc-alpha/2004-02/msg00138.html
On Wed, Apr 16, 2014 at 7:58 PM, Logan Chien <tzuhsiang.chien at gmail.com>wrote:
> 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/55708602/attachment.html>
More information about the cfe-commits
mailing list