27 Commits (6bd3db586622e86301938fe5fccb0dfecb544cfd)

Author SHA1 Message Date
Frederik Carlier 6bd3db5866
MinGW: Use _Unwind_RaiseException to throw exceptions (#278)
The current implementation uses Vectored Exception Handlers. This implementation is too greedy, and invokes _objc_unexpected_exception for (certain) exceptions which would be handled by the application itself.
2 years ago
Frederik Carlier 1ff5e1298d
Support building on msys/clang64 (#276)
* Support building on msys/clang64
* Support libc++
2 years ago
Frederik Carlier 65280908eb
Use C++ exceptions unconditionally for Objective-C[++] on MinGW (#267) 2 years ago
Frederik Carlier a61309b0d3 Support compiling on mingw (no exception handling) 2 years ago
David Chisnall 396c9b553a
Delete some dead code containing bugs. (#205)
Fixes #203
5 years ago
Graham Lee c399119694 Remove redundant declaration of __cxa_allocate_exception
Fixes #193
5 years ago
Niels Grewe 014f386f58 Add support for libc++abi.
Extends C++ interop with autodetected support for libc++abi in addition to the existing support for libcxxrt and libsubc++.

Fixes #142.
5 years ago
David Chisnall 3b8879720c More EH fixes.
libsupc++ is more aggressive about internal consistency checks than
libcxxrt, so we need to be more careful in the interop.  The tests from
PR #138 now pass for me on Debian with libsupc++.
6 years ago
David Chisnall ec5c0bcae2 More C++ exception fixes.
* Make sure the unwind state is synchronised between the Objective-C
   and C++ exception objects.
 * Reintroduce the is-pointer callback so that `__cxa_begin_catch`
   adjusts the pointer correctly.  Objective-C++ code uses
   `__cxa_begin_catch` without the `objc_begin_catch` wrapper and the
   runtime does not call the `__do_catch` method on the type info if the
   type info is an exact match, so the caught object ended up being a
   pointer to the object.  This also meant that we needed to remove the
   double dereference in the `__do_catch` methods.
 * Introduce a subclass of `std::type_info` for all Objective-C types
   and move the `virtual` functions there.  This should simplify
   supporting libc++abi.
6 years ago
David Chisnall 65d6b279a0 Rework C++ exception interop again.
We now, the first time we encounter a foreign exception, throw a C++
exception through a frame that has a custom personality function and
probe the layout of the __cxa_exception structure.
We then use the offsets learned from this along with the public ABI
functions for allocating the structure.

At the same time, add a test that we are correctly setting the count of
uncaught exceptions.

Fixes #146
6 years ago
David Chisnall 55819ce107 Move the libstdc++ code path to a separate file.
We need to #include <exception> for this to work, but this brings in the
public definition of `std::type_info` and, unfortunately, that breaks
the private definition that we need in this compilation unit.
6 years ago
David Chisnall 55a4719976 Attempt to fix libsupc++ support.
Recent versions of libstdc++ appear to have lost the clean layering
between libstdc++ and libsupc++, so use the high-level APIs and some
pointer evilness to fudge the low-level ones...
6 years ago
David Chisnall 0ad8cad910 Remove the include of <cxxabi.h>
This removes conflicting definitions on libsupc++ platforms.
6 years ago
David Chisnall 242442b3aa Rework Objective-C++ exceptions.
The new version now does not depend on the layout of the C++ exception
structure and instead finds the two offsets that it cares about.

Fixes #108
6 years ago
David Chisnall f05f3f73b3 Revert C++ exception structure changes.
The C++ runtime library passes pointers to the middle of the structure,
so we need to ignore the fields that were previously missing.
7 years ago
David Chisnall 088977679e DWARF EH cleanups.
Update the C++ ABI for the C++11 ABI and fix the missing ARM-specific
bits.  Work around a bug in ARM.
7 years ago
David Chisnall 0ae4e4ceb7 Remove the need to include C++ <exception>
We were only doing it to get two definitions, which are both mandated by
the spec, so we may as well avoid all of the headaches involved.

Also remove the extern "C" from the runtime.h include while we're here,
as it is no longer needed.

Fixes #69
8 years ago
theraven c819b379da Fix the build with GC enabled, export the GC symbols in all build configurations. 13 years ago
theraven 6317b79a10 Implemented the new exception ABI, and a load of tests for it. This is used by
clang trunk if -fobjc-runtime-1.7 is specified and provides significantly
better interoperability with foreign exceptions.

Note: Most of the exception tests will not pass with gcc or clang < 3.3.  They
test things that are impossible to implement quite correctly with the
GCC-compatible exception ABI.

Also updated the release notes to reflect recent improvements.
13 years ago
theraven 2410ca70e2 Made name() const to avoid missing symbol error with libobjcxx. 13 years ago
theraven 26784adc0a Fix some warnings.
Remove the dependency on <typeinfo> containing the vtable layout for
std::type_info.  This allows libobjc2 to be built against libc++ and libcxxrt
and still provide working a unified exception model.

Note: This is broken on FreeBSD < 9.1, because it ships a libsupc++ with a
broken ABI.
14 years ago
theraven 66ee284bc7 Fix bug in unified exception model. 14 years ago
theraven 28b1db6f6e Make sure that -fPIC is specified for C++ files too. 15 years ago
theraven 73e1e2934b It turns out that Apple chose some confusing and non-intuitive semantics for
catching Objective-C objects in C++ catch statements (i.e. they follow
Objective-C semantics, not C++ semantics, irrespective of whether you use C++
or ObjC syntax).  We now default to Apple-compatible behaviour, but provide a
function that allows users to select the sane semantics if they prefer.

Added a capability bit for the unified exception model, so code can require it.
This is not really required, since any code using it will link against the
ObjC++ personality function and will get a linker failure if it isn't supported.

Also enabled Objective-C++ stuff by default.  This adds a dependency on the C++
standard library (actually on libsupc++, but GNUstep Make wants to link against
libstd++ anyway), which is not ideal.  It can be disabled with:

$ gmake objectiver-cxx=no

I suggest that this is only done by people who know that they will never want
Objective-C++ support.
15 years ago
theraven 6a2657ff6c Comment out a function that's only used for debugging. Not removed, because I'll probably break things and need it again... 15 years ago
theraven 3ccb4240cc Fix getting Objective-C objects out of C++ exceptions. 15 years ago
theraven e0719a9c62 Added Objective-C++ exception handling support. Allows throwing Objective-C objects with throw or @throw and catching them with catch() or @catch. 15 years ago