Commit Graph

556 Commits

Author SHA1 Message Date
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
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
Joerg Sonnenberger c72473d87b Try harder to get the compiler to use float registers in different
places to increase the chance of messing up any preserved registers.

llvm-svn: 207938
2014-05-04 16:31:33 +00:00
Joerg Sonnenberger e9a72d54c7 Don't use bash features.
llvm-svn: 207907
2014-05-03 12:09:55 +00:00
Nick Kledzik 326254f422 Add unwind test case that checks restoring of float registers (such as on AArch64)
llvm-svn: 207481
2014-04-29 01:08:23 +00:00
Nick Kledzik d7339b48f7 Fix cast warning
llvm-svn: 207469
2014-04-28 23:49:49 +00:00
Nick Kledzik 0c790015df Use return address register from CIE. Move DwarfInstructions::lastRestoreReg() to Register::lastDwarfRegNum().
llvm-svn: 207467
2014-04-28 23:43:21 +00:00
Nick Kledzik 4141a3bca8 No need to specialize DwarfInstructions::getCFA(). It is the same for all archs
llvm-svn: 207463
2014-04-28 23:12:37 +00:00
Nick Kledzik 0fef333dee Properly sign extend delta in compact unwind info
llvm-svn: 207170
2014-04-25 01:39:06 +00:00
Nick Kledzik f00751bfa1 Fix one missed use of DW_EH_PE_omit in r203626
llvm-svn: 207169
2014-04-25 01:35:29 +00:00
Nick Kledzik 49fdc41b21 Remove unused/obsolete ARM64 constants
llvm-svn: 207064
2014-04-24 02:33:46 +00:00
Dan Albert 5f60710f2b Fix virtual class with non-virtual dtor complaint
Fixes compiler complaint about:
src/Unwind/UnwindCursor.hpp:366:25: error: 'libunwind::AbstractUnwindCursor' has virtual functions but non-virtual destructor [-Werror,-Wnon-virtual-dtor]

llvm-svn: 206942
2014-04-23 04:46:46 +00:00
Dan Albert 0056c8eb01 Fixes incorrect #ifs for SJ/LJ exceptions
The was working because, given __APPLE__, _LIBUNWIND_BUILD_SJLJ_APIS was set to
__arm__, but other ARM targets not using SJ/LJ will fail to compile.

llvm-svn: 206941
2014-04-23 04:45:42 +00:00
Dan Albert c579b935c3 Fixes type of dyldInfo for glibc/bionic systems
Darwin and the BSDs define a tagged struct dl_info typedef'd as Dl_info. glibc
and bionic typedef an anonymous struct as Dl_info.

llvm-svn: 206939
2014-04-23 04:20:57 +00:00
Jonathan Roelofs 9fc137bd1d Replace bzero with memset
... so that we can use newlib as the c library.

llvm-svn: 206427
2014-04-16 23:26:55 +00:00
Nick Kledzik 0f64d66304 Properly sign extend sdata2/4 in unwinder. Patch by Patrick Wildt
llvm-svn: 206122
2014-04-12 23:22:52 +00:00
Nick Kledzik 74ebf58742 Properly conditionalize DwarfFDECache<A>::dyldUnloadHook. Patch by Patrick Wildt
llvm-svn: 206121
2014-04-12 22:11:11 +00:00
Logan Chien aacc1c76f9 Code cleanup and re-indent cxa_exception.hpp
llvm-svn: 206108
2014-04-12 11:56:41 +00:00
Joerg Sonnenberger 7955feb82f The content of .eh_frame may be misaligned, so use memcpy. This is seen
in the wild on SH3.

llvm-svn: 205756
2014-04-08 11:43:49 +00:00
Joerg Sonnenberger fd0d20fae7 Include stdlib.h for getenv when !NDEBUG.
llvm-svn: 205573
2014-04-03 22:00:08 +00:00
Joerg Sonnenberger dfd7c9f324 Simplify.
llvm-svn: 204292
2014-03-20 01:28:28 +00:00
Joerg Sonnenberger 1ed1a3d994 Fix DW_CFA_GNU_args_size handling. The primary architecture using this
opcode is VAX. A function call pushes the number of arguments given onto
the stack and "ret" will pop it automatically. The FDE of the caller
contains the amount of stack space used for arguments (and possibly
extra padding), so unwinding has to compensate for this when "returning"
from a function. This is exactly the case when step() is done. The
existing handling in unw_set_reg no longer makes sense.

llvm-svn: 204290
2014-03-20 01:23:55 +00:00
Joerg Sonnenberger 59155e79cc 0 is a valid LSDA encoding and can be seen in statically linked
programs. Initialize lsdaEncoding to DW_EH_PE_omit and check for that
value to decide whether a value should be decoded.

llvm-svn: 203626
2014-03-11 23:43:43 +00:00
Anders Carlsson 3e107b3bd8 Demangle Dc to decltype(auto) as per the Itanium C++ ABI spec.
llvm-svn: 201533
2014-02-17 21:56:01 +00:00
Jonathan Roelofs c5f7e6fe67 [libcxxabi] Fix broken codesourcery.com links in comments
review: http://llvm-reviews.chandlerc.com/D2718
llvm-svn: 201208
2014-02-12 04:49:09 +00:00
Marshall Clow d230a3d1f6 Fix PR17221 - can't catch virtual base classes when throwing derived NULL pointers. Specifically, libc++abi would crash when you tried it.
llvm-svn: 200904
2014-02-06 04:47:02 +00:00
Marshall Clow 176be6fed5 Fix PR17222 - catching derived classes from thrown null pointer. Adds tests, too
llvm-svn: 200864
2014-02-05 18:19:57 +00:00
Nick Kledzik 1ffee2af6e [libunwind] remove stray conditional
llvm-svn: 200432
2014-01-30 00:27:16 +00:00
Nick Kledzik 53c98b071e Use .p2align instead of .align
llvm-svn: 199941
2014-01-23 21:46:35 +00:00
Nick Kledzik b3500e6061 Add missing alignment directives in assembly
llvm-svn: 199915
2014-01-23 18:42:10 +00:00
Nick Kledzik a625495cb8 Don't redefine static_assert()
llvm-svn: 199860
2014-01-23 02:08:14 +00:00
Nick Kledzik fd0a6cf17a Fix unwinder to build for iOS
llvm-svn: 199859
2014-01-23 02:06:19 +00:00
Howard Hinnant 5a7b4ca21e Implement demangling for user-defined operators.
llvm-svn: 198643
2014-01-06 23:05:04 +00:00
NAKAMURA Takumi d40d387fb1 Update the copyright credits -- Happy new year 2014!
FIXME: Dragonegg may be updated at non-trivial changes.
llvm-svn: 198274
2014-01-01 08:27:31 +00:00
Nico Weber 1c9ff122b6 Add a first cut at a Registers_arm class, to be used for 32bit arm EHABI unwinding.
llvm-svn: 197591
2013-12-18 17:53:55 +00:00
Nico Weber 5f513f9b4a Add mangling macros for Unwind's inline assembly.
This is in preparation for landing an implementation of unw_getcontext
on a system where it's mangled 'unw_getcontext', not '_unw_getcontext'.

llvm-svn: 197523
2013-12-17 21:07:53 +00:00
Howard Hinnant 14fe17f302 Fix demangling crasher. The crasher involved nested <encoding> involving parameter packs, which exposed a logic bug causing an empty vector<string> to be accessed with back(). In addition to fixing the bug, I've inserted numerous preemptive checks for similar bugs in the hopes that if another bug is uncovered, the bug results in an invalid mangled string instead of a demangler crash. Test suite updated with string that was causing the crash.
llvm-svn: 197063
2013-12-11 19:44:25 +00:00
Nico Weber 6b04d06ed3 Rename UnwindRegisters*.s files to UnwindRegisters*.S, step 2 of 2
These files require preprocessing, so their name should end with a capital S.

llvm-svn: 196555
2013-12-06 00:37:21 +00:00
Nico Weber c6a7b1bc92 Rename UnwindRegisters*.s files to UnwindRegisters*.S, step 1 of 2
These files require preprocessing, so their name should end with a capital S.

llvm-svn: 196554
2013-12-06 00:35:35 +00:00
Nico Weber c833ec0fca Fix minor initialization bug in Registers_x86_64.
According to kledzik, this constructor isn't live code, so no functionality
change.

llvm-svn: 196550
2013-12-06 00:11:01 +00:00
Nico Weber 6ceed44db4 80-column wrap a comment in a test
llvm-svn: 196540
2013-12-05 21:54:49 +00:00
Nick Kledzik 87d4a00e9e [unwind] remove darwin build dependency on <mach-o/dyld_priv.h>
llvm-svn: 196436
2013-12-05 00:12:03 +00:00
Marshall Clow 350bda6eb2 Fixed a couple of test errors; changed 'const A const *' to 'const A* const'. Thanks to Nico for the catch
llvm-svn: 196355
2013-12-04 05:39:55 +00:00
Mark Seaborn 664711188f Fix indentation of fields in __cxa_exception to line up
Align to 8 spaces instead of an inconsistent 9.

llvm-svn: 195974
2013-11-30 17:37:21 +00:00
Yaron Keren 7c6bb6500e On Windows, typeids are different between DLLs and EXEs, so comparing
type_info* will work for typeids from the same compiled file but fail
for typeids from a DLL and an executable. Among other things, exceptions
are not caught by handlers since can_catch() returns false.

Defining _LIBCXX_DYNAMIC_FALLBACK does not help since can_catch() calls
is_equal() with use_strcmp=false so the string names are not compared.

This patch compares typeids first (cheap) and only they are different
calls strcmp.

llvm-svn: 195502
2013-11-22 21:43:23 +00:00
Yaron Keren dde62a377c Comment correction. syslog() syntax is:
void syslog(int facility_priority, const char* format, ...);

This is indeed how it is used in private_typeinfo.cpp.

llvm-svn: 195452
2013-11-22 12:11:40 +00:00
Howard Hinnant 66da53e0da If libc++ has not declared bad_array_length, then declare it here just so that it gets into the binary.
llvm-svn: 194208
2013-11-07 17:16:37 +00:00
Nick Kledzik 2c88a9bfb0 Swap contents of UnwindRegistersRestore.s and UnwindRegistersSave.s
llvm-svn: 193840
2013-11-01 00:37:20 +00:00
Nick Kledzik fbea189748 Rename LIBUNWIND_AVAIL to LIBUNWIND_UNAVAIL so as to not conflict with other (different) LIBUNWIND_AVAIL define
llvm-svn: 193839
2013-11-01 00:32:26 +00:00
Howard Hinnant 517cb27c43 Move local Db type out to namespace scope.
llvm-svn: 193169
2013-10-22 16:45:48 +00:00
Saleem Abdulrasool 55410fff8e unwinder: conditionalise availability
__attribute__ (( unavailable )) is for Apple specific builds.  Create a macro
to conditionalise the usage of the macro.  This is to aid in porting the
unwinder to other platforms.

llvm-svn: 192868
2013-10-17 03:57:41 +00:00
Nick Kledzik 95a975bc60 [unwind] Fix unw_init_remote_thread() use to void* instead of thread_t for parameter to match other implementations
llvm-svn: 192248
2013-10-08 22:59:34 +00:00
Nick Kledzik 4d95aae2f7 [unwind] add required #include
llvm-svn: 192245
2013-10-08 22:51:34 +00:00
Nick Kledzik f6330ddc0d Fix conditionals on __Unwind_SjLj_* functions to only build for SJLJ based architectures
llvm-svn: 192241
2013-10-08 21:57:22 +00:00
Joerg Sonnenberger 31057d618e Consistent spelling of names.
llvm-svn: 192180
2013-10-08 12:35:07 +00:00
Nick Kledzik 312fcd0e1c libcxxabi contains the runtime support for C++. But, as some folks have
realized, it is not complete.  It relies on some _Unwind_* functions to be
supplied by the OS. That means it cannot be ported to platforms that don’t 
already have an unwinder.  

Years ago Apple wrote its own unwinder for MacOSX and iOS.  To make libcxxabi 
complete, Apple has decided the source code for its unwinder can be contributed
to the open source LLVM libcxxabi project, with a dual licensed under LLVM 
and MIT license.

So, I’ve spent some time cleaning up the sources to make them conform with 
LLVM style and to conditionalize the sources in a way that should make it 
easier to port to other platforms.  The sources are in a separate "Unwind" 
directory under "src" in libcxxabi.  

Background:
Most architectures now use "zero cost" exceptions for C++.  The zero cost means
there are no extra instructions executed if no exceptions are thrown.  But if 
an exception is thrown, the runtime must consult side tables and figure out how
to restore registers and "unwind" from the current stack frame to the catch 
clause.  That ability to modify the stack frames and cause the thread to resume 
in a catch clause with all registers restored properly is the main purpose 
of the unwinder.

This unwinder has two levels of API.  The high level APIs are the _Unwind_* 
functions which the cxa_* exception functions in libcxxabi require.  The low 
level APIs are the unw_* functions which are an interface defined by the the 
old HP libunwind project (which shares no code with this unwinder).

llvm-svn: 192136
2013-10-07 21:39:41 +00:00
Marshall Clow 46c9950f48 Adding bad_array_length to libc++abi
llvm-svn: 190479
2013-09-11 01:42:02 +00:00
Marshall Clow 9735f1a06b Add ability to set OPTIONS for compile
llvm-svn: 190371
2013-09-09 23:53:08 +00:00
Jean-Daniel Dupas 8d362a999e Change the two last remaining _LIBCPP_CANTTHROW to _NOEXCEPT
llvm-svn: 189603
2013-08-29 19:19:27 +00:00
Howard Hinnant 59a5a956f5 Propagate the removal of _LIBCPP_CANTTHROW (r189046) to libcxxabi. This fixes http://llvm.org/bugs/show_bug.cgi?id=16996.
llvm-svn: 189194
2013-08-25 17:00:57 +00:00
Howard Hinnant b162939c1a tip-of-trunk clang has corrected some access checks for special members in a virtual inheritance hierarchy. Change a few private inheritances to protected. This change will not impact what the test was testing. This fixes http://llvm.org/bugs/show_bug.cgi?id=16753.
llvm-svn: 187429
2013-07-30 19:00:45 +00:00
Howard Hinnant 04c4cffbe1 I had a buffer mismanagement bug in the demangler.
llvm-svn: 187255
2013-07-26 22:14:53 +00:00
Howard Hinnant ef93bc1c8a Updated CREDITS.TXT
llvm-svn: 185464
2013-07-02 19:01:59 +00:00
Howard Hinnant 60c16eb7f5 I'd no sooner made the last commit when Matthew Dempsky sent me another test case that led me to yet another closely related test case that the current design could not handle. I've now changed the way forward references are handled completely. It wasn't that much code to change. The demangler, when confronted with a forward reference to a template parameter, now parses things twice. During the second parse, all forward references are remembered from the first parse. Test suite updated with new case.
llvm-svn: 184672
2013-06-23 19:52:45 +00:00
Howard Hinnant cde9e006d8 After a private conversation with Arthur O'Dwyer, and a good night's sleep, I believe this fix is a better fix than what I committed in r184656 yesterday. I've basically moved the checking for '`' from the start of the demangling process to the end of it. In the process I discovered that one of the test cases no longer demangled to the expected string. After further investigation I believe this case to not be a valid mangled string, and so I moved the test case to the 'invalid cases'. The reason I believe it is invalid is that it should use T_ instead of T0_ to index the template parameter.
llvm-svn: 184668
2013-06-23 17:14:35 +00:00
Howard Hinnant ae10f9d45e Filter out '`' in mangled strings and reject them as invalid if found.
llvm-svn: 184656
2013-06-23 03:36:38 +00:00
Howard Hinnant 72a54eab35 I created a random mangled name generator and have thrown about 200 million random strings at the demangler. I succeeded in crashing it twice more and those crashers have been fixed and the test suite updated with the crash cases.
llvm-svn: 184562
2013-06-21 17:04:24 +00:00
Howard Hinnant 8935442538 Another demangler crasher. Updated test suite to prevent regression.
llvm-svn: 184477
2013-06-20 21:49:34 +00:00
Howard Hinnant 763e591461 Protect against invalid mangled names. Add test suite for invalid mangled names.
llvm-svn: 184394
2013-06-20 01:55:07 +00:00
Howard Hinnant b076753454 Demangle objc mangling implemented in r184250
llvm-svn: 184301
2013-06-19 13:43:18 +00:00
Howard Hinnant 80fe668394 Tweaks/cleanups provided by Matthew Dempsky
llvm-svn: 184118
2013-06-17 20:25:21 +00:00
Howard Hinnant 862c4a06ee Demangler update: This now demangles many more (all?) C++11 symbols. Demangler tests updated.
llvm-svn: 184097
2013-06-17 18:10:34 +00:00
Howard Hinnant f2ca35cd79 Add capability to demangle invocation functions for ObjC blocks.
llvm-svn: 179208
2013-04-10 19:44:03 +00:00
Howard Hinnant be2eced483 Bruce Mitchener: Typo fixes.
llvm-svn: 175275
2013-02-15 15:48:49 +00:00
Howard Hinnant 2b853bf65f Partially revert r152770. That commit moved the default handlers to their own file. But it also did some refactoring. It is the latter that is being reverted. The refactoring had accidentally removed the required effect that the default unexpected_handler calls std::terminate(), which is a visible effect.
llvm-svn: 174532
2013-02-06 19:29:55 +00:00
NAKAMURA Takumi 43632a26a5 Update the copyright coredits -- Happy new year 2013!
llvm-svn: 171342
2013-01-01 10:00:19 +00:00
Daniel Malea f32048d26b Rename class __lambda_node to ___lambda_node to fix compile failure with gcc 4.6 and 4.7
- using "__lambda_node" causes internal compiler error in newer GCC versions

llvm-svn: 169402
2012-12-05 18:55:49 +00:00
Howard Hinnant c1c87c15f2 __list::ends_with_template was giving the wrong answer for empty lists. And __parse_unnamed_type_name wasn't properly handling the list of paramters and was not safe against incorrectly mangled lambdas (running past last).
llvm-svn: 169022
2012-11-30 18:43:50 +00:00
Howard Hinnant 7166bff4ff Remove aborts under __dynamic_cast which were under _LIBCXX_DYNAMIC_FALLBACK. Change all type_info comparisons to use an inlined is_equal helper. However no change in functionality for this latter change at this time. This is just to encapsulate the comparison and make it a little easier to switch back and forth for testing/debugging.
llvm-svn: 168052
2012-11-15 18:00:42 +00:00
Howard Hinnant fe4d464f52 Update CREDIT.TXT
llvm-svn: 167847
2012-11-13 15:57:18 +00:00
Howard Hinnant 70abebed37 Wen-Han Gu: Fix for http://llvm.org/bugs/show_bug.cgi?id=14312 Exception Table out-of-range but still keep walking.
llvm-svn: 167733
2012-11-12 18:19:15 +00:00
Howard Hinnant c33e98ca05 Make the type_info for __shim_type_info visible. This should address some failing dynamic_casts that a few applications are doing on the type_info hierarchy.
llvm-svn: 165883
2012-10-13 18:45:59 +00:00
Micah Villmow fb89f27a8f Move TargetData to DataLayout.
llvm-svn: 165397
2012-10-08 16:29:26 +00:00
Howard Hinnant 538fe8f35b Set up code under _LIBCXX_DYNAMIC_FALLBACK which is off by default. For a full description of _LIBCXX_DYNAMIC_FALLBACK, see src/private_typeinfo.cpp.
llvm-svn: 164863
2012-09-28 22:43:50 +00:00
Howard Hinnant 785a8721d2 Improve the diagnostic messages on dynamic_cast.
llvm-svn: 164833
2012-09-28 17:58:48 +00:00
Howard Hinnant 2d0352cbf8 Two changes: 1) I still didn't have the ABI correct to match the gcc-4.2 std::string under the exception classes. I think the changes to stdexcept.cpp have got that down now. 2) On Apple platforms I'm seeing visibility bugs in applications with respect to type_info's being hidden. This is causing dynamic_cast to malfunction because there are multiple type_info's running around for one type within an application, making dynamic_cast believe that one type is actually multiple types. As a stop gap measure I'm trying to detect this error, print out an error message, but continue with the most likely desired result. This is all under __APPLE__. This behavior can be expanded to other platforms if desired.
llvm-svn: 164809
2012-09-28 00:05:34 +00:00
Marshall Clow 8493cad160 Updating email address
llvm-svn: 164490
2012-09-24 14:27:24 +00:00
Howard Hinnant 128ec49e29 Rename class __lambda to __lambda_node to avoid clash with gcc. This fixes http://llvm.org/bugs/show_bug.cgi?id=13889
llvm-svn: 164405
2012-09-21 19:21:37 +00:00
Howard Hinnant ed3d690f68 Tweak use of dlopen to be a little more correct and higher performing.
llvm-svn: 164404
2012-09-21 19:12:56 +00:00
Howard Hinnant e115af2777 I've added Apple-only behavior that looks for libstdc++ in the same process and if found, checks the string stored in <stdexcept> exception objects to see if it is the gcc empty string singleton before manipulating the reference count. This is done so that if such an exception is created with a zero-length string in libstdc++, libc++abi won't try to delete the memory. This is part of a ongoing process to make libc++ exceptions ABI-compatible with libstdc++-4.2 exceptions, to the point that each library can catch exceptions thrown by the other. If other parties would also like this behavior, the #if __APPLE__ can be broadened.
llvm-svn: 164170
2012-09-18 21:34:12 +00:00
Howard Hinnant 6aa048efc9 Specifically disallow primary-expressions of the form LT_... on the basis of this decition: http://sourcerytools.com/pipermail/cxx-abi-dev/2011-August/002422.html . Failure to disallow this was causing infinite recursion in the demangler when these symbols show up due to mangling bugs. This patch causes the demangler to return an invalid mangled name result rather than crash in infinite recursion.
llvm-svn: 163859
2012-09-13 23:49:59 +00:00
Howard Hinnant 2c2b55f27f Change size of reference count field in __libcpp_nmstr from 32 bits to 64 bits for 64 bit targets. This is controls the data layout of all exceptions defined in <stdexcept>. This aligns the ABI with that of gcc-4.2.
llvm-svn: 161496
2012-08-08 16:15:16 +00:00
Howard Hinnant 757640b156 Fixes apple: #12020687. This was a problem in the demangler with template
substitution forward references.  That is, sometimes a mangled name refers to
a substitution that hasn't yet been defined.  The demangler was derferencing a
null pointer in this case because it wasn't properly guarded against a
forward reference.  Test case added to catch this problem.

llvm-svn: 161267
2012-08-03 22:02:07 +00:00
Howard Hinnant 3a86b142a1 Update status.
llvm-svn: 161221
2012-08-02 22:06:41 +00:00
Howard Hinnant fdfcfcf670 Update CREDITS.TXT
llvm-svn: 161129
2012-08-01 19:24:04 +00:00
Howard Hinnant b2a9cee678 Erik Olofsson: This patch adds support for lambda demangling. I fixed this because it crashed lldb when it tried to demangle the added test.
Not sure how it should identify the lambda so that might need changing from the current 'lambdax'::  Howard:  Please patch CREDITS.TXT.

llvm-svn: 161125
2012-08-01 18:56:46 +00:00
Howard Hinnant a8c5d770f9 Andrew Morrow: Mainline clang seems to have recently become more strict about the
consistent application of visibility attributes, which causes some new
breakage in libcxxabi:

In file included from src/libcxxabi/src/cxa_default_handlers.cpp:19:
src/libcxxabi/src/private_typeinfo.h:123:23: error: visibility does
not match previous declaration
class __attribute__ ((__visibility__(default))) __class_type_info
                     ^
src/libcxxabi/src/private_typeinfo.h:19:13: note: previous attribute is here
#pragma GCC visibility push(hidden)
           ^
1 error generated.

The forward declaration of __class_type_info is picking up hidden
visibility from the #pragma, which conflicts with the default
visibility applied when the class is later fully declared. I'm
assuming that the full declaration has it right (and that the
diagnostic is correct), so the attached patch applies the default
visibility attribute to the forward declaration.

llvm-svn: 160933
2012-07-29 20:41:19 +00:00
Howard Hinnant 95d917f8ee Andrew Morrow: The variable 't1' on line 10188 of cxa_demangle.cpp is uninitialized
which generates -Wsometimes-uninitialized.  Howard:  The only thing this patch is missing is an update to CREDITS.TXT.

llvm-svn: 160932
2012-07-29 16:14:52 +00:00
Sylvestre Ledru 0527b8f942 add a link to the libc++ website
llvm-svn: 160553
2012-07-20 17:21:42 +00:00
Richard Smith 4c50ea27bf Add missing #include <stdlib.h> into test which uses ::exit.
llvm-svn: 160039
2012-07-11 09:37:56 +00:00
Howard Hinnant 7f53a5da57 Don't dereference root in __parse_ctor_dtor_name unless it is known to not be null.
llvm-svn: 158556
2012-06-15 21:57:51 +00:00
Howard Hinnant ba2e8aeda5 Fix bug in cxa_demangle involving template substitution.
llvm-svn: 155994
2012-05-02 15:38:11 +00:00
Howard Hinnant 9de0b35648 Make __cxa_new_handler un-mangled
llvm-svn: 155763
2012-04-28 16:46:04 +00:00
Howard Hinnant 2a9c509c7e Changed 'cause' from 'terminate' to 'uncaught' in default_terminate_handler
llvm-svn: 155452
2012-04-24 17:41:51 +00:00
Howard Hinnant b54f86aa9d Richard Smith: __int128 is a GNU keyword which clang 3.1 supports. This usage of it as an identifier will need to be renamed.
llvm-svn: 155044
2012-04-18 20:55:06 +00:00
Howard Hinnant e59dbd7b82 I would really like to write the handlers in terms of C++11 atomics. This would give us the best performance, portablity, and safety tradeoff. Unfortunately I can not yet do that. So I've put the desired code in comments, and reverted the handler getters to the slower but safer legacy atomic intrinsics.
llvm-svn: 153041
2012-03-19 16:56:51 +00:00
Howard Hinnant 4ac72dd982 I've moved __cxa_terminate_handler, __cxa_unexpected_handler and __cxa_new_handler from the public header cxxabi.h into the private header cxa_handlers.hpp. During this move I've also moved them from namespace __cxxabiapple into the global namespace. They are, and have always been extern C and so the namespace (or lack of it) does not affect their ABI. In general external clients should not reference these symbols. They are atomic variables and will be changing into C++11 atomic variables in the future. However for those few clients who really need access to them, their name, mangling, size, alignment and layout will remain stable. You just may need your own declaration of them. Include guards have been added to the private header cxa_exception.hpp. The private header cxa_default_handlers.hpp has been removed and the default handlers are now file-static. Include guards have been added to the private header cxa_handlers.hpp.
llvm-svn: 153039
2012-03-19 16:20:34 +00:00
Howard Hinnant 0f73197364 Arm fixes in cxa_personality.cpp and a little refactoring.
llvm-svn: 152966
2012-03-17 00:10:52 +00:00
Dave Zarzycki d6533ccd48 Less lame "concurrency" support
These APIs aren't thread safe, but they're pretending to be. Let's at
least make the getter as fast as they can be. The setters are a lost
cause unless the API can be fixed.

llvm-svn: 152786
2012-03-15 08:58:08 +00:00
Dave Zarzycki 13e35c086c Be friendly to when dead_strip doesn't work
Apple Radar: 11053417

llvm-svn: 152785
2012-03-15 08:58:06 +00:00
Nick Kledzik 778324abe4 move default handlers to their own file so they can be overridden at build time (dyld)
llvm-svn: 152770
2012-03-15 01:52:12 +00:00
Howard Hinnant ffa26667d9 Missed an underscore on the last commit.
llvm-svn: 152736
2012-03-14 19:39:50 +00:00
Howard Hinnant baae2be624 Enable __arm__ on apple
llvm-svn: 152735
2012-03-14 19:30:00 +00:00
Nick Kledzik 37cb6555f0 fix crash log magic
llvm-svn: 152693
2012-03-14 01:16:14 +00:00
Howard Hinnant 3bfc622bdb Enable / silence -Wunused-parameter.
llvm-svn: 152415
2012-03-09 18:01:37 +00:00
Howard Hinnant e6de8df54e Enable -Wstrict-aliasing=2 -Wstrict-overflow=4.
llvm-svn: 152338
2012-03-08 20:55:13 +00:00
Howard Hinnant 8292678017 Enable/silence -Wsign-compare.
llvm-svn: 152336
2012-03-08 20:51:01 +00:00
Howard Hinnant 71c4857a07 Enable/silence -Wsign-compare.
llvm-svn: 152335
2012-03-08 20:50:28 +00:00
Howard Hinnant 37c247c13c Enable/silence -Wmissing-field-initializers.
llvm-svn: 152334
2012-03-08 20:32:50 +00:00
Howard Hinnant 7cafb87441 Enable/silence -Wunused-variable.
llvm-svn: 152329
2012-03-08 20:23:24 +00:00
Howard Hinnant d121eb2c24 Enable/silence -Wconversion.
llvm-svn: 152328
2012-03-08 20:16:45 +00:00
Howard Hinnant 11dd38dab0 Enable/silence -Wshadow.
llvm-svn: 152325
2012-03-08 19:34:58 +00:00
Howard Hinnant 41bcf33c63 Enable/silence -Wsign-conversion.
llvm-svn: 152323
2012-03-08 18:45:24 +00:00
Howard Hinnant 20d6c14c88 First attempt at arm support.
llvm-svn: 151765
2012-02-29 22:14:19 +00:00
Howard Hinnant fdad25a40a Insert a couple of dummy virtual functions to ease low level binary compatibility with other low level tools.
llvm-svn: 151282
2012-02-23 21:09:29 +00:00
Howard Hinnant 2d809ac734 And the handlers should be extern C.
llvm-svn: 151261
2012-02-23 17:25:34 +00:00
Howard Hinnant 49f28b5a47 I had originally made the handler function pointers a static internal detail, not accessible to the outside world. I did this because they must be accessed in a thread-safe manner, and the library provides thread-safe getters and setters for these. However I am at least temporarily making them public and giving them the Apple-extension names. In the future these may disappear again, and I think that would probably be a good idea.
llvm-svn: 151256
2012-02-23 15:32:07 +00:00
Dave Zarzycki 3cd25390e5 Pedantic fix: missing newline at EOF
llvm-svn: 151132
2012-02-22 05:25:00 +00:00
Howard Hinnant 3e7d155768 Move typeinfos for exceptions in <stdexcept> to the abi
llvm-svn: 150834
2012-02-17 19:23:47 +00:00
Howard Hinnant 995fcc0d49 Add (reluctantly) a namespace alias for __cxxabiv1.
llvm-svn: 150828
2012-02-17 18:45:44 +00:00
Howard Hinnant d901bb4de4 Remove outdated information from comment.
llvm-svn: 150827
2012-02-17 18:45:04 +00:00
Howard Hinnant 71cf5ab0d3 __gxx_personality_v0 and __cxa_call_unexpected are complete on darwin and I *think* linux (not positive), but still unimplemented on arm.
llvm-svn: 149711
2012-02-03 20:53:52 +00:00
Howard Hinnant 92afda06d7 Pushed optimization back up. Crash disappeared with compiler upgrade. Assumed to be due to compiler bug.
llvm-svn: 149702
2012-02-03 18:36:36 +00:00
Howard Hinnant 31dea02601 corrected namespace in test
llvm-svn: 149635
2012-02-02 22:00:52 +00:00
Howard Hinnant eaa65afc7b Work on restricting symbol visibility.
llvm-svn: 149633
2012-02-02 20:47:28 +00:00
Howard Hinnant 90ef25c05e Add version number to this library so we can recognize when we're using it.
llvm-svn: 149632
2012-02-02 20:47:05 +00:00
Howard Hinnant 67e5863cd9 There's a crasher I need to track down, occurring at -O0.
llvm-svn: 149631
2012-02-02 20:42:31 +00:00
Marshall Clow a27b0cd8ee added const nullptr tests
llvm-svn: 149552
2012-02-01 22:27:24 +00:00
Marshall Clow e71ddf2fcb removed duplicated tests - Howard was quicker than me.
llvm-svn: 149545
2012-02-01 21:49:28 +00:00
Marshall Clow 62e0f4abf6 Added tests for catching const/non-const nullptr
llvm-svn: 149542
2012-02-01 21:37:24 +00:00
Howard Hinnant 60eaa49036 Add test for pointer qualification conversion.
llvm-svn: 149541
2012-02-01 21:25:40 +00:00
Howard Hinnant 30025116de Changed a TODO to a 'maybe some time in the future'.
llvm-svn: 149539
2012-02-01 21:12:07 +00:00
Howard Hinnant 8030b7f751 Removed DEBUG statements.
llvm-svn: 149538
2012-02-01 21:08:30 +00:00
Howard Hinnant 089123e65f Remove a TODO regarding where some can_catch are implemented. I opted to make can_catch pure virtual in the top __shim_type_info, and have each sub-class implement its own. There are some repeated definitions, but they are trivial.
llvm-svn: 149537
2012-02-01 21:06:46 +00:00
Howard Hinnant c325fa7705 Add some tests to test catching nullptr with pointers and member pointers. Tests are only activated if #if __has_feature(cxx_nullptr).
llvm-svn: 149536
2012-02-01 21:01:52 +00:00
Howard Hinnant 2d6810fbd6 Quash a TODO related to catching pointer-to-member. These tests fail on my copy of gcc-4.2. But I believe the tests to be correct (and they pass for libc++abi). I've enquired on the C++ standards mailing list for a clarification in case I'm wrong. So far I've gotten one response that agrees with me.
llvm-svn: 149534
2012-02-01 20:53:21 +00:00
Howard Hinnant a21f8c2acf Quash TODO regarding catch by function type. Add tests to back it up.
llvm-svn: 149530
2012-02-01 19:42:45 +00:00
Howard Hinnant 26ffb64177 Quash TODO regarding catch by array type. Add tests to back it up.
llvm-svn: 149527
2012-02-01 19:21:28 +00:00
Howard Hinnant 69a10f466b Removing a TODO: can_catch is fundamentally different than search_above_dst. can_catch is looking for an unamiguous public base class of a specific type, but at any address. search_above_dst is looking for an unambiguous public base class of a specific type, *and* at a specific address. Additionally can_catch is run for all types. search_above_dst is only run on class types. So these are only superficially similar. Not similar enough for resuse, at least without making the code unreadable.
llvm-svn: 149522
2012-02-01 18:52:35 +00:00
Howard Hinnant d0bfbb336f Teach exception_cleanup_func about dependent exceptions.
llvm-svn: 149520
2012-02-01 18:44:21 +00:00
Howard Hinnant 8aa78517ab Treat all exceptions except that the ones that this library throws as foreign. Even other C++ exceptions.
llvm-svn: 149518
2012-02-01 18:15:15 +00:00
Howard Hinnant 62efe0b062 Nothing but polishing comments.
llvm-svn: 149515
2012-02-01 16:56:40 +00:00
Howard Hinnant 4ca103d14c Move an error detector to a better place.
llvm-svn: 149513
2012-02-01 16:16:11 +00:00
Howard Hinnant 3b22c6c395 Here's a test for catching pointers.
llvm-svn: 149459
2012-02-01 00:22:38 +00:00
Howard Hinnant 372e2f4bd4 More test cases concentrating on catching class types.
llvm-svn: 149453
2012-01-31 23:52:20 +00:00
Howard Hinnant eedecf51bb Some unwinding test cases
llvm-svn: 149436
2012-01-31 21:58:58 +00:00
Howard Hinnant 310fcc749d Back the optimization down from -O3 to -Os. I'm getting an unexplained crasher on -O3. I've looked for a libc++abi bug and can't find one. I'm suspecting clang optimizer bug. But I don't have a good test case at the moment. Deferring investigation on this for now as I will soon be developing more and smaller tests.
llvm-svn: 149414
2012-01-31 20:22:59 +00:00
Howard Hinnant 3d97931a86 Drop the stress a notch on dynamic_cast_stress.cpp. Otherwise it occasionally causes clang to crash. Put a noexcept(false) on a throwing destructor in test_vector1.cpp. The test now passes for both C++03 and C++11 modes. Add testit script. All tests are now PASSING :-)
llvm-svn: 149413
2012-01-31 20:10:33 +00:00
Howard Hinnant f8d292eb08 Correct test bug.
llvm-svn: 149412
2012-01-31 20:01:06 +00:00
Howard Hinnant fe2052d635 Have the default unexpected/terminate handler output *demangled* names for the type of exception instead of the mangled name.
llvm-svn: 149409
2012-01-31 19:48:06 +00:00
Howard Hinnant 43f5fecdb5 Fix type-o in the comment of the last commit
llvm-svn: 149403
2012-01-31 19:05:08 +00:00
Howard Hinnant 6351792447 Found and fixed a bug in __cxa_call_unexpected. If the unexpected_handler rethrows the same exception then needed information gets overwritten in the original exception header. Therefore save it locally before executing the unexpected_handler.
llvm-svn: 149400
2012-01-31 18:57:20 +00:00
Howard Hinnant d96cac1282 Found and fixed bug in personality function: Don't dive into the action table if the action entry is zero.
llvm-svn: 149389
2012-01-31 17:15:14 +00:00
Howard Hinnant d6d4c25ef0 Minor bug fix in __cxa_call_unexpected. Changed std::terminate to detect a caught-but-unhandled exception, and choose the handler out of that if found.
llvm-svn: 149329
2012-01-31 01:51:15 +00:00
Howard Hinnant c9204f6bed Refactored personality function. Found one bug in scanning exception spec lists.
llvm-svn: 149272
2012-01-30 20:16:21 +00:00
Howard Hinnant 2c50972c32 Removed debugging print statements
llvm-svn: 149271
2012-01-30 20:13:37 +00:00
Howard Hinnant 47cb854818 Add a descriptive name for a constant. Also I'm at least temporarily waging war on throw specs, both old and new style. Except where we have already publicly exposed the throw spec, I'm getting rid of them. They may come back later. But they seem somewhat prone to cyclic dependencies here. The throw spec implies compiler generated code that this library has to jump to during stack unwinding. I'd like to minimize the possiblity that the code used to properly make that jump is itself creating such jumps.
llvm-svn: 149251
2012-01-30 16:07:00 +00:00
Howard Hinnant 3f0d2384aa Add -fstrict-aliasing -Wstrict-aliasing and change optimization from -Os to -O3
llvm-svn: 149250
2012-01-30 16:03:23 +00:00
Howard Hinnant 5bbc597f1e Put throw() clauses back on these functions in cxxabi.h. This header must be C++03 compatible and these throw specs are consistent with the current cxxabi.h that Apple ships.
llvm-svn: 149249
2012-01-30 16:02:11 +00:00
Howard Hinnant 9aa4684fbb Minor updates to a couple of comments.
llvm-svn: 149158
2012-01-28 00:34:46 +00:00