aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJiong Wang <jiong.wang@arm.com>2017-01-20 00:05:30 +0000
committerJiong Wang <jiwang@gcc.gnu.org>2017-01-20 00:05:30 +0000
commit27169e45d4c16032c2fdee7b89883a1ca62b2b93 (patch)
tree973ab061acd52a557d12c128f6752e9cf448da42 /gcc
parentdb58fd8954f5dfd868dbed110f2c8a04bb4b0753 (diff)
downloadgcc-27169e45d4c16032c2fdee7b89883a1ca62b2b93.zip
gcc-27169e45d4c16032c2fdee7b89883a1ca62b2b93.tar.gz
gcc-27169e45d4c16032c2fdee7b89883a1ca62b2b93.tar.bz2
[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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/combine-stack-adj.c1
-rw-r--r--gcc/config/aarch64/aarch64.c12
-rw-r--r--gcc/dwarf2cfi.c2
-rw-r--r--gcc/reg-notes.def5
5 files changed, 28 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1f959bb..2abfea0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,15 @@
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>
+
* config/aarch64/aarch64-opts.h (aarch64_function_type): New enum.
* config/aarch64/aarch64-protos.h
(aarch64_return_address_signing_enabled): New declaration.
diff --git a/gcc/combine-stack-adj.c b/gcc/combine-stack-adj.c
index 20cd59a..9ec14a3 100644
--- a/gcc/combine-stack-adj.c
+++ b/gcc/combine-stack-adj.c
@@ -208,6 +208,7 @@ no_unhandled_cfa (rtx_insn *insn)
case REG_CFA_SET_VDRAP:
case REG_CFA_WINDOW_SAVE:
case REG_CFA_FLUSH_QUEUE:
+ case REG_CFA_TOGGLE_RA_MANGLE:
return false;
}
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 62baf58..c3992d8 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -3559,7 +3559,11 @@ aarch64_expand_prologue (void)
/* Sign return address for functions. */
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)
current_function_static_stack_size = frame_size;
@@ -3714,7 +3718,11 @@ aarch64_expand_epilogue (bool for_sibcall)
*/
if (aarch64_return_address_signing_enabled ()
&& (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. */
if (crtl->calls_eh_return)
diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
index 2748e2f..2a527c9 100644
--- a/gcc/dwarf2cfi.c
+++ b/gcc/dwarf2cfi.c
@@ -2098,7 +2098,9 @@ dwarf2out_frame_debug (rtx_insn *insn)
handled_one = true;
break;
+ case REG_CFA_TOGGLE_RA_MANGLE:
case REG_CFA_WINDOW_SAVE:
+ /* We overload both of these operations onto the same DWARF opcode. */
dwarf2out_frame_debug_cfa_window_save ();
handled_one = true;
break;
diff --git a/gcc/reg-notes.def b/gcc/reg-notes.def
index ead4a9f..175da11 100644
--- a/gcc/reg-notes.def
+++ b/gcc/reg-notes.def
@@ -177,6 +177,11 @@ REG_NOTE (CFA_WINDOW_SAVE)
the rest of the compiler as a CALL_INSN. */
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
to indicate what region to which a call may throw. REGION 0
indicates that a call cannot throw at all. REGION -1 indicates