]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
LoongArch: Discard extra spaces in objdump output
authorLulu Cai <cailulu@loongson.cn>
Wed, 3 Jan 2024 11:57:10 +0000 (19:57 +0800)
committerliuzhensong <liuzhensong@loongson.cn>
Thu, 11 Jan 2024 06:08:24 +0000 (14:08 +0800)
Due to the formatted output of objdump, some instructions
that do not require output operands (such as nop/ret) will
have extra spaces added after them.

Determine whether to output operands through the format
of opcodes. When opc->format is an empty string, no extra
spaces are output.

gas/testsuite/gas/loongarch/64_pcrel.d
gas/testsuite/gas/loongarch/deprecated_reg_aliases.d
gas/testsuite/gas/loongarch/jmp_op.d
gas/testsuite/gas/loongarch/nop.d
gas/testsuite/gas/loongarch/privilege_op.d
gas/testsuite/gas/loongarch/reloc.d
opcodes/loongarch-dis.c

index 66b80a397fa30064f02085e8e924e83883230a39..642e3079668ece257df2eac35da28a09fd4c5027 100644 (file)
@@ -7,5 +7,5 @@
 Disassembly of section .text:
 
 00000000.* <.text>:
-[      ]+0:[   ]+03400000[     ]+nop[  ]+
+[      ]+0:[   ]+03400000[     ]+nop
 [      ]+0:[   ]+R_LARCH_64_PCREL[     ]+\*ABS\*
index 3ea0806765fbda38413754011dddc085b0f97fb3..01e593fbed056bc1a97ef6838b752f43e0d05589 100644 (file)
@@ -15,4 +15,4 @@ Disassembly of section .text:
 [      ]+8:[   ]+16024685[     ]+lu32i\.d[     ]+\$a1, 4660
 [      ]+c:[   ]+08200420[     ]+fmadd\.d[     ]+\$fa0, \$fa1, \$fa1, \$fa0
 [      ]+10:[  ]+380c16a4[     ]+ldx\.d[       ]+\$a0, \$r21, \$a1
-[      ]+14:[  ]+4c000020[     ]+ret[  ]+
+[      ]+14:[  ]+4c000020[     ]+ret
index cc544f11ca354d5ab3e38df36a011ee57a36ef8e..21576072aaba8664dddb93cab1359994e137aa35 100644 (file)
@@ -7,7 +7,7 @@
 Disassembly of section .text:
 
 00000000.* <.L1>:
-[      ]+0:[   ]+03400000[     ]+nop[  ]+
+[      ]+0:[   ]+03400000[     ]+nop
 [      ]+4:[   ]+63fffc04[     ]+bgtz[         ]+\$a0,[        ]+-4[   ]+#[    ]+0[    ]+<\.L1>
 [      ]+4:[   ]+R_LARCH_B16[  ]+\.L1
 [      ]+8:[   ]+67fff880[     ]+bgez[         ]+\$a0,[        ]+-8[   ]+#[    ]+0[    ]+<\.L1>
@@ -47,4 +47,4 @@ Disassembly of section .text:
 [      ]+4c:[  ]+R_LARCH_B16[  ]+\.L1
 [      ]+50:[  ]+6fffb0a4[     ]+bgeu[         ]+\$a1,[        ]+\$a0,[        ]+-80[  ]+#[    ]+0[    ]+<\.L1>
 [      ]+50:[  ]+R_LARCH_B16[  ]+\.L1
-[      ]+54:[  ]+4c000020[     ]+ret[  ]+
+[      ]+54:[  ]+4c000020[     ]+ret
index 222456e8b8caa1b2a75297e15f07ed4a749c2203..ca8c56309e9248862a970fd6c31b8628c5c25848 100644 (file)
@@ -7,4 +7,4 @@
 Disassembly of section .text:
 
 0+000 <target>:
-[      ]+0:[   ]+03400000[     ]+nop[  ]+
+[      ]+0:[   ]+03400000[     ]+nop
index 73925f21a37bf5d58837c968181fc23f4bea2200..e9ca60b2b3290f655b110812b007dd7e33866b4f 100644 (file)
@@ -31,13 +31,13 @@ Disassembly of section .text:
 [      ]+54:[  ]+064814a4 [    ]+iocsrwr.h[    ]+[     ]+\$a0, \$a1
 [      ]+58:[  ]+064818a4 [    ]+iocsrwr.w[    ]+[     ]+\$a0, \$a1
 [      ]+5c:[  ]+06481ca4 [    ]+iocsrwr.d[    ]+[     ]+\$a0, \$a1
-[      ]+60:[  ]+06482000 [    ]+tlbclr[       ]+
-[      ]+64:[  ]+06482400 [    ]+tlbflush[     ]+
-[      ]+68:[  ]+06482800 [    ]+tlbsrch[      ]+
-[      ]+6c:[  ]+06482c00 [    ]+tlbrd[        ]+
-[      ]+70:[  ]+06483000 [    ]+tlbwr[        ]+
-[      ]+74:[  ]+06483400 [    ]+tlbfill[      ]+
-[      ]+78:[  ]+06483800 [    ]+ertn[         ]+
+[      ]+60:[  ]+06482000 [    ]+tlbclr
+[      ]+64:[  ]+06482400 [    ]+tlbflush
+[      ]+68:[  ]+06482800 [    ]+tlbsrch
+[      ]+6c:[  ]+06482c00 [    ]+tlbrd
+[      ]+70:[  ]+06483000 [    ]+tlbwr
+[      ]+74:[  ]+06483400 [    ]+tlbfill
+[      ]+78:[  ]+06483800 [    ]+ertn
 [      ]+7c:[  ]+06488000 [    ]+idle[         ]+[     ]+0x0
 [      ]+80:[  ]+0648ffff [    ]+idle[         ]+[     ]+0x7fff
 [      ]+84:[  ]+064998a0 [    ]+invtlb[       ]+[     ]+0x0, \$a1, \$a2
index 0458830f30b7b9c5092045641f60808a2e81ec51..fa249c58fd51aeb02a98382e2e03a48189d24df5 100644 (file)
@@ -8,7 +8,7 @@
 Disassembly of section .text:
 
 00000000.* <.text>:
-[      ]+0:[   ]+03400000[     ]+nop[  ]+
+[      ]+0:[   ]+03400000[     ]+nop
 [      ]+4:[   ]+58000085[     ]+beq[  ]+\$a0,[        ]+\$a1,[        ]+0[    ]+#[    ]+0x4
 [      ]+4:[   ]+R_LARCH_B16[  ]+.L1
 [      ]+8:[   ]+5c000085[     ]+bne[  ]+\$a0,[        ]+\$a1,[        ]+0[    ]+#[    ]+0x8
index 66a55960716aa3b418ff9cb2652634ad1a6d503e..c0f0642c8fc306c4eb4d0e517f5f21cf464009b8 100644 (file)
@@ -267,7 +267,12 @@ disassemble_one (insn_t insn, struct disassemble_info *info)
     }
 
   info->insn_type = dis_nonbranch;
-  info->fprintf_styled_func (info->stream, dis_style_mnemonic, "%-12s", opc->name);
+  if (opc->format == NULL || opc->format[0] == '\0')
+    info->fprintf_styled_func (info->stream, dis_style_mnemonic,
+                               "%s", opc->name);
+  else
+    info->fprintf_styled_func (info->stream, dis_style_mnemonic,
+                               "%-12s", opc->name);
 
   {
     char *fake_args = xmalloc (strlen (opc->format) + 1);