+2003-07-10 Jakub Jelinek <jakub@redhat.com>
+
+ * config/tc-ppc.h (DWARF2_LINE_MIN_INSN_LENGTH): Define always.
+ (TARGET_USE_CFIPOP, tc_cfi_frame_initial_instructions,
+ tc_regname_to_dw2regnum, DWARF2_DEFAULT_RETURN_COLUMN,
+ DWARF2_CIE_DATA_ALIGNMENT): Define.
+ (ppc_cfi_frame_initial_instructions, tc_ppc_regname_to_dw2regnum): New
+ prototypes.
+ (ppc_cie_data_alignment): Declare.
+ * config/tc-ppc.c: Include dw2gencfi.h.
+ (ppc_cie_data_alignment): Define.
+ (md_begin): Initialize ppc_cie_data_alignment.
+ (ppc_cfi_frame_initial_instructions, tc_ppc_regname_to_dw2regnum): New
+ functions.
+ * config/tc-s390.h (DWARF2_LINE_MIN_INSN_LENGTH): Define always.
+ (TARGET_USE_CFIPOP, tc_cfi_frame_initial_instructions,
+ tc_regname_to_dw2regnum, DWARF2_DEFAULT_RETURN_COLUMN,
+ DWARF2_CIE_DATA_ALIGNMENT): Define.
+ (s390_cfi_frame_initial_instructions, tc_s390_regname_to_dw2regnum):
+ New prototypes.
+ (s390_cie_data_alignment): Declare.
+ * config/tc-s390.c: Include dw2gencfi.h.
+ (s390_cie_data_alignment): Define.
+ (md_begin): Initialize s390_cie_data_alignment.
+ (s390_cfi_frame_initial_instructions, tc_s390_regname_to_dw2regnum):
+ New functions.
+
2003-07-10 Alexandre Oliva <aoliva@redhat.com>
2002-12-12 Alexandre Oliva <aoliva@redhat.com>
#include "as.h"
#include "safe-ctype.h"
#include "subsegs.h"
-
+#include "dw2gencfi.h"
#include "opcode/ppc.h"
#ifdef OBJ_ELF
/* '+' and '-' can be used as postfix predicate predictors for conditional
branches. So they need to be accepted as symbol characters. */
const char ppc_symbol_chars[] = "+-";
+
+/* The dwarf2 data alignment, adjusted for 32 or 64 bit. */
+int ppc_cie_data_alignment;
\f
/* The target specific pseudo-ops which we support. */
ppc_set_cpu ();
+ ppc_cie_data_alignment = ppc_obj64 ? -8 : -4;
+
#ifdef OBJ_ELF
/* Set the ELF flags if desired. */
if (ppc_flags && !msolaris)
return reloc;
}
+
+void
+ppc_cfi_frame_initial_instructions ()
+{
+ cfi_add_CFA_def_cfa (1, 0);
+}
+
+int
+tc_ppc_regname_to_dw2regnum (const char *regname)
+{
+ unsigned int regnum = -1;
+ unsigned int i;
+ const char *p;
+ char *q;
+ static struct { char *name; int dw2regnum; } regnames[] =
+ {
+ { "sp", 1 }, { "r.sp", 1 }, { "rtoc", 2 }, { "r.toc", 2 },
+ { "mq", 64 }, { "lr", 65 }, { "ctr", 66 }, { "ap", 67 },
+ { "cc", 68 }, { "xer", 76 }, { "vrsave", 109 }, { "vscr", 110 },
+ { "spe_acc", 111 }, { "spefscr", 112 }
+ };
+
+ for (i = 0; i < ARRAY_SIZE (regnames); ++i)
+ if (strcmp (regnames[i].name, regname) == 0)
+ return regnames[i].dw2regnum;
+
+ if (regname[0] == 'r' || regname[0] == 'f' || regname[0] == 'v')
+ {
+ p = regname + 1 + (regname[1] == '.');
+ regnum = strtoul (p, &q, 10);
+ if (p == q || *q || regnum >= 32)
+ return -1;
+ if (regname[0] == 'f')
+ regnum += 32;
+ else if (regname[0] == 'v')
+ regnum += 77;
+ }
+ else if (regname[0] == 'c' && regname[1] == 'r')
+ {
+ p = regname + 2 + (regname[2] == '.');
+ if (p[0] < '0' || p[0] > '7' || p[1])
+ return -1;
+ regnum = p[0] - '0' + 68;
+ }
+ return regnum;
+}
#define tc_frob_file_before_adjust ppc_frob_file_before_adjust
extern void ppc_frob_file_before_adjust PARAMS ((void));
-#define DWARF2_LINE_MIN_INSN_LENGTH 4
#endif /* OBJ_ELF */
#define TC_FORCE_RELOCATION(FIX) ppc_force_relocation (FIX)
#define md_cleanup() ppc_cleanup ()
extern void ppc_cleanup PARAMS ((void));
+
+#define TARGET_USE_CFIPOP 1
+
+#define tc_cfi_frame_initial_instructions ppc_cfi_frame_initial_instructions
+extern void ppc_cfi_frame_initial_instructions PARAMS ((void));
+
+#define tc_regname_to_dw2regnum tc_ppc_regname_to_dw2regnum
+extern int tc_ppc_regname_to_dw2regnum PARAMS ((const char *regname));
+
+extern int ppc_cie_data_alignment;
+
+#define DWARF2_LINE_MIN_INSN_LENGTH 4
+#define DWARF2_DEFAULT_RETURN_COLUMN 0x41
+#define DWARF2_CIE_DATA_ALIGNMENT ppc_cie_data_alignment
#include "subsegs.h"
#include "struc-symbol.h"
#include "dwarf2dbg.h"
+#include "dw2gencfi.h"
#include "opcode/s390.h"
#include "elf/s390.h"
as in 0d1.0. */
const char FLT_CHARS[] = "dD";
+/* The dwarf2 data alignment, adjusted for 32 or 64 bit. */
+int s390_cie_data_alignment;
+
/* The target specific pseudo-ops which we support. */
/* Define the prototypes for the pseudo-ops */
if (s390_arch_size == 64 && current_cpu < S390_OPCODE_Z900)
as_warn ("The 64 bit file format is used without esame instructions.");
+ s390_cie_data_alignment = -s390_arch_size / 8;
+
/* Set the ELF flags if desired. */
if (s390_flags)
bfd_set_private_flags (stdoutput, s390_flags);
return reloc;
}
+
+void
+s390_cfi_frame_initial_instructions ()
+{
+ cfi_add_CFA_def_cfa (15, s390_arch_size == 64 ? 160 : 96);
+}
+
+int
+tc_s390_regname_to_dw2regnum (const char *regname)
+{
+ int regnum = -1;
+
+ if (regname[0] != 'c' && regname[0] != 'a')
+ {
+ regnum = reg_name_search (pre_defined_registers, REG_NAME_CNT, regname);
+ if (regname[0] == 'f' && regnum != -1)
+ regnum += 16;
+ }
+ else if (strcmp (regname, "ap") == 0)
+ regnum = 32;
+ else if (strcmp (regname, "cc") == 0)
+ regnum = 33;
+ return regnum;
+}
extern void s390_md_end PARAMS ((void));
#define md_end() s390_md_end ()
+
+#define TARGET_USE_CFIPOP 1
+
+#define tc_cfi_frame_initial_instructions s390_cfi_frame_initial_instructions
+extern void s390_cfi_frame_initial_instructions PARAMS ((void));
+
+#define tc_regname_to_dw2regnum tc_s390_regname_to_dw2regnum
+extern int tc_s390_regname_to_dw2regnum PARAMS ((const char *regname));
+
+extern int s390_cie_data_alignment;
+
+#define DWARF2_LINE_MIN_INSN_LENGTH 1
+#define DWARF2_DEFAULT_RETURN_COLUMN 14
+#define DWARF2_CIE_DATA_ALIGNMENT s390_cie_data_alignment
+2003-07-10 Jakub Jelinek <jakub@redhat.com>
+
+ * gas/cfi/cfi-ppc-1.s: New test.
+ * gas/cfi/cfi-ppc-1.d: New test.
+ * gas/cfi/cfi-s390-1.s: New test.
+ * gas/cfi/cfi-s390-1.s: New test.
+ * gas/cfi/cfi-s390x-1.s: New test.
+ * gas/cfi/cfi-s390x-1.s: New test.
+ * gas/cfi/cfi.exp: Run them.
+
2003-07-09 Alexandre Oliva <aoliva@redhat.com>
2002-02-20 Alexandre Oliva <aoliva@redhat.com>
--- /dev/null
+#readelf: -wf
+#name: CFI on ppc
+#as: -a32
+
+The section .eh_frame contains:
+
+00000000 00000010 00000000 CIE
+ Version: 1
+ Augmentation: "zR"
+ Code alignment factor: 4
+ Data alignment factor: -4
+ Return address column: 65
+ Augmentation data: 1b
+
+ DW_CFA_def_cfa: r1 ofs 0
+
+00000014 00000020 00000018 FDE cie=00000000 pc=0000001c..0000008c
+ DW_CFA_advance_loc: 4 to 00000020
+ DW_CFA_def_cfa_offset: 48
+ DW_CFA_advance_loc: 16 to 00000030
+ DW_CFA_offset: r27 at cfa-20
+ DW_CFA_offset: r26 at cfa-24
+ DW_CFA_offset_extended_sf: r65 at cfa\+4
+ DW_CFA_advance_loc: 8 to 00000038
+ DW_CFA_offset: r28 at cfa-16
+ DW_CFA_advance_loc: 8 to 00000040
+ DW_CFA_offset: r29 at cfa-12
+ DW_CFA_nop
+ DW_CFA_nop
+
--- /dev/null
+#; $ as -o test.o -a32 gas-cfi-test.s && gcc -nostdlib -o test test.o
+
+ .file "a.c"
+ .text
+ .align 2
+ .globl foo
+ .type foo, @function
+foo:
+ .cfi_startproc
+ stwu 1,-48(1)
+ .cfi_adjust_cfa_offset 48
+ mflr 0
+ stw 0,52(1)
+ stw 26,24(1)
+ stw 27,28(1)
+ .cfi_offset 27,-20
+ .cfi_offset %r26,-24
+ .cfi_offset lr,4
+ mr 27,5
+ stw 28,32(1)
+ .cfi_offset %r.28,-16
+ mr 28,4
+ stw 29,36(1)
+ .cfi_offset 29,-12
+ mr 29,3
+ bl bar1
+ mr 5,27
+ mr 26,3
+ mr 4,28
+ mr 3,29
+ bl syscall
+ mr 29,3
+ mr 3,26
+ bl bar2
+ lwz 28,32(1)
+ lwz 0,52(1)
+ mr 3,29
+ lwz 26,24(1)
+ lwz 27,28(1)
+ mtlr 0
+ lwz 29,36(1)
+ addi 1,1,48
+ blr
+ .cfi_endproc
+ .size foo, .-foo
--- /dev/null
+#readelf: -wf
+#name: CFI on s390
+#as: -m31 -march=g5
+
+The section .eh_frame contains:
+
+00000000 00000010 00000000 CIE
+ Version: 1
+ Augmentation: "zR"
+ Code alignment factor: 1
+ Data alignment factor: -4
+ Return address column: 14
+ Augmentation data: 1b
+
+ DW_CFA_def_cfa: r15 ofs 96
+
+00000014 00000024 00000018 FDE cie=00000000 pc=0000001c..0000006a
+ DW_CFA_advance_loc: 4 to 00000020
+ DW_CFA_offset: r15 at cfa-36
+ DW_CFA_offset: r14 at cfa-40
+ DW_CFA_offset: r13 at cfa-44
+ DW_CFA_offset: r12 at cfa-48
+ DW_CFA_offset: r11 at cfa-52
+ DW_CFA_offset: r10 at cfa-56
+ DW_CFA_offset: r9 at cfa-60
+ DW_CFA_offset: r8 at cfa-64
+ DW_CFA_advance_loc: 22 to 00000036
+ DW_CFA_def_cfa_offset: 192
+ DW_CFA_nop
+ DW_CFA_nop
+
--- /dev/null
+#; $ as -o test.o -m31 -march=g5 gas-cfi-test.s && gcc -m32 -nostdlib -o test test.o
+
+ .file "a.c"
+ .text
+ .align 4
+ .globl foo
+ .type foo, @function
+foo:
+ .cfi_startproc
+ stm %r8,%r15,32(%r15)
+ .cfi_offset %r15,-36
+ .cfi_offset %r14,-40
+ .cfi_offset %r13,-44
+ .cfi_offset %r12,-48
+ .cfi_offset %r11,-52
+ .cfi_offset %r10,-56
+ .cfi_offset %r9,-60
+ .cfi_offset %r8,-64
+ bras %r13,.L3
+.L2:
+ .align 4
+.LC0:
+ .long bar1
+.LC1:
+ .long syscall
+.LC2:
+ .long bar2
+ .align 2
+.L3:
+ lr %r14,%r15
+ ahi %r15,-96
+ .cfi_adjust_cfa_offset 96
+ lr %r12,%r2
+ l %r2,.LC0-.L2(%r13)
+ lr %r10,%r3
+ lr %r9,%r4
+ st %r14,0(%r15)
+ basr %r14,%r2
+ l %r1,.LC1-.L2(%r13)
+ lr %r4,%r9
+ lr %r8,%r2
+ lr %r3,%r10
+ lr %r2,%r12
+ basr %r14,%r1
+ l %r1,.LC2-.L2(%r13)
+ lr %r12,%r2
+ lr %r2,%r8
+ basr %r14,%r1
+ lr %r2,%r12
+ l %r4,152(%r15)
+ lm %r8,%r15,128(%r15)
+ br %r4
+ .cfi_endproc
+ .size foo, .-foo
--- /dev/null
+#readelf: -wf
+#name: CFI on s390x
+#as: -m64 -march=z900
+
+The section .eh_frame contains:
+
+00000000 00000011 00000000 CIE
+ Version: 1
+ Augmentation: "zR"
+ Code alignment factor: 1
+ Data alignment factor: -8
+ Return address column: 14
+ Augmentation data: 1b
+
+ DW_CFA_def_cfa: r15 ofs 160
+
+00000015 00000027 00000019 FDE cie=00000000 pc=0000001d..0000008d
+ DW_CFA_advance_loc: 6 to 00000023
+ DW_CFA_offset: r15 at cfa-40
+ DW_CFA_offset: r14 at cfa-48
+ DW_CFA_offset: r13 at cfa-56
+ DW_CFA_offset: r12 at cfa-64
+ DW_CFA_offset: r11 at cfa-72
+ DW_CFA_offset: r10 at cfa-80
+ DW_CFA_offset: r9 at cfa-88
+ DW_CFA_offset: r8 at cfa-96
+ DW_CFA_advance_loc: 8 to 0000002b
+ DW_CFA_def_cfa_offset: 320
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+
--- /dev/null
+#; $ as -o test.o -m64 -march=z900 gas-cfi-test.s && gcc -m64 -nostdlib -o test test.o
+
+ .file "a.c"
+ .text
+ .align 4
+ .globl foo
+ .type foo, @function
+foo:
+ .cfi_startproc
+ stmg %r8,%r15,64(%r15)
+ .cfi_offset %r15,-40
+ .cfi_offset %r14,-48
+ .cfi_offset %r13,-56
+ .cfi_offset %r12,-64
+ .cfi_offset %r11,-72
+ .cfi_offset %r10,-80
+ .cfi_offset %r9,-88
+ .cfi_offset %r8,-96
+ lgr %r14,%r15
+ aghi %r15,-160
+ .cfi_adjust_cfa_offset 160
+ lgr %r12,%r3
+ lgr %r10,%r4
+ lgr %r9,%r2
+ lgfr %r9,%r9
+ stg %r14,0(%r15)
+ brasl %r14,bar1
+ lgfr %r12,%r12
+ lgfr %r10,%r10
+ lgr %r3,%r12
+ lgr %r4,%r10
+ lgr %r8,%r2
+ lgr %r2,%r9
+ brasl %r14,syscall
+ lgfr %r8,%r8
+ lgr %r12,%r2
+ lgr %r2,%r8
+ brasl %r14,bar2
+ lgfr %r12,%r12
+ lgr %r2,%r12
+ lg %r4,272(%r15)
+ lmg %r8,%r15,224(%r15)
+ br %r4
+ .cfi_endproc
+ .size foo, .-foo
run_dump_test "cfi-alpha-2"
run_dump_test "cfi-alpha-3"
+} elseif { [istarget ppc*-*-*] || [istarget powerpc*-*-*] } then {
+ run_dump_test "cfi-ppc-1"
+
+} elseif { [istarget s390*-*-*] } then {
+ run_dump_test "cfi-s390-1"
+ if { [istarget s390x*-*-*] } then {
+ run_dump_test "cfi-s390x-1"
+ }
+
} else {
return
}