summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMatt Fleming <matt@console-pimps.org>2009-08-16 02:44:33 +0200
committerMatt Fleming <matt@console-pimps.org>2009-08-16 13:48:53 +0200
commitcd7246f0e2747bd2b43d25d0f63f05db182a62c0 (patch)
tree729c855c6e17a35b8467161baeeb6431765cf372 /arch
parentsh: Try again at getting the initial return address for an unwind (diff)
downloadlinux-cd7246f0e2747bd2b43d25d0f63f05db182a62c0.tar.xz
linux-cd7246f0e2747bd2b43d25d0f63f05db182a62c0.zip
sh: Add support for DWARF GNU extensions
Also, remove the "fix" to DW_CFA_def_cfa_register where we reset the frame's cfa_offset to 0. This action is incorrect when handling DW_CFA_def_cfa_register as the DWARF spec specifically states that the previous contents of cfa_offset should be used with the new register. The reason that I thought cfa_offset should be reset to 0 was because it was being assigned a bogus value prior to executing the DW_CFA_def_cfa_register op. It turns out that the bogus cfa_offset value came from interpreting .cfi_escape pseudo-ops (those used by the GNU extensions) as CFA_DW_def_cfa ops. Signed-off-by: Matt Fleming <matt@console-pimps.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/sh/include/asm/dwarf.h4
-rw-r--r--arch/sh/kernel/dwarf.c14
2 files changed, 17 insertions, 1 deletions
diff --git a/arch/sh/include/asm/dwarf.h b/arch/sh/include/asm/dwarf.h
index 60b180728d8d..d3d3837c5e1b 100644
--- a/arch/sh/include/asm/dwarf.h
+++ b/arch/sh/include/asm/dwarf.h
@@ -340,6 +340,10 @@ struct dwarf_stack {
#define DW_CFA_lo_user 0x1c
#define DW_CFA_hi_user 0x3f
+/* GNU extension opcodes */
+#define DW_CFA_GNU_args_size 0x2e
+#define DW_CFA_GNU_negative_offset_extended 0x2f
+
/*
* Some call frame instructions encode their operands in the opcode. We
* need some helper functions to extract both the opcode and operands
diff --git a/arch/sh/kernel/dwarf.c b/arch/sh/kernel/dwarf.c
index 44e674ed2871..5fd6e604816d 100644
--- a/arch/sh/kernel/dwarf.c
+++ b/arch/sh/kernel/dwarf.c
@@ -429,7 +429,6 @@ static int dwarf_cfa_execute_insns(unsigned char *insn_start,
count = dwarf_read_uleb128(current_insn,
&frame->cfa_register);
current_insn += count;
- frame->cfa_offset = 0;
frame->flags |= DWARF_FRAME_CFA_REG_OFFSET;
break;
case DW_CFA_def_cfa_offset:
@@ -465,6 +464,19 @@ static int dwarf_cfa_execute_insns(unsigned char *insn_start,
frame->regs[reg].flags |= DWARF_REG_OFFSET;
frame->regs[reg].addr = offset;
break;
+ case DW_CFA_GNU_args_size:
+ count = dwarf_read_uleb128(current_insn, &offset);
+ current_insn += count;
+ break;
+ case DW_CFA_GNU_negative_offset_extended:
+ count = dwarf_read_uleb128(current_insn, &reg);
+ current_insn += count;
+ count = dwarf_read_uleb128(current_insn, &offset);
+ offset *= cie->data_alignment_factor;
+ dwarf_frame_alloc_regs(frame, reg);
+ frame->regs[reg].flags |= DWARF_REG_OFFSET;
+ frame->regs[reg].addr = -offset;
+ break;
default:
pr_debug("unhandled DWARF instruction 0x%x\n", insn);
break;