[cfe-dev] [libcxxabi] Contributing ARM EHABI support for libcxxabi
Nico Weber
thakis at chromium.org
Wed Dec 4 12:56:47 PST 2013
On Wed, Dec 4, 2013 at 12:11 PM, Nico Weber <thakis at chromium.org> wrote:
> On Tue, Dec 3, 2013 at 3:45 PM, Nick Kledzik <kledzik at apple.com> wrote:
>
>>
>> On Dec 3, 2013, at 2:32 PM, Nico Weber <thakis at chromium.org> wrote:
>>
>> > Hi,
>> >
>> > We’re evaluating using libc++ and libc++abi for Chromium/Android. While
>> libc++abi has an unwind implementation since r192136, we noticed that
>> there’s no support for unwinding using ARM EHABI-style unwind information,
>> so in the last two weeks some of us (Albert Wong, Antoine Labour, Dana
>> Jansens, and I) prototyped support for it, and we’re able to catch at least
>> simple exceptions (you can look at our code here [1]). We believe at least
>> some of our code is ready for upstreaming.
>> >
>> > A few questions:
>> > 1.) Is there interest for this upstream?
>> > 2.) Who should review this? Howard? Nick? Anton?
>> I can.
>>
>> > 3.) r192136 didn’t add any test – how should testing of unwinding code
>> work? Is running the exception tests in the libc++ suite enough?
>> The Darwin libunwind project (
>> http://opensource.apple.com/source/libunwind/libunwind-35.3/) on which
>> this was based had some a small test suite, but it did not fit into the
>> existing libcxxabi test suite which assumes target==host and every test is
>> one .cpp file.
>>
>
> Ok. I tried running at least the libc++abi test suite to make sure we
> don't completely break exception handling on darwin, but it looks like the
> buildit script doesn't build libunwind, and if I try to get it to compile
> (attached), the compiler complains about mach-o/dyld_priv.h – is it
> currently possible to run libc++abi tests for the Unwind bits of libc++abi
> on darwin?
>
If I copy
http://www.opensource.apple.com/source/dyld/dyld-132.13/include/mach-o/dyld_priv.h?txtto
include/mach-o/dyld_priv.h and build with the attached script, I'm
able
to build a libunwind.dylib that passes the tests and that fails them if I
add an early return to _Unwind_RaiseException. Would adding dyld_priv.h and
landing the attached patch be a good first step?
>
>
>>
>> > 4.) The unwind code doesn’t adhere to llvm style all that much – does
>> it make sense to clang-format while it still has next to no svn history
>> before landing other changes?
>> The Unwind part conforms to llvm style much more than the rest of
>> libcxxabi does ;-) I ran clang-format on the Unwind sources at one point
>> during the port from darwin. Feel free to use clang-format on new code.
>> My personal grip with clang-format is that it throws away all vertical
>> alignment.
>>
>>
>> -Nick
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131204/71f1518c/attachment.html>
-------------- next part --------------
Index: ../lib/buildit
===================================================================
--- ../lib/buildit (revision 196341)
+++ ../lib/buildit (working copy)
@@ -27,12 +27,13 @@
RC_ProjectSourceVersion=1
fi
-EXTRA_FLAGS="-std=c++11 -stdlib=libc++ -fstrict-aliasing -Wstrict-aliasing=2 \
+EXTRA_FLAGS="-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"
+EXTRA_CXXFLAGS="-std=c++11 -stdlib=libc++"
case $TRIPLE in
*-apple-*)
@@ -82,18 +83,45 @@
set -x
for FILE in ../src/*.cpp; do
- $CXX -c -g -O3 $RC_CFLAGS $EXTRA_FLAGS -I../include $OPTIONS $FILE
+ $CXX -c -g -O3 $RC_CFLAGS $EXTRA_FLAGS $EXTRA_CXXFLAGS \
+ -I../include $OPTIONS $FILE
done
case $TRIPLE in
*-*-mingw*)
for FILE in ../src/support/win32/*.cpp; do
- $CXX -c -g -Os $RC_CFLAGS $EXTRA_FLAGS -I../include $OPTIONS $FILE
+ $CXX -c -g -Os $RC_CFLAGS $EXTRA_FLAGS $EXTRA_CXXFLAGS \
+ -I../include $OPTIONS $FILE
done
;;
esac
-$CC *.o $RC_CFLAGS $LDSHARED_FLAGS $EXTRA_FLAGS
+$CC *.o $RC_CFLAGS $LDSHARED_FLAGS $EXTRA_FLAGS $EXTRA_CXXFLAGS
if [ -z $RC_XBS ]
then
rm *.o
fi
+
+# libunwind is a separate library on Darwin.
+case $TRIPLE in
+ *-apple-*)
+ for FILE in ../src/Unwind/*.cpp; do
+ $CXX -c -g -O3 $RC_CFLAGS $EXTRA_FLAGS $EXTRA_CXXFLAGS \
+ -fno-rtti -fno-exceptions -I../include $OPTIONS $FILE
+ done
+ for FILE in ../src/Unwind/*.{c,s}; do
+ $CC -c -g -O3 $RC_CFLAGS $EXTRA_FLAGS -I../include $OPTIONS $FILE
+ done
+ LDSHARED_FLAGS="-o libunwind.dylib \
+ -dynamiclib -nodefaultlibs \
+ -current_version ${RC_ProjectSourceVersion} \
+ -compatibility_version 1 \
+ -install_name /usr/lib/system/libunwind.dylib \
+ -lSystem"
+ $CC *.o $RC_CFLAGS $LDSHARED_FLAGS $EXTRA_FLAGS $EXTRA_CXXFLAGS
+
+ if [ -z $RC_XBS ]
+ then
+ rm *.o
+ fi
+ ;;
+esac
More information about the cfe-dev
mailing list