This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: IA64 HP-UX Unwind patch


> Anyway, it's not worth adding macros for this.  Instead, modify
> the two places to expect *both* _URC_FOREIGN_EXCEPTION_CAUGHT
> and _URC_NO_REASON, with a comment about the different behaviour
> of the hpux library.

Actually the modification would only be needed in one place, 
in eh_throw.cc (__gxx_exception_cleanup) so that should be
simple to do.

> > The second problem is with _Unwind_SetIP.  Even in ILP32 mode, the HP-UX
> > Unwind library expects you to pass in a 64 bit pointer on IA64.  So, I
> > created a macro in os_defines.h called UNWIND_SETIP to use instead of
> > calling _Unwind_SetIP if it is defined.  I also ifdef'ed the
> > _Unwind_SetIP declaration in unwind.h so I could have my own version in
> > os_defines.h with different arg types.
> 
> Good lord.
> 
> How does the function call ABI work?  If we changed the prototype
> to a void* would it work?  I really dislike this part of the patch.

I am not sure what you mean by "How does the function call ABI work?"
so I don't know how to answer that.  Just changing the prototype by
itself is not enough since we also need to explicitly extend the pointer
with the addp4 (extend_ptr) instruction.  In HP C++, in ILP32 mode, they
take advantage of the fact that _Unwind_GetIP still returns 64 bits and
they save all 64 bits in the LSDA and then pass it back in to
_Unwind_GetIP as a 64 bit address.

For GCC to use the HP Unwind library there seem to be two options;
change GCC/libstdc++ to save all 64 bits that it gets from _Unwind_GetIP
and store it as 64 bits in the LSDA and pass it back into _Unwind_SetIP
as 64 bits or get and save only 32 bits and then extend it before
calling _Unwind_SetIP.  Just changing the _Unwind_SetIP call seemed like
a less intrusive (if still ugly) change.

I did it the other way for a time by defining _Unwind_Ptr to be 64 bits
in unwind.h when on IA64 in ILP32 mode.  I think there were some issues
with some of the casts in eh_personality.cc but other then that it
seemed to work.

Do you think that change (changing the typedef of _Unwind_Ptr) would be
cleaner then doing the extend_ptr on the _Unwind_SetIP call?

> > + extern void _Unwind_SetIP (struct _Unwind_Context *, unsigned __attribute__((__mode__(__word__))));
> 
> In any case, this is _Unwind_Word.

Yes, I did it this way so that libstdc++-v3/config/os/hpux/os_defines.h
wouldn't have to include unwind.h.  I could change os_defines.h to
include unwind.h or just put the declaration in unwind.h.

Steve Ellcey
sje@cup.hp.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]