This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[PATCH] Emit MIPS assembler line numbers
- From: Momchil Velikov <velco at fadata dot bg>
- To: binutils at sources dot redhat dot com
- Date: 17 Apr 2002 16:37:55 +0300
- Subject: [PATCH] Emit MIPS assembler line numbers
Hi there,
The following patch adds GAS generation of DWARF2 line numbers for the
MIPS architecture.
?
Regards,
-velco
Index: tc-mips.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mips.c,v
retrieving revision 1.115
diff -u -d -p -r1.115 tc-mips.c
--- tc-mips.c 4 Apr 2002 07:43:11 -0000 1.115
+++ tc-mips.c 17 Apr 2002 13:26:35 -0000
@@ -69,7 +69,14 @@ static int mips_output_flavor () { retur
#if defined (OBJ_ELF)
#include "elf/mips.h"
-#endif
+#include "dwarf2dbg.h"
+#define emit_insn(s) dwarf2_emit_insn (s)
+
+#else /* ! OBJ_ELF */
+
+#define emit_insn(s) ((void) s)
+
+#endif /* OBJ_ELF */
#ifndef ECOFF_DEBUGGING
#define NO_ECOFF_DEBUGGING
@@ -1687,10 +1694,10 @@ append_insn (place, ip, address_expr, re
it. */
/* This is how a NOP is emitted. */
-#define emit_nop() \
- (mips_opts.mips16 \
- ? md_number_to_chars (frag_more (2), 0x6500, 2) \
- : md_number_to_chars (frag_more (4), 0, 4))
+#define emit_nop() \
+ (mips_opts.mips16 \
+ ? md_number_to_chars (frag_more (2), 0x6500, 2), emit_insn (2) \
+ : md_number_to_chars (frag_more (4), 0, 4)), emit_insn (4)
/* The previous insn might require a delay slot, depending upon
the contents of the current insn. */
@@ -2222,20 +2229,26 @@ append_insn (place, ip, address_expr, re
}
if (! mips_opts.mips16)
- md_number_to_chars (f, ip->insn_opcode, 4);
- else if (*reloc_type == BFD_RELOC_MIPS16_JMP)
{
- md_number_to_chars (f, ip->insn_opcode >> 16, 2);
- md_number_to_chars (f + 2, ip->insn_opcode & 0xffff, 2);
+ md_number_to_chars (f, ip->insn_opcode, 4);
+ emit_insn (4);
}
+ else if (*reloc_type == BFD_RELOC_MIPS16_JMP)
+ {
+ md_number_to_chars (f, ip->insn_opcode >> 16, 2);
+ md_number_to_chars (f + 2, ip->insn_opcode & 0xffff, 2);
+ emit_insn (4);
+ }
else
{
if (ip->use_extend)
{
md_number_to_chars (f, 0xf000 | ip->extend, 2);
f += 2;
+ emit_insn (2);
}
md_number_to_chars (f, ip->insn_opcode, 2);
+ emit_insn (2);
}
/* Update the register mask information. */