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: 185192 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp5976931dyb; Thu, 4 Jan 2024 18:01:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IGijOZ25pIgmOEpsRADo6xN1/nYhV2Nom2k+mFv35G+J8GhpZ2lstEr4a9D/nM5aBuyMJAF X-Received: by 2002:ad4:5bea:0:b0:680:5f61:728e with SMTP id k10-20020ad45bea000000b006805f61728emr1404671qvc.90.1704420091040; Thu, 04 Jan 2024 18:01:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704420091; cv=pass; d=google.com; s=arc-20160816; b=ipSS6w7SeA/yy4rTokTY/A2oo0WdRR1oyDp6lfAJ6YQRp+enFuEAlopC62Jmn7K/Ns 4Qn+uVmTVD/SnX91Vjk19n4n0IOLgh0SRUR5VbyQcnskh8wewUsCtq5CZfXx1vOvhPY9 zP4FQRvBid9DyHdpR+xTQjTUxAWg+h1xWAqem5SiXKm/e7pMRSUVftJVtI3GFwgpcTgx WuSZfwPNOz2+bRJNH7H3M5gPyNUUD/DD6RjSZ6RvqP/++p9lNgmAXcUo3bDKEg1iLlck /UmdmckFS1DIKMd6Jnf9VAd/OsslA0JPAEubdDwFch/ywoZlzrFXglJuRJA1D3qjJPqe b0cg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:arc-filter :dmarc-filter:delivered-to; bh=U28RW7HpbkmnnLNIesYYVCr8yYg/6D/j9xeDUXsO9e4=; fh=FvlVQEmCpm5H8oBXQswexzCupeeQXnbssobXN+3R2Wg=; b=gP4Y5ptMzcG9ttRchVHsdyDCwQEIhtS4A/Bjf+ikGzt6pz637umMlLCEkvb/ypfJBb GZ7M2GZAIo7M4J05TU6YgZhx2X8B0uAhFCwMO3epjK9hK3KMgZ8d2cEYXV+DyiU+nqxC LdUW4mFKANNCKrexPfaZoxWLxJ/pVLbANlvJJN57RyCmJ83onGaGlQYIBdlfAJ6k8xiP idhH4q3nyGmvjSR7yqOfsQmPEz6dC2zRoBqWVn6CTF5/lQgcyuHXzTfaz4lesfl+nPvO qv2KinqhhA6ab25ZaAssr37iXXyWzf0fqRCxLo40tgVmfqXjP9C3SaAf0GXxtKEdpuEq XyOA== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id n7-20020a0c8c07000000b0067ab557459fsi779632qvb.305.2024.01.04.18.01.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 18:01:31 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A4951385802F for ; Fri, 5 Jan 2024 02:01:30 +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+ouuuleilei=gmail.com@sourceware.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787214001279268444 X-GMAIL-MSGID: 1787214001279268444 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);