* [PATCH] LoongArch: Discard extra spaces in objdump output
@ 2024-01-05 2:00 Lulu Cai
2024-01-05 7:05 ` WANG Xuerui
0 siblings, 1 reply; 3+ messages in thread
From: Lulu Cai @ 2024-01-05 2:00 UTC (permalink / raw)
To: binutils
Cc: xuchenghua, chenglulu, liuzhensong, mengqinggang, xry111,
i.swmail, maskray, luweining, wanglei, hejinyang, Lulu Cai
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 | 2 +-
.../gas/loongarch/deprecated_reg_aliases.d | 2 +-
gas/testsuite/gas/loongarch/jmp_op.d | 4 ++--
gas/testsuite/gas/loongarch/nop.d | 2 +-
gas/testsuite/gas/loongarch/privilege_op.d | 14 +++++++-------
gas/testsuite/gas/loongarch/reloc.d | 2 +-
opcodes/loongarch-dis.c | 5 ++++-
7 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/gas/testsuite/gas/loongarch/64_pcrel.d b/gas/testsuite/gas/loongarch/64_pcrel.d
index 66b80a397fa..642e3079668 100644
--- a/gas/testsuite/gas/loongarch/64_pcrel.d
+++ b/gas/testsuite/gas/loongarch/64_pcrel.d
@@ -7,5 +7,5 @@
Disassembly of section .text:
00000000.* <.text>:
-[ ]+0:[ ]+03400000[ ]+nop[ ]+
+[ ]+0:[ ]+03400000[ ]+nop
[ ]+0:[ ]+R_LARCH_64_PCREL[ ]+\*ABS\*
diff --git a/gas/testsuite/gas/loongarch/deprecated_reg_aliases.d b/gas/testsuite/gas/loongarch/deprecated_reg_aliases.d
index 3ea0806765f..01e593fbed0 100644
--- a/gas/testsuite/gas/loongarch/deprecated_reg_aliases.d
+++ b/gas/testsuite/gas/loongarch/deprecated_reg_aliases.d
@@ -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
diff --git a/gas/testsuite/gas/loongarch/jmp_op.d b/gas/testsuite/gas/loongarch/jmp_op.d
index cc544f11ca3..21576072aab 100644
--- a/gas/testsuite/gas/loongarch/jmp_op.d
+++ b/gas/testsuite/gas/loongarch/jmp_op.d
@@ -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
diff --git a/gas/testsuite/gas/loongarch/nop.d b/gas/testsuite/gas/loongarch/nop.d
index 222456e8b8c..ca8c56309e9 100644
--- a/gas/testsuite/gas/loongarch/nop.d
+++ b/gas/testsuite/gas/loongarch/nop.d
@@ -7,4 +7,4 @@
Disassembly of section .text:
0+000 <target>:
-[ ]+0:[ ]+03400000[ ]+nop[ ]+
+[ ]+0:[ ]+03400000[ ]+nop
diff --git a/gas/testsuite/gas/loongarch/privilege_op.d b/gas/testsuite/gas/loongarch/privilege_op.d
index 73925f21a37..e9ca60b2b32 100644
--- a/gas/testsuite/gas/loongarch/privilege_op.d
+++ b/gas/testsuite/gas/loongarch/privilege_op.d
@@ -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
diff --git a/gas/testsuite/gas/loongarch/reloc.d b/gas/testsuite/gas/loongarch/reloc.d
index 0458830f30b..fa249c58fd5 100644
--- a/gas/testsuite/gas/loongarch/reloc.d
+++ b/gas/testsuite/gas/loongarch/reloc.d
@@ -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
diff --git a/opcodes/loongarch-dis.c b/opcodes/loongarch-dis.c
index 969ea28f96f..c1b284bcd8a 100644
--- a/opcodes/loongarch-dis.c
+++ b/opcodes/loongarch-dis.c
@@ -267,7 +267,10 @@ 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 (strcmp (opc->format, "") == 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);
--
2.36.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] LoongArch: Discard extra spaces in objdump output
2024-01-05 2:00 [PATCH] LoongArch: Discard extra spaces in objdump output Lulu Cai
@ 2024-01-05 7:05 ` WANG Xuerui
2024-01-08 3:50 ` Lulu Cai
0 siblings, 1 reply; 3+ messages in thread
From: WANG Xuerui @ 2024-01-05 7:05 UTC (permalink / raw)
To: Lulu Cai, binutils
Cc: xuchenghua, chenglulu, liuzhensong, mengqinggang, xry111,
i.swmail, maskray, luweining, wanglei, hejinyang
Hi,
On 1/5/24 10:00, Lulu Cai wrote:
> 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 | 2 +-
> .../gas/loongarch/deprecated_reg_aliases.d | 2 +-
> gas/testsuite/gas/loongarch/jmp_op.d | 4 ++--
> gas/testsuite/gas/loongarch/nop.d | 2 +-
> gas/testsuite/gas/loongarch/privilege_op.d | 14 +++++++-------
> gas/testsuite/gas/loongarch/reloc.d | 2 +-
> opcodes/loongarch-dis.c | 5 ++++-
> 7 files changed, 17 insertions(+), 14 deletions(-)
>
> <snip>
>
> diff --git a/opcodes/loongarch-dis.c b/opcodes/loongarch-dis.c
> index 969ea28f96f..c1b284bcd8a 100644
> --- a/opcodes/loongarch-dis.c
> +++ b/opcodes/loongarch-dis.c
> @@ -267,7 +267,10 @@ 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 (strcmp (opc->format, "") == 0)
Why not simply check 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);
Otherwise, thanks for the patch!
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] LoongArch: Discard extra spaces in objdump output
2024-01-05 7:05 ` WANG Xuerui
@ 2024-01-08 3:50 ` Lulu Cai
0 siblings, 0 replies; 3+ messages in thread
From: Lulu Cai @ 2024-01-08 3:50 UTC (permalink / raw)
To: binutils
Cc: xuchenghua, chenglulu, liuzhensong, mengqinggang, xry111,
i.swmail, maskray, luweining, wanglei, hejinyang, Lulu Cai
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 | 2 +-
.../gas/loongarch/deprecated_reg_aliases.d | 2 +-
gas/testsuite/gas/loongarch/jmp_op.d | 4 ++--
gas/testsuite/gas/loongarch/nop.d | 2 +-
gas/testsuite/gas/loongarch/privilege_op.d | 14 +++++++-------
gas/testsuite/gas/loongarch/reloc.d | 2 +-
opcodes/loongarch-dis.c | 5 ++++-
7 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/gas/testsuite/gas/loongarch/64_pcrel.d b/gas/testsuite/gas/loongarch/64_pcrel.d
index 66b80a397fa..642e3079668 100644
--- a/gas/testsuite/gas/loongarch/64_pcrel.d
+++ b/gas/testsuite/gas/loongarch/64_pcrel.d
@@ -7,5 +7,5 @@
Disassembly of section .text:
00000000.* <.text>:
-[ ]+0:[ ]+03400000[ ]+nop[ ]+
+[ ]+0:[ ]+03400000[ ]+nop
[ ]+0:[ ]+R_LARCH_64_PCREL[ ]+\*ABS\*
diff --git a/gas/testsuite/gas/loongarch/deprecated_reg_aliases.d b/gas/testsuite/gas/loongarch/deprecated_reg_aliases.d
index 3ea0806765f..01e593fbed0 100644
--- a/gas/testsuite/gas/loongarch/deprecated_reg_aliases.d
+++ b/gas/testsuite/gas/loongarch/deprecated_reg_aliases.d
@@ -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
diff --git a/gas/testsuite/gas/loongarch/jmp_op.d b/gas/testsuite/gas/loongarch/jmp_op.d
index cc544f11ca3..21576072aab 100644
--- a/gas/testsuite/gas/loongarch/jmp_op.d
+++ b/gas/testsuite/gas/loongarch/jmp_op.d
@@ -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
diff --git a/gas/testsuite/gas/loongarch/nop.d b/gas/testsuite/gas/loongarch/nop.d
index 222456e8b8c..ca8c56309e9 100644
--- a/gas/testsuite/gas/loongarch/nop.d
+++ b/gas/testsuite/gas/loongarch/nop.d
@@ -7,4 +7,4 @@
Disassembly of section .text:
0+000 <target>:
-[ ]+0:[ ]+03400000[ ]+nop[ ]+
+[ ]+0:[ ]+03400000[ ]+nop
diff --git a/gas/testsuite/gas/loongarch/privilege_op.d b/gas/testsuite/gas/loongarch/privilege_op.d
index 73925f21a37..e9ca60b2b32 100644
--- a/gas/testsuite/gas/loongarch/privilege_op.d
+++ b/gas/testsuite/gas/loongarch/privilege_op.d
@@ -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
diff --git a/gas/testsuite/gas/loongarch/reloc.d b/gas/testsuite/gas/loongarch/reloc.d
index 0458830f30b..fa249c58fd5 100644
--- a/gas/testsuite/gas/loongarch/reloc.d
+++ b/gas/testsuite/gas/loongarch/reloc.d
@@ -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
diff --git a/opcodes/loongarch-dis.c b/opcodes/loongarch-dis.c
index 969ea28f96f..177682e8ff3 100644
--- a/opcodes/loongarch-dis.c
+++ b/opcodes/loongarch-dis.c
@@ -267,7 +267,10 @@ 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[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);
--
2.36.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-01-08 3:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-05 2:00 [PATCH] LoongArch: Discard extra spaces in objdump output Lulu Cai
2024-01-05 7:05 ` WANG Xuerui
2024-01-08 3:50 ` Lulu Cai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).