[AArch64][2/4] Generate dwarf information for -msign-return-address
gcc/ * reg-notes.def (CFA_TOGGLE_RA_MANGLE): New reg-note. * combine-stack-adj.c (no_unhandled_cfa): Handle REG_CFA_TOGGLE_RA_MANGLE. * dwarf2cfi.c (dwarf2out_frame_debug): Handle REG_CFA_TOGGLE_RA_MANGLE. * config/aarch64/aarch64.c (aarch64_expand_prologue): Generates DWARF info for return address signing. (aarch64_expand_epilogue): Likewise. From-SVN: r244667
This commit is contained in:
parent
db58fd8954
commit
27169e45d4
|
@ -1,3 +1,13 @@
|
||||||
|
2017-01-19 Jiong Wang <jiong.wang@arm.com>
|
||||||
|
|
||||||
|
* reg-notes.def (CFA_TOGGLE_RA_MANGLE): New reg-note.
|
||||||
|
* combine-stack-adj.c (no_unhandled_cfa): Handle
|
||||||
|
REG_CFA_TOGGLE_RA_MANGLE.
|
||||||
|
* dwarf2cfi.c (dwarf2out_frame_debug): Handle REG_CFA_TOGGLE_RA_MANGLE.
|
||||||
|
* config/aarch64/aarch64.c (aarch64_expand_prologue): Generates DWARF
|
||||||
|
info for return address signing.
|
||||||
|
(aarch64_expand_epilogue): Likewise.
|
||||||
|
|
||||||
2017-01-19 Jiong Wang <jiong.wang@arm.com>
|
2017-01-19 Jiong Wang <jiong.wang@arm.com>
|
||||||
|
|
||||||
* config/aarch64/aarch64-opts.h (aarch64_function_type): New enum.
|
* config/aarch64/aarch64-opts.h (aarch64_function_type): New enum.
|
||||||
|
|
|
@ -208,6 +208,7 @@ no_unhandled_cfa (rtx_insn *insn)
|
||||||
case REG_CFA_SET_VDRAP:
|
case REG_CFA_SET_VDRAP:
|
||||||
case REG_CFA_WINDOW_SAVE:
|
case REG_CFA_WINDOW_SAVE:
|
||||||
case REG_CFA_FLUSH_QUEUE:
|
case REG_CFA_FLUSH_QUEUE:
|
||||||
|
case REG_CFA_TOGGLE_RA_MANGLE:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3559,7 +3559,11 @@ aarch64_expand_prologue (void)
|
||||||
|
|
||||||
/* Sign return address for functions. */
|
/* Sign return address for functions. */
|
||||||
if (aarch64_return_address_signing_enabled ())
|
if (aarch64_return_address_signing_enabled ())
|
||||||
emit_insn (gen_pacisp ());
|
{
|
||||||
|
insn = emit_insn (gen_pacisp ());
|
||||||
|
add_reg_note (insn, REG_CFA_TOGGLE_RA_MANGLE, const0_rtx);
|
||||||
|
RTX_FRAME_RELATED_P (insn) = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (flag_stack_usage_info)
|
if (flag_stack_usage_info)
|
||||||
current_function_static_stack_size = frame_size;
|
current_function_static_stack_size = frame_size;
|
||||||
|
@ -3714,7 +3718,11 @@ aarch64_expand_epilogue (bool for_sibcall)
|
||||||
*/
|
*/
|
||||||
if (aarch64_return_address_signing_enabled ()
|
if (aarch64_return_address_signing_enabled ()
|
||||||
&& (for_sibcall || !TARGET_ARMV8_3 || crtl->calls_eh_return))
|
&& (for_sibcall || !TARGET_ARMV8_3 || crtl->calls_eh_return))
|
||||||
emit_insn (gen_autisp ());
|
{
|
||||||
|
insn = emit_insn (gen_autisp ());
|
||||||
|
add_reg_note (insn, REG_CFA_TOGGLE_RA_MANGLE, const0_rtx);
|
||||||
|
RTX_FRAME_RELATED_P (insn) = 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Stack adjustment for exception handler. */
|
/* Stack adjustment for exception handler. */
|
||||||
if (crtl->calls_eh_return)
|
if (crtl->calls_eh_return)
|
||||||
|
|
|
@ -2098,7 +2098,9 @@ dwarf2out_frame_debug (rtx_insn *insn)
|
||||||
handled_one = true;
|
handled_one = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case REG_CFA_TOGGLE_RA_MANGLE:
|
||||||
case REG_CFA_WINDOW_SAVE:
|
case REG_CFA_WINDOW_SAVE:
|
||||||
|
/* We overload both of these operations onto the same DWARF opcode. */
|
||||||
dwarf2out_frame_debug_cfa_window_save ();
|
dwarf2out_frame_debug_cfa_window_save ();
|
||||||
handled_one = true;
|
handled_one = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -177,6 +177,11 @@ REG_NOTE (CFA_WINDOW_SAVE)
|
||||||
the rest of the compiler as a CALL_INSN. */
|
the rest of the compiler as a CALL_INSN. */
|
||||||
REG_NOTE (CFA_FLUSH_QUEUE)
|
REG_NOTE (CFA_FLUSH_QUEUE)
|
||||||
|
|
||||||
|
/* Attached to insns that are RTX_FRAME_RELATED_P, toggling the mangling status
|
||||||
|
of return address. Currently it's only used by AArch64. The argument is
|
||||||
|
ignored. */
|
||||||
|
REG_NOTE (CFA_TOGGLE_RA_MANGLE)
|
||||||
|
|
||||||
/* Indicates what exception region an INSN belongs in. This is used
|
/* Indicates what exception region an INSN belongs in. This is used
|
||||||
to indicate what region to which a call may throw. REGION 0
|
to indicate what region to which a call may throw. REGION 0
|
||||||
indicates that a call cannot throw at all. REGION -1 indicates
|
indicates that a call cannot throw at all. REGION -1 indicates
|
||||||
|
|
Loading…
Reference in New Issue