This is the unwind specification draft for GNU/Linux/ia64 which extends the exception ABI:


The goal is to allow any ABI conforming shared unwind library to be used with output from any ABI compliant GNU/Linux compiler.


The GNU/Linux/ia64 extension of the "Level I. Base ABI" section in the exception ABI:


1.    An implementation of a shared unwind library shall place the unwind library in a DSO named or in auxiliary DSOs automatically loaded by it.

2.    A new unwind action:


      const _Unwind_Action _UA_END_OF_STACK = 16;


In order to allow _Unwind_ForcedUnwind to perform special processing when it reaches the end of the stack, the unwind runtime will call the stop function after the last frame is rejected, with the _UA_END_OF_STACK bit set.  The stop function may catch this condition by noticing that the _UA_END_OF_STACK bit is set.  The stop function may return _URC_END_OF_STACK if it cannot handle the end of stack condition.


3.    Additional functions:


a.    Use unwind data to perform a stack backtrace.  The trace callback is called for every stack frame in the call chain, but no cleanup actions are performed.


typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn)

(struct _Unwind_Context *, void *);


extern _Unwind_Reason_Code _Unwind_Backtrace (_Unwind_Trace_Fn, void *);

b.    Retrieve the CFA of the given context.

extern _Unwind_Word _Unwind_GetCFA (struct _Unwind_Context *);

c.    Resume propagation of an FORCE_UNWIND exception, or to rethrow a normal exception that was handled.  */

extern _Unwind_Reason_Code _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *);

d.    Given an address, return the entry point of the function that contains it.

extern void * _Unwind_FindEnclosingFunction (void *pc);

e.    Retrieve the Backing Store Pointer of the given context. Only for ia64.

extern _Unwind_Word _Unwind_GetBSP (struct _Unwind_Context *);

f.    Retrieve the base addresses for data-relative addressing in the LDSA. Only for non-ia64 platforms.

   extern _Unwind_Ptr _Unwind_GetDataRelBase (struct _Unwind_Context *);

g.    Retrieve the base addresses for text-relative addressing in the LDSA. Only for non-ia64 platforms.

   extern _Unwind_Ptr _Unwind_GetTextRelBase (struct _Unwind_Context *);

h.    Retrieve the object containing the address. Only for non-ia64 platforms.

extern const fde * _Unwind_Find_FDE (void *, struct dwarf_eh_bases *);


Other GNU/Linux platforms shall adopt the above specification if the platform ABI doesn't specify an alternate unwind mechanism.


Backward compatibility for the existing libgcc-based unwinder:


If there is an existing libgcc-based unwinder in gcc and an unwind library supports gcc, a set of compatibility symbols should be defined.


1.    __libunwind_Unwind_Backtrace: Alias of _Unwind_Backtrace

2.    __libunwind_Unwind_DeleteException: Alias of _Unwind_DeleteException

3.    __libunwind_Unwind_FindEnclosingFunction: Alias of _Unwind_FindEnclosingFunction

4.    __libunwind_Unwind_ForcedUnwind: Alias of _Unwind_ForcedUnwind

5.    __libunwind_Unwind_GetCFA: Alias of _Unwind_GetCFA

6.    __libunwind_Unwind_GetGR: Alias of _Unwind_GetGR

7.    __libunwind_Unwind_GetIP: Alias of _Unwind_GetIP

8.    __libunwind_Unwind_GetLanguageSpecificData: Alias of _Unwind_GetLanguageSpecificData

9.    __libunwind_Unwind_GetRegionStart: Alias of _Unwind_GetRegionStart

10.__libunwind_Unwind_RaiseException: Alias of _Unwind_RaiseException

11.__libunwind_Unwind_Resume: Alias of _Unwind_Resume

12.__libunwind_Unwind_Resume_or_Rethrow: Alias of _Unwind_Resume_or_Rethrow

13.__libunwind_Unwind_SetGR: Alias of _Unwind_SetGR

14.__libunwind_Unwind_SetIP: Alias of _Unwind_SetIP

15.__libunwind_Unwind_GetBSP: Alias of _Unwind_GetBSP. Only for ia64.

16.__libunwind_Unwind_GetDataRelBase: Alias of _Unwind_GetDataRelBase. Only for non-ia64 platforms.

17.__libunwind_Unwind_GetTextRelBase: Alias of _Unwind_GetTextRelBase. Only for non-ia64 platforms.

18.__libunwind_Unwind_Find_FDE: Alias of _Unwind_Find_FDE. Only for non-ia64 platforms.


Those symbols can be used by the new libgcc to provide the backward binary compatibility.