Commit Graph

444 Commits

Author SHA1 Message Date
Saleem Abdulrasool 9dd5ca1fe8 unwind: always export unw_local_addr_space
It seems that the remote unwinder is entirely unused at this moment.
unw_local_addr_space was referencing sThisAddressSpace which use to be a static
in global namespace.  It has since then become a member variable of
LocalAddressSpace.  Update this definition and always export it (needed to
implement unw_get_proc_info_by_ip for ARM).

llvm-svn: 229133
2015-02-13 19:04:48 +00:00
Saleem Abdulrasool ebfe815f5c unwind: use sizeof() instead of hardcoded sizes
The statically allocated strings have a fixed size which can be computed using
the sizeof operator rather than duplicating the allocation size which can drift.
NFC.

llvm-svn: 229126
2015-02-13 17:36:11 +00:00
Ed Schouten 12dc2c4f3b Don't use bzero() and strcpy().
Instead of bzero(), we can simply use memset(). The strcpy() calls are
unneeded, as we can simply keep track of a pointer to the constant
strings we are copying.

Reviewed by:	Jonathan Roelofs

llvm-svn: 229074
2015-02-13 07:18:22 +00:00
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
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
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
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
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 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
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
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 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 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
Renato Golin 083eb00d9d Make sure only NEON enabled devices save/restore D16+ registers
llvm-svn: 221532
2014-11-07 16:33:58 +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 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
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 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
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 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
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
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
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
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 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
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
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
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
Howard Hinnant 517cb27c43 Move local Db type out to namespace scope.
llvm-svn: 193169
2013-10-22 16:45:48 +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
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 04c4cffbe1 I had a buffer mismanagement bug in the demangler.
llvm-svn: 187255
2013-07-26 22:14:53 +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
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 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
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
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 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
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 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 d901bb4de4 Remove outdated information from comment.
llvm-svn: 150827
2012-02-17 18:45:04 +00:00
Howard Hinnant eaa65afc7b Work on restricting symbol visibility.
llvm-svn: 149633
2012-02-02 20:47:28 +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 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