From 75e21f08dc057f373ed4b9c76ddc54b2e3a0ee9d Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 10 Jul 2003 16:46:38 +0000 Subject: * 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. * 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. --- gas/config/tc-ppc.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++- gas/config/tc-ppc.h | 15 ++++++++++++++- gas/config/tc-s390.c | 30 +++++++++++++++++++++++++++++ gas/config/tc-s390.h | 14 ++++++++++++++ 4 files changed, 110 insertions(+), 2 deletions(-) (limited to 'gas/config') diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index 8b9ffef..f3b5472 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -24,7 +24,7 @@ #include "as.h" #include "safe-ctype.h" #include "subsegs.h" - +#include "dw2gencfi.h" #include "opcode/ppc.h" #ifdef OBJ_ELF @@ -186,6 +186,9 @@ const char FLT_CHARS[] = "dD"; /* '+' 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; /* The target specific pseudo-ops which we support. */ @@ -1208,6 +1211,8 @@ md_begin () ppc_set_cpu (); + ppc_cie_data_alignment = ppc_obj64 ? -8 : -4; + #ifdef OBJ_ELF /* Set the ELF flags if desired. */ if (ppc_flags && !msolaris) @@ -5919,3 +5924,49 @@ tc_gen_reloc (seg, fixp) 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; +} diff --git a/gas/config/tc-ppc.h b/gas/config/tc-ppc.h index 2bac481..3612f43 100644 --- a/gas/config/tc-ppc.h +++ b/gas/config/tc-ppc.h @@ -251,7 +251,6 @@ extern int ppc_fix_adjustable PARAMS ((struct fix *)); #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) @@ -268,3 +267,17 @@ extern int ppc_parse_name PARAMS ((const char *, struct expressionS *)); #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 diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c index 9957019..61764ef 100644 --- a/gas/config/tc-s390.c +++ b/gas/config/tc-s390.c @@ -25,6 +25,7 @@ #include "subsegs.h" #include "struc-symbol.h" #include "dwarf2dbg.h" +#include "dw2gencfi.h" #include "opcode/s390.h" #include "elf/s390.h" @@ -70,6 +71,9 @@ const char EXP_CHARS[] = "eE"; 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 */ @@ -478,6 +482,8 @@ md_begin () 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); @@ -2286,3 +2292,27 @@ tc_gen_reloc (seg, fixp) 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; +} diff --git a/gas/config/tc-s390.h b/gas/config/tc-s390.h index ed4d5506..a416927 100644 --- a/gas/config/tc-s390.h +++ b/gas/config/tc-s390.h @@ -102,3 +102,17 @@ extern long md_pcrel_from_section PARAMS ((struct fix *, segT)); 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 -- cgit v1.1