This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
IA-64 unwind handler cleanup
- To: gcc-patches at gcc dot gnu dot org
- Subject: IA-64 unwind handler cleanup
- From: Jim Wilson <wilson at cygnus dot com>
- Date: Wed, 23 Aug 2000 13:58:46 -0700
I noticed this while fixing a problem with gas's handling of the EHANDLER and
UHANDLER bits. Gcc wasn't using the bits to identify whether a personality
routine was present. This doesn't fix any known bugs, but makes it more
likely that the IA-64 unwinding code will work for non-g++ compiled code.
2000-08-23 Jim Wilson <wilson@cygnus.com>
* frame.h (IA64_UNW_EHANDLER, IA64_UNW_UHANDLER): New.
* config/ia64/frame-ia64.c (__get_personality): Return zero if neither
EHANDLER nor UHANDLER bit is set.
(__get_except_table): Likewise.
Index: frame.h
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/frame.h,v
retrieving revision 1.16.10.1
diff -p -r1.16.10.1 frame.h
*** frame.h 2000/08/08 09:09:56 1.16.10.1
--- frame.h 2000/08/23 20:41:56
*************** typedef struct unwind_info_ptr
*** 267,272 ****
--- 267,276 ----
#define IA64_UNW_HDR_FLAGS(x) (((x) >> 32) & 0xffffUL)
#define IA64_UNW_HDR_VERSION(x) (((x) >> 48) & 0xffffUL)
+ /* Header flag bits, after extraction by IA64_UNW_HDR_FLAGS. */
+ #define IA64_UNW_EHANDLER 0x1
+ #define IA64_UNW_UHANDLER 0x2
+
extern unwind_info_ptr *__build_ia64_frame_state (unsigned char *,
ia64_frame_state *,
void *, void *,
Index: config/ia64/frame-ia64.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/config/ia64/frame-ia64.c,v
retrieving revision 1.4.10.1
diff -p -r1.4.10.1 frame-ia64.c
*** frame-ia64.c 2000/08/08 09:09:57 1.4.10.1
--- frame-ia64.c 2000/08/23 20:41:56
*************** __build_ia64_frame_state (pc, frame, bsp
*** 1376,1402 ****
return unw_info_ptr;
}
! /* Given an unwind info pointer, return the personailty routine. */
void *
__get_personality (ptr)
unwind_info_ptr *ptr;
{
void **p;
p = (void **) (ptr->unwind_descriptors
+ IA64_UNW_HDR_LENGTH (ptr->header) * 8);
return *p;
}
void *
__get_except_table (ptr)
unwind_info_ptr *ptr;
{
! void **p, *table;
! p = (void **) (ptr->unwind_descriptors
! + IA64_UNW_HDR_LENGTH (ptr->header) * 8);
! /* If there is no personality, there is no handler data. */
! if (*p == 0)
return 0;
table = (void *) (ptr->unwind_descriptors
+ IA64_UNW_HDR_LENGTH (ptr->header) * 8 + 8);
return table;
--- 1376,1413 ----
return unw_info_ptr;
}
! /* Given an unwind info pointer, return the personality routine. */
void *
__get_personality (ptr)
unwind_info_ptr *ptr;
{
void **p;
+
+ /* There is a personality routine only if one of the EHANDLER or UHANDLER
+ bits is set. */
+ if (! (IA64_UNW_HDR_FLAGS (ptr->header)
+ & (IA64_UNW_EHANDLER|IA64_UNW_UHANDLER)))
+ return 0;
+
p = (void **) (ptr->unwind_descriptors
+ IA64_UNW_HDR_LENGTH (ptr->header) * 8);
return *p;
}
+ /* Given an unwind info pointer, return the exception table. */
void *
__get_except_table (ptr)
unwind_info_ptr *ptr;
{
! void *table;
!
! /* If there is no personality, there is no handler data.
! There is a personality routine only if one of the EHANDLER or UHANDLER
! bits is set. */
! if (! (IA64_UNW_HDR_FLAGS (ptr->header)
! & (IA64_UNW_EHANDLER|IA64_UNW_UHANDLER)))
return 0;
+
table = (void *) (ptr->unwind_descriptors
+ IA64_UNW_HDR_LENGTH (ptr->header) * 8 + 8);
return table;