Movatterモバイル変換


[0]ホーム

URL:


Next:, Previous:, Up:Stack Layout and Calling Conventions   [Contents][Index]


17.9.2 Exception Handling Support

Macro:EH_RETURN_DATA_REGNO(N)

A C expression whose value is theNth register number used fordata by exception handlers, orINVALID_REGNUM if fewer thanN registers are usable.

The exception handling library routines communicate with the exceptionhandlers via a set of agreed upon registers. Ideally these registersshould be call-clobbered; it is possible to use call-saved registers,but may negatively impact code size. The target must support at least2 data registers, but should define 4 if there are enough free registers.

You must define this macro if you want to support call frame exceptionhandling like that provided by DWARF 2.

Macro:EH_RETURN_STACKADJ_RTX

A C expression whose value is RTL representing a location in whichto store a stack adjustment to be applied before function return.This is used to unwind the stack to an exception handler’s call frame.It will be assigned zero on code paths that return normally.

Typically this is a call-clobbered hard register that is otherwiseuntouched by the epilogue, but could also be a stack slot.

Do not define this macro if the stack pointer is saved and restoredby the regular prolog and epilog code in the call frame itself; inthis case, the exception handling library routines will update thestack location to be restored in place. Otherwise, you must definethis macro if you want to support call frame exception handling likethat provided by DWARF 2.

Macro:EH_RETURN_HANDLER_RTX

A C expression whose value is RTL representing a location in whichto store the address of an exception handler to which we shouldreturn. It will not be assigned on code paths that return normally.

Typically this is the location in the call frame at which the normalreturn address is stored. For targets that return by popping anaddress off the stack, this might be a memory address just belowthetarget call frame rather than inside the current callframe. If defined,EH_RETURN_STACKADJ_RTX will have alreadybeen assigned, so it may be used to calculate the location of thetarget call frame.

Some targets have more complex requirements than storing to anaddress calculable during initial code generation. In that casetheeh_return instruction pattern should be used instead.

If you want to support call frame exception handling, you mustdefine either this macro or theeh_return instruction pattern.

Macro:EH_RETURN_TAKEN_RTX

A C expression whose value is RTL representing a location in whichto store if the EH return path was taken instead of a normal return.This macro allows conditionally executing different code in theepilogue for the EH and normal return cases.

When this macro is defined, the macrosEH_RETURN_STACKADJ_RTXandEH_RETURN_HANDLER_RTX are only meaningful in the epiloguewhen 1 is stored to the specified location. The value 0 means normalreturn.

Macro:RETURN_ADDR_OFFSET

If defined, an integer-valued C expression for which rtl will be generatedto add it to the exception handler address before it is searched in theexception handling tables, and to subtract it again from the address beforeusing it to return to the exception handler.

Macro:ASM_PREFERRED_EH_DATA_FORMAT(code,global)

This macro chooses the encoding of pointers embedded in the exceptionhandling sections. If at all possible, this should be defined suchthat the exception handling section will not require dynamic relocations,and so may be read-only.

code is 0 for data, 1 for code labels, 2 for function pointers.global is true if the symbol may be affected by dynamic relocations.The macro should return a combination of theDW_EH_PE_* definesas found indwarf2.h.

If this macro is not defined, pointers will not be encoded butrepresented directly.

Macro:ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(file,encoding,size,addr,done)

This macro allows the target to emit whatever special magic is requiredto represent the encoding chosen byASM_PREFERRED_EH_DATA_FORMAT.Generic code takes care of pc-relative and indirect encodings; this mustbe defined if the target uses text-relative or data-relative encodings.

This is a C statement that branches todone if the format washandled.encoding is the format chosen,size is the numberof bytes that the format occupies,addr is theSYMBOL_REFto be emitted.

Macro:MD_FALLBACK_FRAME_STATE_FOR(context,fs)

This macro allows the target to add CPU and operating system specificcode to the call-frame unwinder for use when there is no unwind dataavailable. The most common reason to implement this macro is to unwindthrough signal frames.

This macro is called fromuw_frame_state_for inunwind-dw2.c,unwind-dw2-xtensa.c andunwind-ia64.c.context is an_Unwind_Context;fs is an_Unwind_FrameState. Examinecontext->rafor the address of the code being executed andcontext->cfa forthe stack pointer value. If the frame can be decoded, the registersave addresses should be updated infs and the macro shouldevaluate to_URC_NO_REASON. If the frame cannot be decoded,the macro should evaluate to_URC_END_OF_STACK.

For proper signal handling in Java this macro is accompanied byMAKE_THROW_FRAME, defined inlibjava/include/*-signal.h headers.

Macro:MD_HANDLE_UNWABI(context,fs)

This macro allows the target to add operating system specific code to thecall-frame unwinder to handle the IA-64.unwabi unwinding directive,usually used for signal or interrupt frames.

This macro is called fromuw_update_context in libgcc’sunwind-ia64.c.context is an_Unwind_Context;fs is an_Unwind_FrameState. Examinefs->unwabifor the abi and context in the.unwabi directive. If the.unwabi directive can be handled, the register save addresses shouldbe updated infs.

Macro:TARGET_USES_WEAK_UNWIND_INFO

A C expression that evaluates to true if the target requires unwindinfo to be given comdat linkage. Define it to be1 if comdatlinkage is necessary. The default is0.


Next:Specifying How Stack Checking is Done, Previous:Basic Stack Layout, Up:Stack Layout and Calling Conventions   [Contents][Index]


[8]ページ先頭

©2009-2026 Movatter.jp