From patchwork Fri Jan 5 02:00:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lulu Cai X-Patchwork-Id: 83343 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 28C613858D32 for ; Fri, 5 Jan 2024 02:01:49 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id B6A843858D32 for ; Fri, 5 Jan 2024 02:01:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B6A843858D32 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B6A843858D32 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704420079; cv=none; b=sG/DSrH15Le6pvfE+mVFAMycMy8+OXxkYb9JIqw+IyGND6+ps5LKocAi+IIwY2uuSayZ4fcaoTODhO01fLTS2x7WWLJBIE2m0zuGiwOS+Q4rJlCY7M40OaTRFrUar3joUXpZS5gS7TwAa9Ne4EMkcZzSLzx9W/h0CJ9T4d+ZqKA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704420079; c=relaxed/simple; bh=BS9Xu+CATFq+9JqDeyS4drg/Zj33s6m/gQR7gxKGMrg=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=n4dwJCPA/49Uk0zQR34R8oFtzFHf2zmICuSWiivdBXYMnl+KVQz6Jed34Mlpm8bDIDEKA+V+20qIJHczaqZZGWzPF4GerGTUf/qrKdy23v5xAq69Jp0FKUfLivi11SLzJ9/9sSwqfW+9QSuAXirxylHWbpYv9aJ1RhDJUuXAq7E= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from loongson.cn (unknown [10.2.6.5]) by gateway (Coremail) with SMTP id _____8Dx++rpYpdllCUCAA--.7997S3; Fri, 05 Jan 2024 10:01:13 +0800 (CST) Received: from 5.5.5 (unknown [10.2.6.5]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxPN7oYpdls6oCAA--.6994S4; Fri, 05 Jan 2024 10:01:12 +0800 (CST) From: Lulu Cai To: binutils@sourceware.org Cc: xuchenghua@loongson.cn, chenglulu@loongson.cn, liuzhensong@loongson.cn, mengqinggang@loongson.cn, xry111@xry111.site, i.swmail@xen0n.name, maskray@google.com, luweining@loongson.cn, wanglei@loongson.cn, hejinyang@loongson.cn, Lulu Cai Subject: [PATCH] LoongArch: Discard extra spaces in objdump output Date: Fri, 5 Jan 2024 10:00:44 +0800 Message-Id: <20240105020044.2973378-1-cailulu@loongson.cn> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8BxPN7oYpdls6oCAA--.6994S4 X-CM-SenderInfo: xfdlz3tox6z05rqj20fqof0/1tbiAQAHB2WXVSgCpAABsp X-Coremail-Antispam: 1Uk129KBj93XoWxtrWfKFWDtrWxZF1kXFyDXFc_yoW7Xw1Dpa 4Svrs0krZYkFn7Wr1DK345XF1xXw4xCr4a9a1ftryIkr1xXryxA3W8trZxZF45G3yYyw1S qrs8Zw1rZFnYk3XCm3ZEXasCq-sJn29KB7ZKAUJUUUUr529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUvEb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8JVWxJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_ Gr0_Gr1UM2kKe7AKxVWUXVWUAwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07AIYI kI8VC2zVCFFI0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUXVWU AwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI4 8JMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMxCIbckI1I0E14v26r1Y 6r17MI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7 AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE 2Ix0cI8IcVCY1x0267AKxVWUJVW8JwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcV C2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVWUJVW8JbIYCTnIWIevJa73 UjIFyTuYvjxU2MKZDUUUU X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org 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 : -[ ]+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);