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]

[PATCH bfin] Fix line number counting for multi-line instruction


When debugging assembly code generated by GCC, I found the line number in bfin port gas error message was not accurate. It counted a multi-line parallel instruction as one line. This patch fixes this bug.

Committed.


Jie


	* config/tc-bfin.c (md_assemble): Bump line counters if there is
	EOL in the instruction.

	testsuite/
	* gas/bfin/line_number.l, gas/bfin/line_number.s: New test.
	* gas/bfin/bfin.exp: Add the new test.

Index: config/tc-bfin.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-bfin.c,v
retrieving revision 1.27
diff -u -p -r1.27 tc-bfin.c
--- config/tc-bfin.c	3 Sep 2009 15:36:01 -0000	1.27
+++ config/tc-bfin.c	3 Sep 2009 16:27:44 -0000
@@ -712,6 +712,10 @@ md_assemble (char *line)
 #ifdef OBJ_ELF
   dwarf2_emit_insn (insn_size);
 #endif
+
+  while (*line++ != '\0')
+    if (*line == '\n')
+      bump_line_counters ();
 }
 
 /* Parse one line of instructions, and generate opcode for it.
Index: testsuite/gas/bfin/bfin.exp
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/bfin/bfin.exp,v
retrieving revision 1.7
diff -u -p -r1.7 bfin.exp
--- testsuite/gas/bfin/bfin.exp	3 Sep 2009 15:36:02 -0000	1.7
+++ testsuite/gas/bfin/bfin.exp	3 Sep 2009 16:27:45 -0000
@@ -17,6 +17,7 @@ if [istarget bfin*-*-*] {
 	run_dump_test "flow"
 	run_dump_test "flow2"
 	run_list_test "invalid_arith_mode" ""
+	run_list_test "line_number" ""
 	run_dump_test "load"
 	run_dump_test "logical"
 	run_dump_test "logical2"
Index: testsuite/gas/bfin/line_number.l
===================================================================
RCS file: testsuite/gas/bfin/line_number.l
diff -N testsuite/gas/bfin/line_number.l
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/gas/bfin/line_number.l	3 Sep 2009 16:27:45 -0000
@@ -0,0 +1,3 @@
+.*: Assembler messages:
+.*:4: Error: syntax error. Input text was illegal.
+.*:4: Error: 
Index: testsuite/gas/bfin/line_number.s
===================================================================
RCS file: testsuite/gas/bfin/line_number.s
diff -N testsuite/gas/bfin/line_number.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/gas/bfin/line_number.s	3 Sep 2009 16:27:45 -0000
@@ -0,0 +1,4 @@
+	R1 = ROT R0 BY 0 ||
+	R3 = [SP+12] ||
+	nop;
+	ILLEGAL;

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