From patchwork Thu Jun 29 16:35:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: WANG Xuerui X-Patchwork-Id: 114360 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp9765401vqr; Thu, 29 Jun 2023 09:37:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4/gydKZAGvJbNwNsIm+2cybEnBDfGz2v6bhTgUCJmldpGFpPMOp80BqYvaA9/kxR2h16+j X-Received: by 2002:a17:907:3688:b0:96a:2acf:61e1 with SMTP id bi8-20020a170907368800b0096a2acf61e1mr34702365ejc.64.1688056625002; Thu, 29 Jun 2023 09:37:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688056624; cv=none; d=google.com; s=arc-20160816; b=wYyydu3GP31KBy53zlTQXCna5ZU8qFWe5Q8TYujfFMAvB6tisfTyHm3Ze6rLJa9vx8 o56noB1YQ6aN3+SDDyBrkClDPUQ9MOQbpa+UM74VgUEHTeidWQDwfvDiaVyazhI9tKq4 SBlOLs7kKYjohmvnP3EGh+gtU3RhpGXiGavOyxv6JnNHv1lpMtoJ7r5gUhqfzHvDazu9 53Jcap/Lkj3hsPIcvVHLfdBvrya3/vyxQSvPWTyuUEeC6GX6/ehCh7qQhtkffN75Lw1y 37ZR6v9GlLdLzQDkumu2+RnV+ESjol07YH8gQLJrr6n7kXZlzhuBOKO2KpycWAh5pqcn lBVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:dmarc-filter:delivered-to; bh=aNeVRNN3vQAOTuRFxF3vp/a4evOG8B4tsRWfBquF75Y=; fh=F52lMKP/ag7PTpjpGsg79bnedhkoffS1BBUct4g/1x0=; b=AfcxGil4YxxcnY6rbwhhGzLe8SdZ/AaG3eewHsmCLxU0ErOaLy+QB1Mw7lDlX7gz4S Faj3SixCtL1NSPCQlgdok89yMW0zbO43vkL59xZqNezaTyjE+TVWD3upPaqNby5+xsqV aoZkKG6ZtviEU4K4N+2N43Qbx2gAyyaOOC1JKThKIEcAfqqaNACycEP6LANpVtpywhxE TJdhKJlsUn748ly0rZurtw0ANv6+s5ti/4u+AGcApvuYsGlp3FXryxeYmC9EHgohC/2Q 95prKTMNO7DwpDl0SX3bu97AaIcr3iq1AYgq2jw177QklPzC0YBqmkbvs89+FsSlpy89 uyiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xen0n.name header.s=mail header.b=eUyc2+Tf; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id ox27-20020a170907101b00b00988883b37b4si6838220ejb.882.2023.06.29.09.37.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jun 2023 09:37:04 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@xen0n.name header.s=mail header.b=eUyc2+Tf; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c 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 224463854831 for ; Thu, 29 Jun 2023 16:36:09 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mailbox.box.xen0n.name (mail.xen0n.name [115.28.160.31]) by sourceware.org (Postfix) with ESMTPS id 58DEC3858C41 for ; Thu, 29 Jun 2023 16:35:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 58DEC3858C41 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=xen0n.name Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=xen0n.name DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xen0n.name; s=mail; t=1688056520; bh=I4OTJj2Y0ZTuoH2Oc44JERMGXd0uhTQf0EtkzCG2qFc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eUyc2+TfkznMXOi+rsR6igWfQ12XYYMHtCgyLOQaqXJij2B3IbP1nEPVMBNx2kshN wF7XLjSREVGSo6QEHkuMjDXtLnZ5UvuW8C2POqiRISw2yadg71kUyOsF5QhL94+kKj bQkiI3/t6yMINmmlMWNGA1fdhylow82fLsgC0Jhk= Received: from ld50.lan (unknown [101.88.25.181]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mailbox.box.xen0n.name (Postfix) with ESMTPSA id 2401060148; Fri, 30 Jun 2023 00:35:20 +0800 (CST) From: WANG Xuerui To: binutils@sourceware.org Cc: Chenghua Xu , Zhensong Liu , Qinggang Meng , Lulu Cheng , Fangrui Song , Xi Ruoyao , WANG Xuerui Subject: [PATCH v7 6/7] opcodes/loongarch: print unrecognized insn words with the .word directive Date: Fri, 30 Jun 2023 00:35:03 +0800 Message-Id: <20230629163504.1331025-7-i.swmail@xen0n.name> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230629163504.1331025-1-i.swmail@xen0n.name> References: <20230629163504.1331025-1-i.swmail@xen0n.name> MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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.29 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 Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770055663479767563?= X-GMAIL-MSGID: =?utf-8?q?1770055663479767563?= From: WANG Xuerui For better round-trip fidelity and readability in general. gas/ChangeLog: * testsuite/gas/loongarch/uleb128.d: Update test case. * testsuite/gas/loongarch/raw-insn.d: New test. * testsuite/gas/loongarch/raw-insn.s: Likewise. opcodes/ChangeLog: * loongarch-dis.c (disassemble_one): Print ".word" if !opc. Signed-off-by: WANG Xuerui --- gas/testsuite/gas/loongarch/raw-insn.d | 11 +++++++++++ gas/testsuite/gas/loongarch/raw-insn.s | 7 +++++++ gas/testsuite/gas/loongarch/uleb128.d | 20 ++++++++++---------- opcodes/loongarch-dis.c | 1 + 4 files changed, 29 insertions(+), 10 deletions(-) create mode 100644 gas/testsuite/gas/loongarch/raw-insn.d create mode 100644 gas/testsuite/gas/loongarch/raw-insn.s diff --git a/gas/testsuite/gas/loongarch/raw-insn.d b/gas/testsuite/gas/loongarch/raw-insn.d new file mode 100644 index 00000000000..64980e47f7b --- /dev/null +++ b/gas/testsuite/gas/loongarch/raw-insn.d @@ -0,0 +1,11 @@ +#as: +#objdump: -dr + +.*:[ ]+file format .* + + +Disassembly of section .text: + +0+000 : +[ ]+0:[ ]+00000000[ ]+.word[ ]+0x00000000 +[ ]+4:[ ]+feedf00d[ ]+.word[ ]+0xfeedf00d diff --git a/gas/testsuite/gas/loongarch/raw-insn.s b/gas/testsuite/gas/loongarch/raw-insn.s new file mode 100644 index 00000000000..528b15263ae --- /dev/null +++ b/gas/testsuite/gas/loongarch/raw-insn.s @@ -0,0 +1,7 @@ +target: + .word 0 + # Given how the LoongArch encoding space is apparently centrally- + # managed and sequentially allocated in chunks of prefixes, it is + # highly unlikely this would become a valid LoongArch instruction in + # the foreseeable future. + .word 0xfeedf00d diff --git a/gas/testsuite/gas/loongarch/uleb128.d b/gas/testsuite/gas/loongarch/uleb128.d index df66587b692..ad67ded9e7d 100644 --- a/gas/testsuite/gas/loongarch/uleb128.d +++ b/gas/testsuite/gas/loongarch/uleb128.d @@ -8,29 +8,29 @@ Disassembly of section .data: 00000000.* : -[ ]+0:[ ]+80030201[ ]+0x80030201 +[ ]+0:[ ]+80030201[ ]+\.word[ ]+0x80030201 [ ]+3:[ ]+R_LARCH_ADD_ULEB128[ ]+L2 [ ]+3:[ ]+R_LARCH_SUB_ULEB128[ ]+L1 [ ]+\.\.\. 0000000000000005[ ]+: [ ]+\.\.\. -[ ]+81:[ ]+ff040000[ ]+0xff040000 +[ ]+81:[ ]+ff040000[ ]+\.word[ ]+0xff040000 [ ]+85:[ ]+cacop[ ]+0x1f,[ ]+\$t3,[ ]+1 0000000000000086[ ]+: -[ ]+86:[ ]+07060005[ ]+0x07060005 -[ ]+8a:[ ]+0x00008080 +[ ]+86:[ ]+07060005[ ]+\.word[ ]+0x07060005 +[ ]+8a:[ ]+\.word[ ]+0x00008080 [ ]+8a:[ ]+R_LARCH_ADD_ULEB128[ ]+L4 [ ]+8a:[ ]+R_LARCH_SUB_ULEB128[ ]+L3 000000000000008d[ ]+: [ ]+\.\.\. -[ ]+4089:[ ]+ff080000[ ]+0xff080000 -[ ]+408d:[ ]+0x09ffffff +[ ]+4089:[ ]+ff080000[ ]+\.word[ ]+0xff080000 +[ ]+408d:[ ]+\.word[ ]+0x09ffffff 0000000000004090[ ]+: -[ ]+4090:[ ]+09090909[ ]+0x09090909 -[ ]+4094:[ ]+09090909[ ]+0x09090909 -[ ]+4098:[ ]+09090909[ ]+0x09090909 -[ ]+409c:[ ]+09090909[ ]+0x09090909 +[ ]+4090:[ ]+09090909[ ]+\.word[ ]+0x09090909 +[ ]+4094:[ ]+09090909[ ]+\.word[ ]+0x09090909 +[ ]+4098:[ ]+09090909[ ]+\.word[ ]+0x09090909 +[ ]+409c:[ ]+09090909[ ]+\.word[ ]+0x09090909 diff --git a/opcodes/loongarch-dis.c b/opcodes/loongarch-dis.c index c45c4fc617c..8d72519be9f 100644 --- a/opcodes/loongarch-dis.c +++ b/opcodes/loongarch-dis.c @@ -259,6 +259,7 @@ disassemble_one (insn_t insn, struct disassemble_info *info) if (!opc) { info->insn_type = dis_noninsn; + info->fprintf_styled_func (info->stream, dis_style_assembler_directive, ".word\t\t"); info->fprintf_styled_func (info->stream, dis_style_immediate, "0x%08x", insn); return; }