From patchwork Wed Jun 28 11:50:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: WANG Xuerui X-Patchwork-Id: 11385 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp8860507vqr; Wed, 28 Jun 2023 04:51:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5FsB15ynyBoMVctw4gukjBx9JG5PkoNqe3zUg5FghV5DYRvB2qaA1EtqspMML5tXdMy63f X-Received: by 2002:a2e:91ce:0:b0:2b6:b66c:921 with SMTP id u14-20020a2e91ce000000b002b6b66c0921mr3000822ljg.11.1687953089393; Wed, 28 Jun 2023 04:51:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687953089; cv=none; d=google.com; s=arc-20160816; b=YdzhgWw3Mi/r9XbNis727yKnlMWkahonGg/CSKA5QoQO4ipomMTxFr2lcugzBI0g6b 23rjC/K2UsU1NjvZ2Keec10IV8kflsCLav3gzHfbJ4TeIMF44fRuodQw1ISzn5yCi7HA CNfvirfweQgBxEKRgJ9/64ECJ4z9US78TLgx4S6mqgUspUYz9Pj4QPgQlhs1DJq5hzDt QIgPzlCZ+UEq1SCWH/REE25Jn6u/cMavHfBAhVx5XiFNwL8KGc6YnM9700u2rY9ilE0k dDQ/3WWaZzijO4Vj8JSlxCyV0OUJs/S+wf+sDpXF9dlF14WcWZz/t/3JShazkwm7LkNf HCMA== 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:message-id:date:subject:cc:to:from:dkim-signature :dmarc-filter:delivered-to; bh=mqVdm4jCiHUZrpduOvnIzmd5CnSnj3Ky4CkSPvaiM8s=; fh=F52lMKP/ag7PTpjpGsg79bnedhkoffS1BBUct4g/1x0=; b=hQmnC9cm5w8/XOZycboQITOeBmgnqX9sIMou4vf2zlHfonfqVsl28EUSzjA4ca5yAh ypB5hxW5l8b//A8ZlRamV81ljhelQ1n0JfHfMQXgqf2y5dLtW/4vxZd6e6/I3W9V04++ 9mhvFJN2psCpPM1DR9IB5it0mVm6LG5FC+8tNiv6K7M8oDwr1G1by/hn+uZcY5YFmg7s H2yWNK3HLRTBU3jV8laxMkYQSojdYKkHqtNzBskzIvImeXKDoNRM1QivQ0iMLCScOvfp M15USkOjdSKuMtexXUbxIi/1RQDNlk7YXIpfsoct1kRkHmQ7XzzyzQE7Vzk9A1fmz/18 aO0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xen0n.name header.s=mail header.b=oEBlh7Wp; 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 p20-20020a170906839400b00991df467bafsi3037670ejx.617.2023.06.28.04.51.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 04:51:29 -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=oEBlh7Wp; 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 8FEC93858C36 for ; Wed, 28 Jun 2023 11:51:27 +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 C89EE3858D35 for ; Wed, 28 Jun 2023 11:51:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C89EE3858D35 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=1687953077; bh=QTi0mbVyJrstbc9IaRzpLNF3MbX/oxdm1YzcMGKqYKM=; h=From:To:Cc:Subject:Date:From; b=oEBlh7WpXlKbpcBkbX1e448X4B0aW231ZBxUIfGsFLmE2po9UBr676XlfxQk1PJt2 ptFXimM07YX3pK+Fc7+P/3ZfoM3xGskwdSkA4TLUpHP8xeNrbEr4J/RKpRJQYYFyfo rCN/U5nzDGFhc2LkyYe0fBC1oyWumStJorLyiYP8= 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 E764160112; Wed, 28 Jun 2023 19:51:16 +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 v5 0/6] LoongArch: colored disassembly and readability tweaks Date: Wed, 28 Jun 2023 19:50:57 +0800 Message-Id: <20230628115103.3440262-1-i.swmail@xen0n.name> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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?1769947098661290322?= X-GMAIL-MSGID: =?utf-8?q?1769947098661290322?= From: WANG Xuerui Hi, This series implements colored output for LoongArch disassembly, and some minor tweaks to the output so there is less clutter. The 4th revision was sent back in February but at that time the Loongson maintainers were busy with linker relaxation support; now that the work was done let's try upstreaming this series again, hopefully for inclusion in binutils 2.41. Changes from v4: - Rebased (mainly test case changes) Changes from v3: - Fixed ld test cases (make check-gas and make check-ld both pass on x86_64 and loongarch64) - Branch target address is now correctly printed in comment style, plus code simplification as suggested Changes from v2: - Fixed test cases - Added the fixed "LoongArch: support disassembling certain pseudo- instructions" patch into this series - Fixed ".insn" in the last patch to say ".word" instead (MIPS muscle memory strikes back hard) - Fixed some commit messages - Added mengqinggang to Cc list WANG Xuerui (6): LoongArch: support disassembling certain pseudo-instructions opcodes/loongarch: remove unused code opcodes/loongarch: implement style support in the disassembler opcodes/loongarch: style disassembled address offsets as such opcodes/loongarch: do not print hex notation for signed immediates opcodes/loongarch: print unrecognized insn words with the .word directive gas/config/tc-loongarch.c | 3 +- gas/testsuite/gas/loongarch/imm_ins.d | 84 ++++++------- gas/testsuite/gas/loongarch/imm_ins_32.d | 54 ++++----- gas/testsuite/gas/loongarch/imm_op.d | 44 +++---- gas/testsuite/gas/loongarch/jmp_op.d | 44 +++---- gas/testsuite/gas/loongarch/li.d | 8 +- gas/testsuite/gas/loongarch/load_store_op.d | 80 ++++++------ gas/testsuite/gas/loongarch/macro_op.d | 4 +- gas/testsuite/gas/loongarch/macro_op_32.d | 4 +- .../gas/loongarch/macro_op_large_abs.d | 12 +- .../gas/loongarch/macro_op_large_pc.d | 12 +- gas/testsuite/gas/loongarch/nop.d | 2 +- gas/testsuite/gas/loongarch/privilege_op.d | 8 +- gas/testsuite/gas/loongarch/raw-insn.d | 11 ++ gas/testsuite/gas/loongarch/raw-insn.s | 7 ++ gas/testsuite/gas/loongarch/reloc.d | 2 +- gas/testsuite/gas/loongarch/uleb128.d | 2 +- include/opcode/loongarch.h | 7 +- ld/testsuite/ld-loongarch-elf/jmp_op.d | 40 +++--- ld/testsuite/ld-loongarch-elf/macro_op.d | 24 ++-- ld/testsuite/ld-loongarch-elf/macro_op_32.d | 4 +- opcodes/disassemble.c | 5 + opcodes/loongarch-dis.c | 114 ++++++++---------- opcodes/loongarch-opc.c | 73 ++++++----- 24 files changed, 334 insertions(+), 314 deletions(-) create mode 100644 gas/testsuite/gas/loongarch/raw-insn.d create mode 100644 gas/testsuite/gas/loongarch/raw-insn.s