mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2025-04-21 03:12:16 +02:00
Be gcc compatible for C++ exceptions on 32 bit platforms.
This commit is contained in:
parent
5a1d3c6fd7
commit
752076789f
3 changed files with 11 additions and 9 deletions
|
@ -26,6 +26,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
#ifndef _UNWIND_H
|
#ifndef _UNWIND_H
|
||||||
#define _UNWIND_H
|
#define _UNWIND_H
|
||||||
|
|
||||||
|
/* For uint64_t */
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@ -62,23 +65,22 @@ typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code,
|
||||||
struct _Unwind_Exception *);
|
struct _Unwind_Exception *);
|
||||||
|
|
||||||
typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) (int, _Unwind_Action,
|
typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) (int, _Unwind_Action,
|
||||||
unsigned long,
|
uint64_t,
|
||||||
struct _Unwind_Exception *,
|
struct _Unwind_Exception *,
|
||||||
struct _Unwind_Context *,
|
struct _Unwind_Context *,
|
||||||
void *);
|
void *);
|
||||||
|
|
||||||
/* The C++ ABI requires exception_class, private_1, and private_2 to
|
/* The C++ ABI requires exception_class, private_1, and private_2 to
|
||||||
be of type uint64 and the entire structure to be
|
be of type uint64 and the entire structure to be
|
||||||
double-word-aligned, but that seems a bit overly IA-64-specific.
|
double-word-aligned. Please note that exception_class stays 64-bit
|
||||||
Using "unsigned long" instead should give us the desired effect on
|
even on 32-bit machines for gcc compatibility. */
|
||||||
IA-64, while being more general. */
|
|
||||||
struct _Unwind_Exception
|
struct _Unwind_Exception
|
||||||
{
|
{
|
||||||
unsigned long exception_class;
|
uint64_t exception_class;
|
||||||
_Unwind_Exception_Cleanup_Fn exception_cleanup;
|
_Unwind_Exception_Cleanup_Fn exception_cleanup;
|
||||||
unsigned long private_1;
|
unsigned long private_1;
|
||||||
unsigned long private_2;
|
unsigned long private_2;
|
||||||
};
|
} __attribute__((__aligned__));
|
||||||
|
|
||||||
extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *);
|
extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *);
|
||||||
extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *,
|
extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *,
|
||||||
|
|
|
@ -28,7 +28,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
PROTECTED _Unwind_Reason_Code
|
PROTECTED _Unwind_Reason_Code
|
||||||
_Unwind_RaiseException (struct _Unwind_Exception *exception_object)
|
_Unwind_RaiseException (struct _Unwind_Exception *exception_object)
|
||||||
{
|
{
|
||||||
unsigned long exception_class = exception_object->exception_class;
|
uint64_t exception_class = exception_object->exception_class;
|
||||||
_Unwind_Personality_Fn personality;
|
_Unwind_Personality_Fn personality;
|
||||||
struct _Unwind_Context context;
|
struct _Unwind_Context context;
|
||||||
_Unwind_Reason_Code reason;
|
_Unwind_Reason_Code reason;
|
||||||
|
|
|
@ -38,7 +38,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
#define _U_VERSION 1
|
#define _U_VERSION 1
|
||||||
|
|
||||||
typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn)
|
typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn)
|
||||||
(int, _Unwind_Action, unsigned long, struct _Unwind_Exception *,
|
(int, _Unwind_Action, uint64_t, struct _Unwind_Exception *,
|
||||||
struct _Unwind_Context *);
|
struct _Unwind_Context *);
|
||||||
|
|
||||||
struct _Unwind_Context {
|
struct _Unwind_Context {
|
||||||
|
@ -59,7 +59,7 @@ _Unwind_Phase2 (struct _Unwind_Exception *exception_object,
|
||||||
struct _Unwind_Context *context)
|
struct _Unwind_Context *context)
|
||||||
{
|
{
|
||||||
_Unwind_Stop_Fn stop = (_Unwind_Stop_Fn) exception_object->private_1;
|
_Unwind_Stop_Fn stop = (_Unwind_Stop_Fn) exception_object->private_1;
|
||||||
unsigned long exception_class = exception_object->exception_class;
|
uint64_t exception_class = exception_object->exception_class;
|
||||||
void *stop_parameter = (void *) exception_object->private_2;
|
void *stop_parameter = (void *) exception_object->private_2;
|
||||||
_Unwind_Personality_Fn personality;
|
_Unwind_Personality_Fn personality;
|
||||||
_Unwind_Reason_Code reason;
|
_Unwind_Reason_Code reason;
|
||||||
|
|
Loading…
Add table
Reference in a new issue