gccint: Exception Handling

1 
1 18.9.2 Exception Handling Support
1 ---------------------------------
1 
1  -- Macro: EH_RETURN_DATA_REGNO (N)
1      A C expression whose value is the Nth register number used for data
1      by exception handlers, or 'INVALID_REGNUM' if fewer than N
1      registers are usable.
1 
1      The exception handling library routines communicate with the
1      exception handlers via a set of agreed upon registers.  Ideally
1      these registers should be call-clobbered; it is possible to use
1      call-saved registers, but may negatively impact code size.  The
1      target must support at least 2 data registers, but should define 4
1      if there are enough free registers.
1 
1      You must define this macro if you want to support call frame
1      exception handling like that provided by DWARF 2.
1 
1  -- Macro: EH_RETURN_STACKADJ_RTX
1      A C expression whose value is RTL representing a location in which
1      to store a stack adjustment to be applied before function return.
1      This is used to unwind the stack to an exception handler's call
1      frame.  It will be assigned zero on code paths that return
1      normally.
1 
1      Typically this is a call-clobbered hard register that is otherwise
1      untouched by the epilogue, but could also be a stack slot.
1 
1      Do not define this macro if the stack pointer is saved and restored
1      by the regular prolog and epilog code in the call frame itself; in
1      this case, the exception handling library routines will update the
1      stack location to be restored in place.  Otherwise, you must define
1      this macro if you want to support call frame exception handling
1      like that provided by DWARF 2.
1 
1  -- Macro: EH_RETURN_HANDLER_RTX
1      A C expression whose value is RTL representing a location in which
1      to store the address of an exception handler to which we should
1      return.  It will not be assigned on code paths that return
1      normally.
1 
1      Typically this is the location in the call frame at which the
1      normal return address is stored.  For targets that return by
1      popping an address off the stack, this might be a memory address
1      just below the _target_ call frame rather than inside the current
1      call frame.  If defined, 'EH_RETURN_STACKADJ_RTX' will have already
1      been assigned, so it may be used to calculate the location of the
1      target call frame.
1 
1      Some targets have more complex requirements than storing to an
1      address calculable during initial code generation.  In that case
1      the 'eh_return' instruction pattern should be used instead.
1 
1      If you want to support call frame exception handling, you must
1      define either this macro or the 'eh_return' instruction pattern.
1 
1  -- Macro: RETURN_ADDR_OFFSET
1      If defined, an integer-valued C expression for which rtl will be
1      generated to add it to the exception handler address before it is
1      searched in the exception handling tables, and to subtract it again
1      from the address before using it to return to the exception
1      handler.
1 
1  -- Macro: ASM_PREFERRED_EH_DATA_FORMAT (CODE, GLOBAL)
1      This macro chooses the encoding of pointers embedded in the
1      exception handling sections.  If at all possible, this should be
1      defined such that the exception handling section will not require
1      dynamic relocations, and so may be read-only.
1 
1      CODE is 0 for data, 1 for code labels, 2 for function pointers.
1      GLOBAL is true if the symbol may be affected by dynamic
1      relocations.  The macro should return a combination of the
1      'DW_EH_PE_*' defines as found in 'dwarf2.h'.
1 
1      If this macro is not defined, pointers will not be encoded but
1      represented directly.
1 
1  -- Macro: ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX (FILE, ENCODING, SIZE,
1           ADDR, DONE)
1      This macro allows the target to emit whatever special magic is
1      required to represent the encoding chosen by
1      'ASM_PREFERRED_EH_DATA_FORMAT'.  Generic code takes care of
1      pc-relative and indirect encodings; this must be defined if the
1      target uses text-relative or data-relative encodings.
1 
1      This is a C statement that branches to DONE if the format was
1      handled.  ENCODING is the format chosen, SIZE is the number of
1      bytes that the format occupies, ADDR is the 'SYMBOL_REF' to be
1      emitted.
1 
1  -- Macro: MD_FALLBACK_FRAME_STATE_FOR (CONTEXT, FS)
1      This macro allows the target to add CPU and operating system
1      specific code to the call-frame unwinder for use when there is no
1      unwind data available.  The most common reason to implement this
1      macro is to unwind through signal frames.
1 
1      This macro is called from 'uw_frame_state_for' in 'unwind-dw2.c',
1      'unwind-dw2-xtensa.c' and 'unwind-ia64.c'.  CONTEXT is an
1      '_Unwind_Context'; FS is an '_Unwind_FrameState'.  Examine
1      'context->ra' for the address of the code being executed and
1      'context->cfa' for the stack pointer value.  If the frame can be
1      decoded, the register save addresses should be updated in FS and
1      the macro should evaluate to '_URC_NO_REASON'.  If the frame cannot
1      be decoded, the macro should evaluate to '_URC_END_OF_STACK'.
1 
1      For proper signal handling in Java this macro is accompanied by
1      'MAKE_THROW_FRAME', defined in 'libjava/include/*-signal.h'
1      headers.
1 
1  -- Macro: MD_HANDLE_UNWABI (CONTEXT, FS)
1      This macro allows the target to add operating system specific code
1      to the call-frame unwinder to handle the IA-64 '.unwabi' unwinding
1      directive, usually used for signal or interrupt frames.
1 
1      This macro is called from 'uw_update_context' in libgcc's
1      'unwind-ia64.c'.  CONTEXT is an '_Unwind_Context'; FS is an
1      '_Unwind_FrameState'.  Examine 'fs->unwabi' for the abi and context
1      in the '.unwabi' directive.  If the '.unwabi' directive can be
1      handled, the register save addresses should be updated in FS.
1 
1  -- Macro: TARGET_USES_WEAK_UNWIND_INFO
1      A C expression that evaluates to true if the target requires unwind
1      info to be given comdat linkage.  Define it to be '1' if comdat
1      linkage is necessary.  The default is '0'.
1