Commit Graph

10 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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 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