This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

d10v .loc support


This patch adds support to d10v for .loc and associated dwarf line
info directives.  I can't vouch for the quality, but this does pass
the gas tests, and it's better than nothing..

lns-common-1.s was modified so that the resulting dwarf line info
matched that for other targets.  Since d10v packs two instructions per
word, this ensures that the address increments between .loc's.
Without this change, d10v emitted a "Copy" (because both address and
line were unchanged) where other targets emitted:
  Special opcode .*: advance Address by .* to .* and Line by 0 to 7

gas/
	* config/tc-d10v.c: Include dwarf2dbg.h.
	(write_long, write_1_short, write_2_short): Call dwarf2_emit_insn.
	(d10v_frob_label): New function.
	* config/tc-d10v.h (d10v_frob_label): Declare.
	(tc_frob_label): Define as d10v_frob_label.
gas/testsuite/
	* gas/lns/lns-common-1.s: Use two nops between each .loc.
	* gas/lns/lns.exp: Don't exclude d10v.

Index: gas/config/tc-d10v.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-d10v.c,v
retrieving revision 1.42
diff -u -p -r1.42 tc-d10v.c
--- gas/config/tc-d10v.c	17 Oct 2007 16:45:55 -0000	1.42
+++ gas/config/tc-d10v.c	10 Sep 2009 08:01:36 -0000
@@ -1,5 +1,6 @@
 /* tc-d10v.c -- Assembler code for the Mitsubishi D10V
-   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007
+   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006,
+   2007, 2009
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -24,6 +25,7 @@
 #include "subsegs.h"
 #include "opcode/d10v.h"
 #include "elf/ppc.h"
+#include "dwarf2dbg.h"
 
 const char comment_chars[]        = ";";
 const char line_comment_chars[]   = "#";
@@ -610,6 +612,7 @@ write_long (unsigned long insn, Fixups *
   int i, where;
   char *f = frag_more (4);
 
+  dwarf2_emit_insn (4);
   insn |= FM11;
   number_to_chars_bigendian (f, insn, 4);
 
@@ -645,6 +648,7 @@ write_1_short (struct d10v_opcode *opcod
   char *f = frag_more (4);
   int i, where;
 
+  dwarf2_emit_insn (4);
   if (opcode->exec_type & PARONLY)
     as_fatal (_("Instruction must be executed in parallel with another instruction."));
 
@@ -1059,6 +1063,7 @@ write_2_short (struct d10v_opcode *opcod
     }
 
   f = frag_more (4);
+  dwarf2_emit_insn (4);
   number_to_chars_bigendian (f, insn, 4);
 
   /* Process fixup chains.  fx refers to insn2 when j == 0, and to
@@ -1626,6 +1631,15 @@ d10v_cleanup (void)
   return 1;
 }
 
+void
+d10v_frob_label (symbolS *lab)
+{
+  d10v_cleanup ();
+  symbol_set_frag (lab, frag_now);
+  S_SET_VALUE (lab, (valueT) frag_now_fix ());
+  dwarf2_emit_label (lab);
+}
+
 /* Like normal .word, except support @word.
    Clobbers input_line_pointer, checks end-of-line.  */
 
Index: gas/config/tc-d10v.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-d10v.h,v
retrieving revision 1.18
diff -u -p -r1.18 tc-d10v.h
--- gas/config/tc-d10v.h	3 Jul 2007 11:01:04 -0000	1.18
+++ gas/config/tc-d10v.h	10 Sep 2009 14:10:44 -0000
@@ -1,5 +1,5 @@
 /* tc-d10v.h -- Header file for tc-d10v.c.
-   Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2005, 2007
+   Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2005, 2007, 2009
    Free Software Foundation, Inc.
    Written by Martin Hunt, Cygnus Support.
 
@@ -46,17 +46,11 @@ long md_pcrel_from_section (struct fix *
 #define md_number_to_chars	     number_to_chars_bigendian
 
 int d10v_cleanup (void);
+void d10v_frob_label (symbolS *);
 #define md_after_pass_hook()	     d10v_cleanup ()
 #define md_cleanup()		     d10v_cleanup ()
 #define md_do_align(a,b,c,d,e)	     d10v_cleanup ()
-#define tc_frob_label(sym)				\
-  do							\
-    {							\
-      d10v_cleanup ();					\
-      symbol_set_frag (sym, frag_now);			\
-      S_SET_VALUE (sym, (valueT) frag_now_fix ());	\
-    }							\
-  while (0)
+#define tc_frob_label(sym)	     d10v_frob_label (sym)
 
 #define tc_fix_adjustable(FIX) d10v_fix_adjustable(FIX)
 bfd_boolean d10v_fix_adjustable (struct fix *);
Index: gas/testsuite/gas/lns/lns-common-1.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/lns/lns-common-1.s,v
retrieving revision 1.3
diff -u -p -r1.3 lns-common-1.s
--- gas/testsuite/gas/lns/lns-common-1.s	24 Apr 2009 18:31:29 -0000	1.3
+++ gas/testsuite/gas/lns/lns-common-1.s	10 Sep 2009 07:02:54 -0000
@@ -1,17 +1,25 @@
 	.file 1 "foo.c"
 	.loc 1 1
 	nop
+	nop
 	.loc 1 2 3
 	nop
+	nop
 	.loc 1 3 prologue_end
 	nop
+	nop
 	.loc 1 4 0 epilogue_begin
 	nop
+	nop
 	.loc 1 5 isa 1 basic_block
 	nop
+	nop
 	.loc 1 6 is_stmt 0
 	nop
+	nop
 	.loc 1 7 is_stmt 1
 	nop
+	nop
 	.loc 1 7 discriminator 1
 	nop
+	nop
Index: gas/testsuite/gas/lns/lns.exp
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/lns/lns.exp,v
retrieving revision 1.11
diff -u -p -r1.11 lns.exp
--- gas/testsuite/gas/lns/lns.exp	24 Jan 2009 09:57:31 -0000	1.11
+++ gas/testsuite/gas/lns/lns.exp	10 Sep 2009 07:02:54 -0000
@@ -3,21 +3,13 @@ if ![is_elf_format] then {
 }
 
 run_list_test "lns-diag-1" ""
-
-# Does not work on targets that do not generate line number
-# information (d10v).
-if {![istarget d10v-*-*]} {
-    run_dump_test "lns-duplicate"
-}
+run_dump_test "lns-duplicate"
 
 # ??? Won't work on targets that don't have a bare "nop" insn.
 # Perhaps we could arrange for an include file or something that
 # defined a macro...
-# Nor does it work on targets that do not generate line number
-# information (d10v).
 if {
-        ![istarget d10v-*-*]
-     && ![istarget i370-*-*]
+        ![istarget i370-*-*]
      && ![istarget i960-*-*]
      && ![istarget mcore-*-*]
      && ![istarget or32-*-*]

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]