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

Nico Weber thakis at chromium.org
Sun May 4 10:00:24 PDT 2014


On Sat, May 3, 2014 at 9:29 AM, Logan Chien <tzuhsiang.chien at gmail.com> wrote:
> Hi Jonathan,
>
> After some try-and-error, now I can compile the libcxxabi from [1].  I need
> some patch [2] to build it properly, and here's [3] my build script.
>
> However, I feel that there are still several works to be done if we wish to
> use [1].  From my test result, it seems that 24 tests (out of 32 tests) are
> failing, and it seems that some changes cause some regression on x86_64.

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

> IMO, maybe we can focus on my patch first?  Although, it still relies on the
> unwinding facilities from libgcc, I feel that we can replace them
> step-by-step.  And fortunately, it seems that most of your work are focusing
> on the language-independent unwinding library which is orthogonal to my
> changes.  Once the language-independent unwinding library is complete, we
> can ifdef (or remove) the function call to libgcc.  Does this plan sound
> reasonable?  Thanks.
>
> Sincerely,
> Logan
>
> [1]
> https://github.com/awong-dev/ndk/tree/use-libc++abi/sources/cxx-stl/llvm-libc++abi/libcxxabi
> [2] https://github.com/loganchien/libcxxabi/commits/awong-dev-ndk
> [3] https://github.com/loganchien/libcxx-scripts/commits/awong-dev-ndk
>
>
> On Thu, Apr 17, 2014 at 1:05 AM, Jonathan Roelofs
> <jonathan at codesourcery.com> wrote:
>>
>> Logan,
>>
>> I've been building it for bare-metal ARM using clang (with patches that
>> haven't been upstreamed yet), but the process should be similar for an
>> arm-linux-gnu target, assuming you want to make a static library out of it:
>>
>> Compile all the *.cpp files with:
>> clang++ -target $TRIPLE --sysroot=/path/to/your/targets/sysroot
>> -funwind-tables -std=c++11 -stdlib=libc++ -fstrict-aliasing
>> -Wstrict-aliasing=2 -Wsign-conversion -Wshadow -Wconversion
>> -Wunused-variable -Wmissing-field-initializers -Wchar-subscripts
>> -Wmismatched-tags -Wmissing-braces -Wshorten-64-to-32 -Wsign-compare
>> -Wstrict-aliasing=2 -Wstrict-overflow=4 -Wunused-parameter -Wnewline-eof
>>
>> And similarly, all the *.c files with:
>> clang -target $TRIPLE --sysroot=/path/to/your/targets/sysroot
>> -funwind-tables -std=c11 -fstrict-aliasing -Wstrict-aliasing=2
>> -Wsign-conversion -Wshadow -Wconversion -Wunused-variable
>> -Wmissing-field-initializers -Wchar-subscripts -Wmismatched-tags
>> -Wmissing-braces -Wshorten-64-to-32 -Wsign-compare -Wstrict-aliasing=2
>> -Wstrict-overflow=4 -Wunused-parameter -Wnewline-eof
>>
>> On bare-metal, I also build the unwinder's *.c,*.cpp, and *.S files, but
>> on linux you'll want to skip that step.
>>
>> Finally, archive all the *.o files into a static libarary with ar, and
>> ranlib. At link time, you'll need to pull in -lgcc_s (which is for the
>> unwinder).
>>
>> I can share my modifications to the buildit & testit scripts if you think
>> they would be useful to you.
>>
>>
>> As for __USING_SJLJ_EXCEPTIONS__, I checked and it is indeed a compiler
>> builtin for both clang and gcc. __ARM_EABI_UNWINDER__ does not seem to be,
>> and I don't see anything nearby to where I found the SJLJ one that would
>> indicate what we want.  I think the right thing to check for here is:
>>   #if __arm__ && !defined(__USING_SJLJ_EXCEPTIONS__)
>>
>>
>> Cheers,
>> Jon
>>
>>
>> On 4/16/14, 5:11 AM, Logan Chien wrote:
>>>
>>> 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
>>> <mailto: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
>>>     <mailto:jonathan at codesourcery.com>> wrote:
>>>
>>
>> --
>> 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
>




More information about the cfe-commits mailing list