This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[patch] Arm dwarf line debug info
- From: Paul Brook <paul at codesourcery dot com>
- To: binutils at sourceware dot org
- Date: Sun, 19 Mar 2006 19:29:05 +0000
- Subject: [patch] Arm dwarf line debug info
Gas sometimes generates incorrect dwarf line debug info for Thumb-2
instructions. The problem occurs when a Thumb-2 instruction subject to
relaxation ends up as the 16-bit version. The patch below fixes this by
calling dwarf2_emit_insn before the insn is output, like other ports with
variable-length insns do.
Tested with cross to arm-none-eabi.
Ok?
Paul
2006-03-19 Paul Brook <paul@codesourcery.com>
* config/tc-arm.c (output_relax_insn): Call dwarf2_emit_insn before
outputting the insn.
Index: gas/config/tc-arm.c
===================================================================
RCS file: /var/cvsroot/src-cvs/src/gas/config/tc-arm.c,v
retrieving revision 1.248
diff -u -p -r1.248 tc-arm.c
--- gas/config/tc-arm.c 17 Mar 2006 14:03:36 -0000 1.248
+++ gas/config/tc-arm.c 19 Mar 2006 19:11:12 -0000
@@ -7982,6 +8044,12 @@ output_relax_insn (void)
symbolS *sym;
int offset;
+#ifdef OBJ_ELF
+ /* The size of the instruction is unknown, so tie the debug info to the
+ start of the function. */
+ dwarf2_emit_insn (0);
+#endif
+
switch (inst.reloc.exp.X_op)
{
case O_symbol:
@@ -8000,10 +8068,6 @@ output_relax_insn (void)
to = frag_var (rs_machine_dependent, INSN_SIZE, THUMB_SIZE,
inst.relax, sym, offset, NULL/*offset, opcode*/);
md_number_to_chars (to, inst.instruction, THUMB_SIZE);
-
-#ifdef OBJ_ELF
- dwarf2_emit_insn (INSN_SIZE);
-#endif
}
/* Write a 32-bit thumb instruction to buf. */