+2003-08-08 Andreas Schwab <schwab@suse.de>
+
+ * config/tc-m68k.h (TARGET_USE_CFIPOP)
+ (DWARF2_DEFAULT_RETURN_COLUMN, DWARF2_CIE_DATA_ALIGNMENT)
+ (tc_regname_to_dw2regnum, tc_cfi_frame_initial_instructions):
+ Define.
+ * config/tc-m68k.c: Include "dw2gencfi.h".
+ (tc_m68k_regname_to_dw2regnum)
+ (tc_m68k_frame_initial_instructions): New functions.
+
2003-08-08 Dmitry Diky <diwil@mail.ru>
* config/tc-msp430.c: Add xW42 and xE42 parts. Sort MPU list
/* tc-m68k.c -- Assemble for the m68k family
Copyright 1987, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002
+ 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
#include "obstack.h"
#include "subsegs.h"
#include "dwarf2dbg.h"
+#include "dw2gencfi.h"
#include "opcode/m68k.h"
#include "m68k-parse.h"
elf_elfheader (stdoutput)->e_flags |= EF_M68000;
}
#endif
+
+int
+tc_m68k_regname_to_dw2regnum (const char *regname)
+{
+ unsigned int regnum;
+ static const char *const regnames[] =
+ {
+ "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
+ "a0", "a1", "a2", "a3", "a4", "a5", "a6", "sp",
+ "fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7",
+ "pc"
+ };
+
+ for (regnum = 0; regnum < ARRAY_SIZE (regnames); regnum++)
+ if (strcmp (regname, regnames[regnum]) == 0)
+ return regnum;
+
+ return -1;
+}
+
+void
+tc_m68k_frame_initial_instructions (void)
+{
+ static int sp_regno = -1;
+
+ if (sp_regno < 0)
+ sp_regno = tc_m68k_regname_to_dw2regnum ("sp");
+
+ cfi_add_CFA_def_cfa (sp_regno, -DWARF2_CIE_DATA_ALIGNMENT);
+ cfi_add_CFA_offset (DWARF2_DEFAULT_RETURN_COLUMN, DWARF2_CIE_DATA_ALIGNMENT);
+}
while (0)
#define DWARF2_LINE_MIN_INSN_LENGTH 2
+
+/* We want .cfi_* pseudo-ops for generating unwind info. */
+#define TARGET_USE_CFIPOP 1
+
+#define DWARF2_DEFAULT_RETURN_COLUMN 24
+#define DWARF2_CIE_DATA_ALIGNMENT (-4)
+
+#define tc_regname_to_dw2regnum tc_m68k_regname_to_dw2regnum
+extern int tc_m68k_regname_to_dw2regnum (const char *regname);
+
+#define tc_cfi_frame_initial_instructions tc_m68k_frame_initial_instructions
+extern void tc_m68k_frame_initial_instructions (void);
+2003-08-08 Andreas Schwab <schwab@suse.de>
+
+ * gas/cfi/cfi-m68k.s, gas/cfi/cfi-m68k.d: New test.
+ * gas/cfi/cfi.exp (run_list_test): Run it.
+
2003-08-06 Jason Eckhardt <jle@rice.edu>
* gas/i860/dir-align01.{s,d}: New files.
--- /dev/null
+#readelf: -wf
+#name: CFI on m68k
+The section .eh_frame contains:
+
+00000000 00000012 00000000 CIE
+ Version: 1
+ Augmentation: "zR"
+ Code alignment factor: 2
+ Data alignment factor: -4
+ Return address column: 24
+ Augmentation data: 1b
+
+ DW_CFA_def_cfa: r15 ofs 4
+ DW_CFA_offset: r24 at cfa-4
+
+00000016 00000014 0000001a FDE cie=00000000 pc=0000001e..0000002a
+ DW_CFA_advance_loc: 4 to 00000022
+ DW_CFA_def_cfa_offset: 4664
+ DW_CFA_advance_loc: 6 to 00000028
+ DW_CFA_def_cfa_offset: 4
+
+0000002e 00000017 00000032 FDE cie=00000000 pc=00000036..00000042
+ DW_CFA_advance_loc: 4 to 0000003a
+ DW_CFA_def_cfa_offset: 8
+ DW_CFA_offset: r14 at cfa-8
+ DW_CFA_def_cfa_reg: r14
+ DW_CFA_advance_loc: 6 to 00000040
+ DW_CFA_def_cfa_reg: r15
+
+00000049 0000000f 0000004d FDE cie=00000000 pc=00000051..00000055
+
+ DW_CFA_nop
+ DW_CFA_nop
--- /dev/null
+#; $ as -o test.o gas-cfi-test.s && gcc -nostdlib -o test test.o
+
+ .text
+
+#; func_locvars
+#; - function with a space on the stack
+#; allocated for local variables
+
+ .type func_locvars,@function
+func_locvars:
+ .cfi_startproc
+
+ #; alocate space for local vars
+ suba.w #0x1234,%sp
+ .cfi_adjust_cfa_offset 0x1234
+
+ #; dummy body
+ moveq.l #1,%d0
+
+ #; release space of local vars and return
+ adda.w #0x1234,%sp
+ .cfi_adjust_cfa_offset -0x1234
+ rts
+ .cfi_endproc
+
+#; func_prologue
+#; - functions that begins with standard
+#; prologue: "link %a6,#0"
+
+ .type func_prologue,@function
+func_prologue:
+ .cfi_startproc
+
+ #; prologue, CFI is valid after
+ #; each instruction.
+ link %a6,#0
+ .cfi_def_cfa_offset 8
+ .cfi_offset a6,-8
+ .cfi_def_cfa_register a6
+
+ #; function body
+ jbsr func_locvars
+ addq.l #3, %d0
+
+ #; epilogue with valid CFI
+ #; (we're better than gcc :-)
+ unlk %a6
+ .cfi_def_cfa_register sp
+ rts
+ .cfi_endproc
+
+#; main
+#; - typical function
+ .type main,@function
+main:
+ .cfi_startproc
+
+ #; only function body that doesn't
+ #; touch the stack at all.
+ jbsr func_prologue
+
+ #; return
+ rts
+ .cfi_endproc
run_dump_test "cfi-s390x-1"
}
+} elseif { [istarget "m68*-*"] } then {
+ run_dump_test "cfi-m68k"
+
} else {
return
}