From 1848a40fdd134c5579e743d93f1ca9acc0b4b486 Mon Sep 17 00:00:00 2001 From: liuzhensong Date: Sun, 20 Mar 2022 09:19:55 +0800 Subject: [PATCH] gas:LoongArch: Fix wrong line number in .debug_line The dwarf2_emit_insn() can create debuginfo of line. But it is called too late in append_fixp_and_insn. It causes extra offs when debuginfo of line sets address. gas/config/ * tc-loongarch.c --- gas/config/tc-loongarch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gas/config/tc-loongarch.c b/gas/config/tc-loongarch.c index d7ab1555ee6..3f7aa996f3f 100644 --- a/gas/config/tc-loongarch.c +++ b/gas/config/tc-loongarch.c @@ -877,6 +877,8 @@ append_fixp_and_insn (struct loongarch_cl_insn *ip) struct reloc_info *reloc_info = ip->reloc_info; size_t i; + dwarf2_emit_insn (0); + for (i = 0; i < ip->reloc_num; i++) { reloc_type = reloc_info[i].type; @@ -893,8 +895,6 @@ append_fixp_and_insn (struct loongarch_cl_insn *ip) as_fatal (_("Internal error: not support relax now")); else append_fixed_insn (ip); - - dwarf2_emit_insn (0); } /* Ask helper for returning a malloced c_str or NULL. */ -- 2.30.2