Commit Graph

324 Commits

Author SHA1 Message Date
Reid Kleckner cf6b0c64b9 Use __atomic_exchange_n instead of Clang's __sync_swap
Also remove an extra extern "C" from a global variable redeclaration.
This allows building libcxxabi with GCC on my system.

Reviewers: majnemer

Differential Revision: http://reviews.llvm.org/D5604

llvm-svn: 219012
2014-10-03 20:03:47 +00:00
Jonathan Roelofs 205f8fd1ec Support Cortex-m0
As the title says... also, fix all the ARM asm return sequences so that they
work on processors without the BX instruction.

http://reviews.llvm.org/D5314

llvm-svn: 218869
2014-10-02 13:26:08 +00:00
Aaron Ballman eb7c1a6e50 Adding ABI support for __cxa_throw_bad_array_new_length.
llvm-svn: 217604
2014-09-11 17:26:43 +00:00
Renato Golin 128485ba47 ARM Unwind syntax
This patch fixes the bad argument that GAS accepted but the IAS didn't,
ie. {#0x20}, moving it to {0x20} which both accept. It also makes the
ARMv7+ save/restore correct by using VFP instructions rather than old
co-processor ones.

Fixes PR20529.

llvm-svn: 217585
2014-09-11 12:57:02 +00:00
Jonathan Roelofs 7decae153b Implement post-review comments for r216730
Feedback was 'this could use better comments'.

llvm-svn: 217459
2014-09-09 20:20:52 +00:00
Alexander Potapenko ed92fb9322 Remove an unused typedef from __class_type_info::search_below_dst
to fix the -Wunused-local-typedef warning.

llvm-svn: 217367
2014-09-08 13:56:36 +00:00
Renato Golin 88d5d9c2da Use correct __ARM_ARCH macro
llvm-svn: 217341
2014-09-07 18:39:44 +00:00
Jonathan Roelofs 3b7f085db1 s/LIBCXXABI_SINGLE_THREADED/LIBCXXABI_HAS_NO_THREADS/ for consistency with libcxx
Also remove the audotedection part so that if you're crazy enough to want a
single-threaded abi library, you'll say so explicitly in the build.

llvm-svn: 217262
2014-09-05 17:46:40 +00:00
Jonathan Roelofs 10e25f4a0c Allow LIBCXXABI_SINGLE_THREADED to be defined by build scripts
llvm-svn: 216952
2014-09-02 21:23:49 +00:00
Dan Albert e5f15210fb Add missing include to a test case.
Some platforms get size_t defined transitively by another include, but
Android does not.

llvm-svn: 216738
2014-08-29 16:09:32 +00:00
Dan Albert 2c012d495d Make _Unwind_Backtrace() work on ARM.
Summary: Since the personality functions do the actual unwinding on ARM,
and will also stop unwinding when they encounter a handler, we invoke
_Unwind_VRS_Interpret() directly form _Unwind_Backtrace().

To simplify, the logic for decoding an EHT is moved out of
unwindOneFrame() and into its own function, decode_eht_entry(). Unlike
unwindOneFrame(), which could only handle ARM's compact personality
function entries (section 6.3) decode_eht_entry() can handle the generic
entries (section 6.2).

Reviewers: jroelofs

Reviewed By: jroelofs

Subscribers: piman, aemerson, cfe-commits

Differential Revision: http://reviews.llvm.org/D5112

llvm-svn: 216730
2014-08-29 15:26:06 +00:00
Dan Albert 6bd6b1c177 Remove strict dependency on llvm-config.
Depending on llvm-config allows for a few nice things (auto-detecting
LLVM source tree, version numbers, etc), but it's makes bootstrapping a
pain. Keep the llvm-config features around, but also fall back to being
able to configure based on -DLLVM_PATH=path/to/llvm.

Reviewers: jroelofs, loladiro

Reviewed By: loladiro

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5016

llvm-svn: 216482
2014-08-26 20:50:07 +00:00
Jonathan Roelofs f0a3281c5f Add baremetal ARM support to libcxxabi/libunwind
http://reviews.llvm.org/D4993

llvm-svn: 216202
2014-08-21 18:42:36 +00:00
Dan Albert 07a78740ae Improve logging of aborts for Android.
In Android, stderr only goes to the console, and as such will only ever
be seen by adb shell users. Since very few developers will ever actually
see that, also send the abort message to logcat and the tombstone.

llvm-svn: 215983
2014-08-19 16:30:07 +00:00
Jonathan Roelofs 79b57011da libcxxabi must link to dl if using bundled unwind
Patch by Ismail Donmez
http://reviews.llvm.org/D4953

llvm-svn: 215950
2014-08-18 23:43:43 +00:00
Hans Wennborg d57db6e877 Fix the CMake build on Mac when setting MACOSX_DEPLOYMENT_TARGET=10.6
The build file was trying to use LIBCXXABI_VERSION, which isn't set
anywhere.

llvm-svn: 215465
2014-08-12 18:18:07 +00:00
Jonathan Roelofs 9245e6be86 Update CREDITS.txt with the list of folks who worked on ARM EHABI support
llvm-svn: 214877
2014-08-05 15:56:07 +00:00
Jonathan Roelofs 2745d4f0a1 Fix a copy-pasta in r214573
llvm-svn: 214873
2014-08-05 15:31:16 +00:00
Jonathan Roelofs d9dbecd74d [unwinder] Tell the assembler that functions are functions so that the linker knows how to link them.
This fixes an interworking problem when the unwinder/libcxxabi is built for
Thumb. When unw_getcontext is not marked as a function, 'bl' is used for the
branch instead of 'bx'.

llvm-svn: 214573
2014-08-01 22:02:21 +00:00
Nico Weber 3c2b2ae7a7 libcxxabi cmake: Use HandleLLVMOptions.cmake, don't manually add -std=c++11.
No intended behavior change on Linux and Mac OS X.  On Windows, having libcxxabi
in one's checkout should now no longer break running cmake. (cl.exe supports
c++11, but doesn't understand a -std= flag.)

llvm-svn: 213214
2014-07-16 23:53:37 +00:00
Dan Albert d321747153 Fix for libc++abi when using -Wl,--as-needed.
The cmake files for libc++abi and the unwinder weren't linking against
libpthread or an unwind library. If the tests were linked with
-Wl,--as-needed, these libraries wouldn't be linked, causing them to
fail.

Patch contributed by İsmail Dönmez.

llvm-svn: 212958
2014-07-14 17:00:29 +00:00
Dan Albert 923121e85b Support LLVM_LIBDIR_SUFFIX.
This is useful for distros installing under /usr/lib64.

Patch from İsmail Dönmez.

llvm-svn: 212826
2014-07-11 15:52:58 +00:00
Dan Albert 7c06819ecd Add support for building and testing the unwinder.
Note: The unwinder currently only works on Darwin and on ARM Linux.
Non-ARM Linux support is not yet implemented, and will fail to build.

llvm-svn: 212824
2014-07-11 15:36:02 +00:00
Dan Albert 3c4780e8c3 Make cmake cxxflags match those in lib/buildit.
llvm-svn: 212768
2014-07-10 22:23:03 +00:00
Dan Albert a770f9d66b Add lit configs for libcxxabi tests.
This makes running libcxxabi tests on Linux _much_ easier.
Adds a check-libcxxabi target to cmake.

Also defaults to building a dynamic libc++abi. This is so that the
default options still test the libc++abi that is being built. There are
two problems with testing a static libc++abi. In the case of a
standalone build, the tests will link the system's libc++, which might
not have been built against our libc++abi. In the case of an in tree
build, libc++ will prefer a dynamic libc++abi from the system over a
static libc++abi from the output directory.

llvm-svn: 212672
2014-07-10 02:20:11 +00:00
Dan Albert 0ed2e2f6ec Add a cmake build system.
Will add support for tests with lit in a later patch.
This does not yet support building the unwinder in src/Unwind.

llvm-svn: 212286
2014-07-03 19:35:48 +00:00
Dan Albert c67aa5403c Fix a warning about undeclared call to abort().
llvm-svn: 212232
2014-07-02 22:44:35 +00:00
Logan Chien 93a68fb0c7 Revert the LSDA change to scan_eh_tab.
This commit reverts the LSDA-related change in r211745.

The r211745 adds a new argument to scan_eh_tab(), i.e. lsda.
However, IMO, calling _Unwind_GetLanguageSpecificData() directly in
scan_eh_tab() was more intuitive and reduces several function call
to _Unwind_GetLanguageSpecificData() in __cxx_personality_v0().

llvm-svn: 212037
2014-06-30 12:35:29 +00:00
Logan Chien 05d761cf24 Silence the implicit signed/unsigned conversion warning.
llvm-svn: 211912
2014-06-27 17:17:44 +00:00
Logan Chien 92a4d51fa6 Silence unused variable and parameter warnings.
llvm-svn: 211790
2014-06-26 16:58:38 +00:00
Logan Chien 37be06a0c6 Fix linux build.
* Replace strlcpy with snprintf since strlcpy is not available
  in glibc.

* Replace __LINUX__ with __linux__.

llvm-svn: 211784
2014-06-26 13:56:23 +00:00
Logan Chien 6d3dae07ca Add missing header for _LIBUNWIND_LOG().
llvm-svn: 211775
2014-06-26 12:22:38 +00:00
Nick Kledzik 0f0cd46201 Fix building for iOS
llvm-svn: 211751
2014-06-26 00:25:33 +00:00
Nico Weber 49f09fd88a Minor libc++abi changes to make things build better with gcc.
llvm-svn: 211748
2014-06-25 23:55:37 +00:00
Nico Weber ae5438701e Update libc++abi to use the ARM EHABI unwinder from its libunwind.
llvm-svn: 211745
2014-06-25 23:52:07 +00:00
Nico Weber 97080e0c5e Land support for ARM EHABI unwinding for libunwind.
This was written by:
Albert Wong <ajwong@chromium.org>
Antoine Labour <piman@chromium.org>
Dana Jansen <danakj@chromium.org
Jonathan Roelofs <jonathan@codesourcery.com>
Nico Weber <thakis@chromium.org>

llvm-svn: 211743
2014-06-25 23:39:00 +00:00
Nico Weber af5ca95730 Start landing support for ARM EHABI unwinding.
The new code will be behind a LIBCXXABI_ARM_EHABI define (so that platforms
that don't want it can continue using e.g. SJLJ). This commit mostly just
adds the LIBCXXABI_ARM_EHABI define.

llvm-svn: 211739
2014-06-25 22:49:13 +00:00
Marshall Clow fa9fd4a09b Add a FAQ section, with a question about why the std::exception class destructors live in libc++abi
llvm-svn: 210661
2014-06-11 16:54:09 +00:00
Jonathan Roelofs 72a15cda3f Add test case for inherited exceptions
Test case written by Dana Jansens.

llvm-svn: 210129
2014-06-03 21:50:11 +00:00
Jonathan Roelofs 20f6f45c5b Add EH test case checking that handlers in noexcept functions can still unwind
llvm-svn: 209944
2014-05-31 00:25:59 +00:00
Jonathan Roelofs 75fd1b5f51 Add EH test cases corresponding to C++ ABI # 15.3.3
llvm-svn: 209943
2014-05-31 00:24:58 +00:00
Nico Weber 897f23dda8 Let libc++abi compile with gcc.
There was a single problem in cxa_demangle.cpp, where gcc would complain
`error: changes meaning of 'String'` about the line `typedef String String;`.
According to 3.3.7p2, this diagnostic is allowed (but not required, so clang
does not have to report this).

As a fix, make string_pair a template and pass String as template parameter.
This fixes the error with gcc and also removes some repetition from the code. 

No behavior change.

llvm-svn: 209909
2014-05-30 17:27:21 +00:00
Logan Chien 63488f0e4e Fix typo in comment.
llvm-svn: 208795
2014-05-14 17:16:57 +00:00
Richard Smith bd32a449e6 PR19091: Track whether we're demangling a function template specialization to
determine whether we get a mangling for a return type, rather than trying to
figure it out based on whether the mangled name ended with a '>'.

llvm-svn: 208611
2014-05-12 18:44:13 +00:00
Logan Chien dc65ab4cef Implement ARM EHABI exception handling.
This commit implements the ARM zero-cost exception handling
support for libc++abi.

llvm-svn: 208466
2014-05-10 00:42:10 +00:00
Logan Chien cc24fc546b Check exception specification with __cplusplus.
To allow the compilation with gcc, we can't use the
__has_feature(cxx_noexcept) to detect the default destructor
exception specification, which is noexcept(true) by default
in C++11.  We should use __cplusplus >= 201103L instead.

llvm-svn: 208465
2014-05-10 00:40:54 +00:00
Jonathan Roelofs 6bfee10279 Fixes more incorrect #ifs for SJ/LJ exceptions
Replaces several `#if __arm__` with `#if __USING_SJLJ_EXCEPTIONS__`.

llvm-svn: 208352
2014-05-08 19:13:16 +00:00
Jonathan Roelofs bce1e4d60e Fix broken build from r208135
llvm-svn: 208350
2014-05-08 18:48:43 +00:00
Marshall Clow 1f6f59ac37 Make libc++abi use the implementation of __numstr from libc++. No functionality change, just removal of duplicated code.
llvm-svn: 208246
2014-05-07 20:17:41 +00:00
Jonathan Roelofs 40e9842854 On single threaded systems, turn mutexes into nops
http://reviews.llvm.org/D3386

llvm-svn: 208135
2014-05-06 21:30:56 +00:00