aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaz Kojima <kkojima@rr.iij4u.or.jp>2004-03-18 01:17:33 +0000
committerKaz Kojima <kkojima@rr.iij4u.or.jp>2004-03-18 01:17:33 +0000
commitb44df189ae5df34f7139997ea6a7b61795289881 (patch)
tree85953031967c6201d78aa5f795d53018142ecaf5
parentb296caf8bc9dc9c685932388bbb5dc21eeb4f36f (diff)
downloadgdb-b44df189ae5df34f7139997ea6a7b61795289881.zip
gdb-b44df189ae5df34f7139997ea6a7b61795289881.tar.gz
gdb-b44df189ae5df34f7139997ea6a7b61795289881.tar.bz2
[gas]
* config/tc-sh.c: Include dw2gencfi.h. (sh_cfi_frame_initial_instructions): New function. (sh_regname_to_dw2regnum): Likewise. * config/tc-sh.h (DWARF2_LINE_MIN_INSN_LENGTH): Move to the end of file. (TARGET_USE_CFIPOP): Define. (tc_cfi_frame_initial_instructions): Likewise. (tc_regname_to_dw2regnum): Likewise. (DWARF2_DEFAULT_RETURN_COLUMN, DWARF2_CIE_DATA_ALIGNMENT): Likewise. * Makefile.am: Update dependencies. * Makefile.in: Regenerate. [gas/testsuite] * gas/cfi/cfi-sh-1.d: New file. * gas/cfi/cfi-sh-1.s: Likewise. * gas/cfi/cfi.exp: Add SH case.
-rw-r--r--gas/ChangeLog14
-rw-r--r--gas/Makefile.am6
-rw-r--r--gas/Makefile.in6
-rw-r--r--gas/config/tc-sh.c50
-rw-r--r--gas/config/tc-sh.h16
-rw-r--r--gas/testsuite/ChangeLog6
-rw-r--r--gas/testsuite/gas/cfi/cfi.exp7
7 files changed, 96 insertions, 9 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 42588e5..468b14f 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,17 @@
+2004-03-17 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * config/tc-sh.c: Include dw2gencfi.h.
+ (sh_cfi_frame_initial_instructions): New function.
+ (sh_regname_to_dw2regnum): Likewise.
+ * config/tc-sh.h (DWARF2_LINE_MIN_INSN_LENGTH): Move to the end of
+ file.
+ (TARGET_USE_CFIPOP): Define.
+ (tc_cfi_frame_initial_instructions): Likewise.
+ (tc_regname_to_dw2regnum): Likewise.
+ (DWARF2_DEFAULT_RETURN_COLUMN, DWARF2_CIE_DATA_ALIGNMENT): Likewise.
+ * Makefile.am: Update dependencies.
+ * Makefile.in: Regenerate.
+
2004-03-17 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.in: Switch sh-*-rtems* to ELF. Add sh-*-rtemscoff*.
diff --git a/gas/Makefile.am b/gas/Makefile.am
index 0a88de0..49a0f13 100644
--- a/gas/Makefile.am
+++ b/gas/Makefile.am
@@ -1400,20 +1400,20 @@ DEPTC_sh_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \
$(srcdir)/config/tc-sh.h $(INCDIR)/coff/internal.h \
$(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \
$(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/sh-opc.h \
- $(INCDIR)/safe-ctype.h struc-symbol.h dwarf2dbg.h
+ $(INCDIR)/safe-ctype.h struc-symbol.h dwarf2dbg.h dw2gencfi.h
DEPTC_sh_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \
$(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh.h \
subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/sh-opc.h \
$(INCDIR)/safe-ctype.h struc-symbol.h $(INCDIR)/elf/sh.h \
- $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h
+ $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h dw2gencfi.h
DEPTC_sh64_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \
$(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh64.h \
$(srcdir)/config/tc-sh.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
$(BFDDIR)/elf32-sh64.h $(INCDIR)/safe-ctype.h $(srcdir)/../opcodes/sh64-opc.h \
$(srcdir)/config/tc-sh.c subsegs.h $(INCDIR)/obstack.h \
- $(srcdir)/../opcodes/sh-opc.h struc-symbol.h dwarf2dbg.h
+ $(srcdir)/../opcodes/sh-opc.h struc-symbol.h dwarf2dbg.h dw2gencfi.h
DEPTC_sparc_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \
$(srcdir)/config/tc-sparc.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \
$(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \
diff --git a/gas/Makefile.in b/gas/Makefile.in
index beed770..17920c8 100644
--- a/gas/Makefile.in
+++ b/gas/Makefile.in
@@ -1234,14 +1234,14 @@ DEPTC_sh_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \
$(srcdir)/config/tc-sh.h $(INCDIR)/coff/internal.h \
$(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \
$(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/sh-opc.h \
- $(INCDIR)/safe-ctype.h struc-symbol.h dwarf2dbg.h
+ $(INCDIR)/safe-ctype.h struc-symbol.h dwarf2dbg.h dw2gencfi.h
DEPTC_sh_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \
$(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh.h \
subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/sh-opc.h \
$(INCDIR)/safe-ctype.h struc-symbol.h $(INCDIR)/elf/sh.h \
- $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h
+ $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h dw2gencfi.h
DEPTC_sh64_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \
$(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
@@ -1249,7 +1249,7 @@ DEPTC_sh64_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \
$(srcdir)/config/tc-sh.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
$(BFDDIR)/elf32-sh64.h $(INCDIR)/safe-ctype.h $(srcdir)/../opcodes/sh64-opc.h \
$(srcdir)/config/tc-sh.c subsegs.h $(INCDIR)/obstack.h \
- $(srcdir)/../opcodes/sh-opc.h struc-symbol.h dwarf2dbg.h
+ $(srcdir)/../opcodes/sh-opc.h struc-symbol.h dwarf2dbg.h dw2gencfi.h
DEPTC_sparc_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \
$(srcdir)/config/tc-sparc.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \
diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c
index ee51c73..45698d5 100644
--- a/gas/config/tc-sh.c
+++ b/gas/config/tc-sh.c
@@ -35,6 +35,7 @@
#endif
#include "dwarf2dbg.h"
+#include "dw2gencfi.h"
typedef struct
{
@@ -4295,4 +4296,53 @@ sh_parse_name (char const *name, expressionS *exprP, char *nextcharP)
return 1;
}
#endif
+
+void
+sh_cfi_frame_initial_instructions (void)
+{
+ cfi_add_CFA_def_cfa (15, 0);
+}
+
+int
+sh_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[] =
+ {
+ { "pr", 17 }, { "t", 18 }, { "gbr", 19 }, { "mach", 20 },
+ { "macl", 21 }, { "fpul", 23 }
+ };
+
+ for (i = 0; i < ARRAY_SIZE (regnames); ++i)
+ if (strcmp (regnames[i].name, regname) == 0)
+ return regnames[i].dw2regnum;
+
+ if (regname[0] == 'r')
+ {
+ p = regname + 1;
+ regnum = strtoul (p, &q, 10);
+ if (p == q || *q || regnum >= 16)
+ return -1;
+ }
+ else if (regname[0] == 'f' && regname[1] == 'r')
+ {
+ p = regname + 2;
+ regnum = strtoul (p, &q, 10);
+ if (p == q || *q || regnum >= 16)
+ return -1;
+ regnum += 25;
+ }
+ else if (regname[0] == 'x' && regname[1] == 'd')
+ {
+ p = regname + 2;
+ regnum = strtoul (p, &q, 10);
+ if (p == q || *q || regnum >= 8)
+ return -1;
+ regnum += 87;
+ }
+ return regnum;
+}
#endif /* BFD_ASSEMBLER */
diff --git a/gas/config/tc-sh.h b/gas/config/tc-sh.h
index f6fc053..9931847 100644
--- a/gas/config/tc-sh.h
+++ b/gas/config/tc-sh.h
@@ -42,9 +42,6 @@ extern int sh_small;
/* Don't try to break words. */
#define WORKING_DOT_WORD
-/* All SH instructions are multiples of 16 bits. */
-#define DWARF2_LINE_MIN_INSN_LENGTH 2
-
/* We require .long, et. al., to be aligned correctly. */
#define md_cons_align(nbytes) sh_cons_align (nbytes)
extern void sh_cons_align (int);
@@ -261,4 +258,17 @@ void sh_cons_fix_new (fragS *, int, int, expressionS *);
symbols. The relocation type is stored in X_md. */
#define O_PIC_reloc O_md1
+#define TARGET_USE_CFIPOP 1
+
+#define tc_cfi_frame_initial_instructions sh_cfi_frame_initial_instructions
+extern void sh_cfi_frame_initial_instructions (void);
+
+#define tc_regname_to_dw2regnum sh_regname_to_dw2regnum
+extern int sh_regname_to_dw2regnum (const char *regname);
+
+/* All SH instructions are multiples of 16 bits. */
+#define DWARF2_LINE_MIN_INSN_LENGTH 2
+#define DWARF2_DEFAULT_RETURN_COLUMN 17
+#define DWARF2_CIE_DATA_ALIGNMENT -4
+
#endif /* OBJ_ELF */
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 5f7c30f..9484f0a 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2004-03-17 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * gas/cfi/cfi-sh-1.d: New file.
+ * gas/cfi/cfi-sh-1.s: Likewise.
+ * gas/cfi/cfi.exp: Add SH case.
+
2004-03-16 Alan Modra <amodra@bigpond.net.au>
* gas/ppc/altivec.d: Update.
diff --git a/gas/testsuite/gas/cfi/cfi.exp b/gas/testsuite/gas/cfi/cfi.exp
index d09d6fd..f32a047 100644
--- a/gas/testsuite/gas/cfi/cfi.exp
+++ b/gas/testsuite/gas/cfi/cfi.exp
@@ -49,6 +49,13 @@ if [istarget "x86_64-*"] then {
if { [regexp "elf64\[_-\]sparc" $nm_help] } then {
run_dump_test "cfi-sparc64-1"
}
+
+} elseif [istarget "sh*-*"] then {
+ if { [istarget sh64*-*-*] || [istarget sh5*-*-*] } then {
+ } else {
+ run_dump_test "cfi-sh-1"
+ }
+
} else {
return
}