1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-06-02 09:22:36 +02:00

Be gcc compatible for C++ exceptions on 32 bit platforms.

This commit is contained in:
Stefan Demharter 2010-02-21 22:45:08 -08:00 committed by Arun Sharma
parent 5a1d3c6fd7
commit 752076789f
3 changed files with 11 additions and 9 deletions

View file

@ -26,6 +26,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#ifndef _UNWIND_H
#define _UNWIND_H
/* For uint64_t */
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -62,23 +65,22 @@ typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code,
struct _Unwind_Exception *);
typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) (int, _Unwind_Action,
unsigned long,
uint64_t,
struct _Unwind_Exception *,
struct _Unwind_Context *,
void *);
/* The C++ ABI requires exception_class, private_1, and private_2 to
be of type uint64 and the entire structure to be
double-word-aligned, but that seems a bit overly IA-64-specific.
Using "unsigned long" instead should give us the desired effect on
IA-64, while being more general. */
double-word-aligned. Please note that exception_class stays 64-bit
even on 32-bit machines for gcc compatibility. */
struct _Unwind_Exception
{
unsigned long exception_class;
uint64_t exception_class;
_Unwind_Exception_Cleanup_Fn exception_cleanup;
unsigned long private_1;
unsigned long private_2;
};
} __attribute__((__aligned__));
extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *);
extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *,

View file

@ -28,7 +28,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
PROTECTED _Unwind_Reason_Code
_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;
struct _Unwind_Context context;
_Unwind_Reason_Code reason;

View file

@ -38,7 +38,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#define _U_VERSION 1
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 {
@ -59,7 +59,7 @@ _Unwind_Phase2 (struct _Unwind_Exception *exception_object,
struct _Unwind_Context *context)
{
_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;
_Unwind_Personality_Fn personality;
_Unwind_Reason_Code reason;