Commit Graph

448 Commits

Author SHA1 Message Date
Saleem Abdulrasool 3db633ab81 unwind: use explicit memcpy for register saving
Convert the register saving code to use an explicit memcpy rather than the
implicit memcpy from the assignment.  This avoids warnings from -Wcast-qual on
GCC and makes the code more explicit.  Furthermore, use sizeof to calculate the
offsets rather than adding magic numbers, improving legibility of the code.
NFC.

llvm-svn: 228904
2015-02-12 04:25:05 +00:00
Saleem Abdulrasool a6b32ccec4 unwind: move exported APIs out of header
Ideally, we would do something like inline __declspec(dllexport) to ensure that
the symbol was inlined within libunwind as well as emitted into the final DSO.
This simply moves the definition out of the header to ensure that the *public*
interfaces are defined and exported into the final DSO.

This change also has "gratuitous" code movement so that the EHABI and generic
implementations are co-located making it easier to find them.

The movement from the header has one minor change introduced into the code:
additional tracing to mirror the behaviour of the non-EHABI interfaces.

llvm-svn: 228903
2015-02-12 04:25:03 +00:00
Saleem Abdulrasool a9bd96e76a unwind: tweak inclusion ordering to work around GCC
This is a slightly convoluted workaround.  GCC does not support the
__has_feature extension of clang, and this results in some issues with
static_asserts.  config.h defines static_assert as a macro with a C-specific
trickery.  This then propagates into the C++ headers included after config.h,
which are used with C++11 mode, enabling constexpr constructors.  The macro'ed
static_assert does not get treated as the static_assert builtin, and will cause
an error due to a non-empty constexpr constructor.  Tweaking the include order
permits the use of libc++ headers to build libunwind with GCC on Linux.

llvm-svn: 228809
2015-02-11 05:20:53 +00:00
Saleem Abdulrasool b8a83fdf5c unwind: clean up some -Werror=return-type warnings
Mark that the functions always return or abort if the register class is
unhandled.  Avoid placing the abort in the switch to permit -Wswitch-cover to
catch missing values.

llvm-svn: 228808
2015-02-11 05:20:50 +00:00
Saleem Abdulrasool e133422fa4 unwind: clean up more -Wformat warnings
This makes compilation on ARM -Wformat clean with GCC.  NFC.

llvm-svn: 228807
2015-02-11 05:20:47 +00:00
Saleem Abdulrasool 7ebbcd968b unwind: clean up straggling -Wundef warning
Conservatively define __ARM_ARCH to 4 in the case that it is undefined (e.g.
with GCC).

llvm-svn: 228806
2015-02-11 05:20:44 +00:00
Saleem Abdulrasool b5c3e56b38 unwind: silence -Wconversion warnings
Clean up implicit uint8_t to uint32_t conversion warnings identified by GCC.

llvm-svn: 228805
2015-02-11 05:20:42 +00:00
Eric Fiselier 1dfbfb8c9e Fix libcxxabi's library and object root for tests.
llvm-svn: 228779
2015-02-11 01:07:48 +00:00
Saleem Abdulrasool bb0aba7a00 unwind: improve compilation on Linux with gcc
gcc still defaults to C89 which does not support BCPL style comments.  This
splits up the sources list in CMakeLists and selectively adds compile flags for
using C99 which avoids a number of warnings in -Wpedantic mode.  NFC.

llvm-svn: 228665
2015-02-10 03:43:33 +00:00
Saleem Abdulrasool 10abd2ad1c unwind: clean up some stray semicolons
Clean up some stray semicolons found by GCC 4.9 -Wpedantic.  NFC.

llvm-svn: 228664
2015-02-10 03:43:31 +00:00
Saleem Abdulrasool 1dd9f685f4 unwind: clean up -Wundef warnings
The unified register management interfaces had multiple naked macros for
conditional logic.  This cleans them up to use the defined() form, avoiding
-Wundef warnings.  NFC.

llvm-svn: 228663
2015-02-10 03:43:28 +00:00
Saleem Abdulrasool 2fdc44021f unwind: fix -Wformat warnings from gcc
Clean up the format specifiers for pedantic compilation with gcc 4.9 on Linux.
NFC.

llvm-svn: 228662
2015-02-10 03:43:23 +00:00
Saleem Abdulrasool a805955910 Unwind: hoist placement delete into base class
Move the placement delete into the base class.  This permits the proper emission
of the virtual destructor in UnwindCursor by using the class specific placement
delete instead of the normal single element ::operator delete.  With this patch,
we can finally build libunwind as a DSO without a runtime dependency on
libc++/libc++abi.

llvm-svn: 228436
2015-02-06 20:34:17 +00:00
Saleem Abdulrasool fed959e02e Unwind: replace pure virtual functions with aborts
Convert all pure virtual functions in the UnwindCursor with implementations that
abort.  This is effectively manually replicating the current behaviour, whilst
removing the compiler generated calls to __cxa_pure_virtual, which will abort at
runtime with a message indicating that a pure virtual call was made.

The whitespace changes are the result of executing clang-format over the changed
region.

llvm-svn: 228423
2015-02-06 18:48:07 +00:00
Saleem Abdulrasool 123f44a2f6 unwind: use -fno-rtti -fno-exceptions -funwind-tables
RTTI and exceptions are not needed for the unwinder, the use of C++ there is for
very specific cases, and does not require dynamic_cast nor does it use
exceptions.  This avoids unnecessary references to type information being
emitted.

llvm-svn: 228408
2015-02-06 17:47:57 +00:00
Matthias Braun 8a3e33945e Fix build for apple machines.
HAVE_CRASHREPORTERCLIENT_H was potentially undefined and -Wundef is
enabled now.

llvm-svn: 228368
2015-02-06 01:25:08 +00:00
Dan Albert 02bc357b6c Fix build.
Had a bad rebase that merged the #if in two places. Whoops.

llvm-svn: 228366
2015-02-06 00:08:40 +00:00
Saleem Abdulrasool 37dd631804 Revert "indicate tag type in C"
This reverts commit 4963ea3107a2fdfae21f7806896905f20b21ff0d.

This change was wrong.  The parameter type is sugared via a typedef.  The errors
generated may have been due to a different root cause, and should be fixed
through the recent series of changes.

llvm-svn: 228365
2015-02-05 23:59:11 +00:00
Dan Albert f25c866ba6 [libcxxabi] Fix -Werror build for 32-bit non-ARM.
Summary:
The inclusion of Unwind-EHABI.h was insufficiently guarded
(LIBCXXABI_ARM_EHABI was beign checked without ever being defined).

Move the check into the header file itself, add the check to the
source file, and clean up the existing checks.

LIBCXXABI_ARM_EHABI didn't have a canonical defintion; it was
duplicated across cxxabi.h, libunwind.h, and unwind.h. Move the
definition into __cxxabi_config.h and clean up the old cruft (note: we
will have to ship this header).

There are also a few drive-by formatting/whitespace cleanups.

Reviewers: jroelofs, thakis, compnerd

Reviewed By: compnerd

Subscribers: compnerd, aemerson, cfe-commits

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

llvm-svn: 228363
2015-02-05 23:55:15 +00:00
Dan Albert b98c20cf7c Formatting fixes.
We should clang-format the whole thing when we finally move the
unwinder to its new home.

llvm-svn: 228360
2015-02-05 23:48:06 +00:00
Saleem Abdulrasool d88e51ced7 Fix compilation of unwind on Darwin-x86_64
EHABI related typedef sugar is gated via LIBCXXABI_ARM_EHABI which did not
protect the EHABI header.  This would cause declarations to be emitted on
non-EHABI targets, resulting in errors.  This permits compilation on Darwin.

llvm-svn: 228359
2015-02-05 23:27:41 +00:00
Saleem Abdulrasool ae1ca06a31 Silence some -Wundef warnings
config.h:53:7: warning 'FOR_DYLD' is not defined, evaluates to 0 [-Wundef]
Unwind_AppleExtras.cpp:44:5: warning '__arm__' is not defined, evaluates to 0 [-Wundef]
Unwind_AppleExtras.cpp:60:7: warning '__arm64__' is not defined, evaluates to 0 [-Wundef]
Unwind_AppleExtras.cpp:186:6: warning 'FOR_DYLD' is not defined, evaluates to 0 [-Wundef]

Use defined(macro) which should be equivalent in these cases, silencing -Wundef
warnings.  NFC.

llvm-svn: 228358
2015-02-05 23:27:39 +00:00
Saleem Abdulrasool ee0639d37e Silence warning about loss of precision
Explicitly cast to uintptr_t before casting to a 32-bit value.  Because this
code path is meant to be used in a 32-bit address space, this truncation should
be safe.

Unwind-EHABI.h:25:12: error: cast from pointer to smaller type 'uint32_t' (aka 'unsigned int') loses information

llvm-svn: 228357
2015-02-05 23:27:36 +00:00
Saleem Abdulrasool bb66601d7c indicate tag type in C
Mark the tag type (struct) for the _Unwind_Exception in C code.  This silences a
warning from clang about missing struct specifier.

llvm-svn: 228356
2015-02-05 23:27:34 +00:00
Greg Fitzgerald b5d5bceefe Install header files
llvm-svn: 228351
2015-02-05 22:46:43 +00:00
Dan Albert 3be4efa341 Some more -Wundef issues.
This should be all of them for Linux. Might be some for the others.

llvm-svn: 228267
2015-02-05 02:44:50 +00:00
Dan Albert 3bd13ca4e1 Enable -Wundef.
The problem that caused the need for http://reviews.llvm.org/D7419 was
caused by testing the value of something that was undefined. This
should prevent that in the future.

llvm-svn: 228257
2015-02-05 01:33:15 +00:00
Dan Albert 39477c4c8b Whitespace cleanup.
llvm-svn: 228195
2015-02-04 21:23:20 +00:00
Eric Fiselier 879d18bf4e Make test require 'linux' instead of 'linux2'
llvm-svn: 228073
2015-02-03 23:50:47 +00:00
Eric Fiselier 42c8f93cc8 Adopt CMake policy CMP0042. Set MACOSX_RPATH on by default.
llvm-svn: 227142
2015-01-26 22:00:30 +00:00
Eric Fiselier 753f7c306b [libcxxabi] Teach CMake better ways to find the libc++ source directory (and misc cleanup).
Summary:
The main section of this patch teaches CMake  a new option `LIBCXXABI_LIBCXX_PATH` that specifies the path to the libcxx source root. This information is passed to lit so that it can better find libc++'s python module. `LIBCXXABI_LIBCXX_PATH` is also used to help find the libc++ headers.

The rest of this patch is misc cleanup, mostly to make pep8 and pylint happy.
I've also copied libc++'s .gitignore into libc++abi.



Reviewers: jroelofs, danalbert

Reviewed By: danalbert

Subscribers: cfe-commits

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

llvm-svn: 226855
2015-01-22 20:00:06 +00:00
Logan Chien 957fd4d1d3 Enable backtrace_test for ARM.
llvm-svn: 226824
2015-01-22 13:40:16 +00:00
Logan Chien dbcd7a35f8 Add -funwind-tables to CMAKE_C_FLAGS.
Without -funwind-tables, the compiler won't generate the unwinding
table for these C functions.  However, the functions in libunwind,
such as `_Unwind_Backtrace()`, WILL unwind stack to get the backtrace.

llvm-svn: 226823
2015-01-22 13:39:08 +00:00
Logan Chien 6b2c971524 Force unwind frame with user-defined personality.
If libcxxabi is compiled as a shared library, and the
executable references the user-defined personality routines
(e.g.  __gxx_personality_v0), then the pointer comparison in
Unwind-EHABI.cpp won't work.  This is due to the fact that
the PREL31 will point to the PLT stubs for the personality
routines (in the executable), while the __gxx_personality_v0
symbol reference is yet another (different) PLT stub (in the
libunwind.)

This will cause _Unwind_Backtrace() stops to unwind the frame
whenever it reaches __gxx_personality_v0().  This CL fix the
problem by calling the user-defined personality routines
with an undocumented API for force unwinding.

llvm-svn: 226822
2015-01-22 13:38:11 +00:00
Logan Chien a713fce539 Fix _Unwind_Backtrace for libc++abi built with libgcc.
Implement an undocumented _US_FORCE_UNWIND flag for force
unwinding.

llvm-svn: 226820
2015-01-22 13:28:39 +00:00
Logan Chien 4947eb6e56 Allow libc++abi to be built without unwinder.
This CL adds a new compilation flags LIBCXXABI_USE_LLVM_UNWINDER
to specify whether the LLVM unwinder is enabled.  Besides, all
unwinder-specific code are guarded with this definition.

Now, libc++abi will be able to use the unwinding routine from libgcc
when LIBCXXABI_USE_LLVM_UNWINDER is disabled.

llvm-svn: 226819
2015-01-22 13:27:36 +00:00
Logan Chien e8a0761737 Remove _Unwind_{Get,Set}{GR,IP} from ARM EHABI build.
This commit partially reverts r219629.

This functions are not a part of ARM EHABI specification, and AFAIK,
the de facto implementation does not export these functions.

Without this change, any programs compiled with this unwind.h
will be incompatible with other implementations due to linkage
error.

llvm-svn: 226818
2015-01-22 13:25:55 +00:00
Jonathan Roelofs fcf053b342 Merge libc++abi's lit configuration with libc++'s
http://reviews.llvm.org/D6985

llvm-svn: 226737
2015-01-21 23:06:22 +00:00
Jonathan Roelofs e434b34fa3 Rename all of the tests in preparation for merging lit configs with libcxx
http://reviews.llvm.org/D7101

llvm-svn: 226691
2015-01-21 19:05:37 +00:00
Dan Albert b32408e092 Fix abort_message.cpp for the NDK.
The NDK doesn't have access to `android/set_abort_message.h`, so use
an extern declaration instead for API 21. For older releases, just use
`__assert2`, which will report to logcat and/or the tombstone for some
older releases.

llvm-svn: 226310
2015-01-16 20:00:49 +00:00
Dan Albert 91014006d1 LIBCXXABI_TARGET_TRIPLE won't always be set.
Fixes issue with r226235. Build configuration difference between
libc++ and libc++abi.

llvm-svn: 226240
2015-01-16 01:10:09 +00:00
Dan Albert 1fc2441447 [libc++abi] Add support for cross compiling.
Reviewers: EricWF, jroelofs

Reviewed By: jroelofs

Subscribers: cfe-commits

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

llvm-svn: 226235
2015-01-16 00:52:11 +00:00
Hans Wennborg 9db1d94ebb Update PACKAGE_VERSION to 3.7.0svn
llvm-svn: 226014
2015-01-14 18:30:55 +00:00
Dan Albert 502b7b4b36 Fix some formatting I messed up in r225187.
llvm-svn: 225194
2015-01-05 19:31:59 +00:00
Dan Albert 51477ad1a0 Make the Unwinder -Werror clean.
Mostly just format string fixes.
Tested clean on arm, x86, and x86_64 Linux.

llvm-svn: 225187
2015-01-05 18:07:36 +00:00
Joerg Sonnenberger 18c68105f9 Typo.
llvm-svn: 225136
2015-01-04 16:38:20 +00:00
Chandler Carruth 24a6b05680 [cmake/multilib] Teach libc++abi's CMake build to support multilib
libdir suffixes like 'lib64' or 'lib32'.

This support is currently very rhudimentary. We define a variable
LIBCXXABI_LIBDIR_SUFFIX. In a standalone build of libc++abi this can be
directly set as a cached variable to control the multilib suffix used.
When building libc++abi within a larger LLVM build, it is hard wired to
whatever LLVM libdir suffix has been selected. If this doesn't work for
someone, just let me know. I'm happy to change it.

Unfortunately, libc++abi's lit setup made this somewhat problematic to
change. It was setting variables up in a way that caused the resulting
build to not work with lit at all. To fix that, I've moved some
variables around in the CMake build to more closely match where and how
they are defined in the libc++ CMake build. This includes specifically
defining a library root variable in the CMake build where the libdir
suffix can be applied, and then using that rather than re-computing it
from the object directory in the lit config.

This is essentially new functionality for libc++abi so I don't expect it
to have any impact for folks until they start setting these variables.
However, I know libc++abi is built in a diverse set of environments so
just let me know if this causes you any problems.

llvm-svn: 224927
2014-12-29 12:22:04 +00:00
Logan Chien f52cf3318a Silence warnings in libunwind.
* Remove the embedded directive undefined behavior by moving the
  the #ifdef out of the macro arguments.  [-Wembedded-directive]

* Remove the local variable shadowing warning by renaming
  frameInfo in UnwindLevel1-gcc-ext.c.  [-Wshadow]

* Explicitly cast the function pointer to void pointer to avoid
  the comparison between function pointer and void pointer.
  [-Wpedantic]

llvm-svn: 224690
2014-12-21 14:22:00 +00:00
Nick Kledzik f11e8eab52 [libunwind] improve x86_64 comments in compact_unwind_encoding.h
llvm-svn: 224657
2014-12-20 01:22:54 +00:00
Nick Kledzik fcf7c85c43 [libunwind] fix comment in compact_unwind_encoding.h
llvm-svn: 224656
2014-12-20 01:14:38 +00:00
Dan Albert 12c0c8b67f [libcxxabi] Add __cxa_thread_atexit for TLS support on Linux.
Summary:
Fixes PR21738.

The implementation for this is handled by __cxa_thread_atexit_impl,
which is supplied by libc.

More information:
https://sourceware.org/glibc/wiki/Destructor%20support%20for%20thread_local%20variables

Reviewers: mclow.lists, EricWF, jroelofs

Reviewed By: jroelofs

Subscribers: majnemer, cfe-commits

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

llvm-svn: 224477
2014-12-18 00:03:57 +00:00
Justin Bogner 035b964d72 Use the newer python syntax for exceptions
We've dropped support for python 2.5, so now we can use the forward
compatible "except ... as" syntax.

llvm-svn: 224182
2014-12-13 02:49:27 +00:00
Eric Fiselier eae1b6a6d7 Fix comment on end of #endif to match #if
llvm-svn: 222719
2014-11-25 03:19:02 +00:00
Eric Fiselier 17b1568fc4 Use lit.util.executeCommand instead of our own version
llvm-svn: 222718
2014-11-25 03:06:31 +00:00
Eric Fiselier 559f867af2 [libcxxabi] Refactor building and testing libc++abi without threads
Summary:
This patch adds CMake support for building and testing libc++abi without threads. 


1. Add `LIBCXXABI_ENABLE_THREADS` option to CMake.
2. Propagate `LIBCXXABI_ENABLE_THREADS` to lit via lit.site.cfg.in
3. Configure tests for `LIBCXXABI_ENABLE_THREADS=OFF

Currently the test suite does not work when libc++abi is built without threads because that information does not propagate to the test suite.



Reviewers: danalbert, mclow.lists, jroelofs

Reviewed By: jroelofs

Subscribers: cfe-commits

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

llvm-svn: 222702
2014-11-24 22:42:03 +00:00
Eric Fiselier c5de7b113b [libcxxabi] Refactor test timing logic and disable by default.
Summary:
When using LIT the timing output is entirely unused but introduces a dependency on `<chrono>`. When libc++ is built without a montonic clock this causes some of the tests to fail.
This patch factors out all of the timing logic into `support/timer.hpp` and disables it by default. To enable the timing you must define `LIBCXXABI_TIME_TESTS`.



Reviewers: mclow.lists, danalbert, jroelofs

Reviewed By: jroelofs

Subscribers: cfe-commits

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

llvm-svn: 222701
2014-11-24 22:38:57 +00:00
Eric Fiselier 90c138ea6d [libcxxabi] Delay adjustment of pointer to prevent referencing invalid memory.
Summary:
This patch delays the dereference adjustment until we are sure the thrown type is a pointer type. It is possible the thrown type is not a pointer and is smaller than `sizeof(void*)`. If the thrown type is is smaller than `sizeof(void*)` the deference adjustment will result in a heap buffer overflow.

I audited all the call sites of `can_catch(...)` and there are no places where `adjustedPtr` is used if `can_catch(...)` returns false. For this reason the patch should not introduce any functionality change.

This patch fixes the following tests when using ASAN:
* unwind_01.cpp
* unwind_02.cpp
* unwind_04.cpp



Reviewers: danalbert, jroelofs, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 222674
2014-11-24 18:46:37 +00:00
Eric Fiselier 5c24658328 Ensure llvm-sanitizer is found by the tests when using sanitizers.
llvm-svn: 222496
2014-11-21 02:16:19 +00:00
Eric Fiselier a315865759 [libcxxabi] Cleanup memory in tests to placate ASAN.
Summary: ASAN fires on these tests because they don't clean up their memory.

Reviewers: danalbert, jroelofs, mclow.lists

Reviewed By: jroelofs

Subscribers: dblaikie, cfe-commits

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

llvm-svn: 222493
2014-11-21 01:53:51 +00:00
Eric Fiselier 6e0c917042 Remove accidentally commited line in commit. Sorry
llvm-svn: 222314
2014-11-19 05:00:57 +00:00
Eric Fiselier ef2ad33e8a Add support for LLVM_USE_SANITIZER=Thread to test suite
llvm-svn: 222260
2014-11-18 21:28:49 +00:00
Eric Fiselier 5cb5051b46 [libcxxabi] Refactor CMakeLists.txt's handling of compile and link flags to suppress warnings.
Summary:
This patch mirrors the recent change to libc++ found here http://reviews.llvm.org/D6277.
This fixes PR20395 (http://llvm.org/bugs/show_bug.cgi?id=20395).

Reviewers: jroelofs, mclow.lists, danalbert

Reviewed By: danalbert

Subscribers: cfe-commits

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

llvm-svn: 222252
2014-11-18 20:37:53 +00:00
Eric Fiselier 00616f1039 Add -g -fno-omit-frame-pointer when compiling tests with sanitizers
llvm-svn: 222053
2014-11-14 22:27:43 +00:00
Renato Golin 083eb00d9d Make sure only NEON enabled devices save/restore D16+ registers
llvm-svn: 221532
2014-11-07 16:33:58 +00:00
Renato Golin d4ac2ba618 Move ARM failure from FIXME to XFAIL
llvm-svn: 221515
2014-11-07 10:30:53 +00:00
Eric Fiselier 4dfba103a7 Add support for UNSUPPORTED tag to lit
llvm-svn: 221460
2014-11-06 15:26:20 +00:00
Renato Golin c560b365a0 Disable backtrace libcxxabi test on ARM
_Unwind_Backtrace is not clearly defined in EHABI and needs more
testing. A bug was created with some initial investigation done
http://llvm.org/PR21444. This test fails with both libunwind and libgcc_s.

llvm-svn: 221348
2014-11-05 14:45:46 +00:00
NAKAMURA Takumi 59c74b225a Fix unicode chars into ascii in comment lines.
llvm-svn: 220668
2014-10-27 08:08:18 +00:00
Eric Fiselier 5a5fadd70d Change uses of `sys.platform == 'linux2' to `sys.platform.startswith('linux')
Although the current method is valid up till python 3.3 (which is not supported)
this seems to be a clearer way of checking for linux and moves the tests towards
python 3 compatibility.

llvm-svn: 220535
2014-10-23 23:05:46 +00:00
Eric Fiselier 17bb2118d2 Only link the tests against -ldl on linux
llvm-svn: 220509
2014-10-23 20:44:25 +00:00
Eric Fiselier 78d325c143 [libcxxabi] Add support for running libc++abi tests with sanitizers
Summary: Add support for LLVM_USE_SANITIZER to the libc++abi tests. Currently, if libc++abi is configured with LLVM_USE_SANITIZER then none of the tests will pass.

Reviewers: jroelofs, mclow.lists, danalbert

Reviewed By: danalbert

Subscribers: cfe-commits

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

llvm-svn: 220464
2014-10-23 03:10:43 +00:00
Dan Albert ff73fc9547 Add an .arcconfig for libc++abi.
llvm-svn: 220050
2014-10-17 16:48:56 +00:00
Eric Fiselier fe2e6e7964 [libcxxabi] Document the standalone build's requirements on llvm-config and llvm sources.
The current documentation does not explain that the standalone build requires
the LLVM sources. This patch updates the documentation to reflect this
requirement and explains how to manually specify the location of the required
files.

llvm-svn: 220049
2014-10-17 16:32:06 +00:00
Dan Albert b44ad60835 Correctly export _Unwind_[GS]et(GR|IP) for EHABI.
These need to have normal linkage instead of being static inline as
many libraries expect to be able to declare these and have the linker
find them rather than needing to include the header.

http://mentorembedded.github.io/cxx-abi/abi-eh.html

Also clean up some warnings while I'm here.

Reviewers: jroelofs, kledzik

Subscribers: cfe-commits

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

llvm-svn: 219629
2014-10-13 21:01:30 +00:00
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