aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2cfi.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-01-19 23:36:04 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2018-01-19 23:36:04 +0100
commit26fc730dd2b04a718f12ea5ba0aa7a8737cc513e (patch)
treeb019a9e56d4c261f73f4aa06dd53814e5ca5c265 /gcc/dwarf2cfi.c
parente6f97c3feec266355a80cdcb68a5885748454c39 (diff)
downloadgcc-26fc730dd2b04a718f12ea5ba0aa7a8737cc513e.zip
gcc-26fc730dd2b04a718f12ea5ba0aa7a8737cc513e.tar.gz
gcc-26fc730dd2b04a718f12ea5ba0aa7a8737cc513e.tar.bz2
re PR debug/81570 (create_pseudo_cfg assumes that INCOMING_FRAME_SP_OFFSET is a constant)
PR debug/81570 PR debug/83728 * dwarf2cfi.c (DEFAULT_INCOMING_FRAME_SP_OFFSET): Define to INCOMING_FRAME_SP_OFFSET if not defined. (scan_trace): Add ENTRY argument. If true and DEFAULT_INCOMING_FRAME_SP_OFFSET != INCOMING_FRAME_SP_OFFSET, emit a note to adjust the CFA offset. (create_cfi_notes): Adjust scan_trace callers. (create_cie_data): Use DEFAULT_INCOMING_FRAME_SP_OFFSET rather than INCOMING_FRAME_SP_OFFSET in the CIE. * config/i386/i386.h (DEFAULT_INCOMING_FRAME_SP_OFFSET): Define. * config/stormy16/stormy16.h (DEFAULT_INCOMING_FRAME_SP_OFFSET): Likewise. * doc/tm.texi.in (DEFAULT_INCOMING_FRAME_SP_OFFSET): Document. * doc/tm.texi: Regenerated. From-SVN: r256904
Diffstat (limited to 'gcc/dwarf2cfi.c')
-rw-r--r--gcc/dwarf2cfi.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
index 3ae5b8e..07e6a5a 100644
--- a/gcc/dwarf2cfi.c
+++ b/gcc/dwarf2cfi.c
@@ -52,6 +52,10 @@ along with GCC; see the file COPYING3. If not see
#ifndef INCOMING_RETURN_ADDR_RTX
#define INCOMING_RETURN_ADDR_RTX (gcc_unreachable (), NULL_RTX)
#endif
+
+#ifndef DEFAULT_INCOMING_FRAME_SP_OFFSET
+#define DEFAULT_INCOMING_FRAME_SP_OFFSET INCOMING_FRAME_SP_OFFSET
+#endif
/* A collected description of an entire row of the abstract CFI table. */
struct GTY(()) dw_cfi_row
@@ -2484,7 +2488,7 @@ scan_insn_after (rtx_insn *insn)
instructions therein. */
static void
-scan_trace (dw_trace_info *trace)
+scan_trace (dw_trace_info *trace, bool entry)
{
rtx_insn *prev, *insn = trace->head;
dw_cfa_location this_cfa;
@@ -2503,6 +2507,17 @@ scan_trace (dw_trace_info *trace)
this_cfa = cur_row->cfa;
cur_cfa = &this_cfa;
+ /* If the current function starts with a non-standard incoming frame
+ sp offset, emit a note before the first instruction. */
+ if (entry
+ && DEFAULT_INCOMING_FRAME_SP_OFFSET != INCOMING_FRAME_SP_OFFSET)
+ {
+ add_cfi_insn = insn;
+ gcc_assert (NOTE_P (insn) && NOTE_KIND (insn) == NOTE_INSN_DELETED);
+ this_cfa.offset = INCOMING_FRAME_SP_OFFSET;
+ def_cfa_1 (&this_cfa);
+ }
+
for (prev = insn, insn = NEXT_INSN (insn);
insn;
prev = insn, insn = NEXT_INSN (insn))
@@ -2671,12 +2686,12 @@ create_cfi_notes (void)
/* Always begin at the entry trace. */
ti = &trace_info[0];
- scan_trace (ti);
+ scan_trace (ti, true);
while (!trace_work_list.is_empty ())
{
ti = trace_work_list.pop ();
- scan_trace (ti);
+ scan_trace (ti, false);
}
queued_reg_saves.release ();
@@ -2980,7 +2995,12 @@ create_cie_data (void)
/* On entry, the Canonical Frame Address is at SP. */
memset (&loc, 0, sizeof (loc));
loc.reg = dw_stack_pointer_regnum;
- loc.offset = INCOMING_FRAME_SP_OFFSET;
+ /* create_cie_data is called just once per TU, and when using .cfi_startproc
+ is even done by the assembler rather than the compiler. If the target
+ has different incoming frame sp offsets depending on what kind of
+ function it is, use a single constant offset for the target and
+ if needed, adjust before the first instruction in insn stream. */
+ loc.offset = DEFAULT_INCOMING_FRAME_SP_OFFSET;
def_cfa_1 (&loc);
if (targetm.debug_unwind_info () == UI_DWARF2