From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id aHzLIjVTtWdC6DUAWB0awg (envelope-from ) for ; Tue, 18 Feb 2025 22:42:45 -0500 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=zFbdWUAM; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 8B9A51E105; Tue, 18 Feb 2025 22:42:45 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.0 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 39B561E08E for ; Tue, 18 Feb 2025 22:42:45 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E0AE63858410 for ; Wed, 19 Feb 2025 03:42:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E0AE63858410 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=zFbdWUAM Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by sourceware.org (Postfix) with ESMTPS id 9BF373858C50 for ; Wed, 19 Feb 2025 03:35:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9BF373858C50 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9BF373858C50 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::1030 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1739936133; cv=none; b=G6dobBm778z90kQmXPHZ02unxJXmT7U4TVk/IhPu5SU4NFH1YOPVM/3DrG5LWcNZK8yP2uNtpNpE9QasQg2WHYUcqmW2oo8ed/1h4Rt+JgQ8MKjbuHqFjg+RVHZTPBnpL9CaAowgS/90OvyWsSbbi889Vbz2mFNWnbHzDejqnd0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1739936133; c=relaxed/simple; bh=Dh9uiUCDmb0octbnKZmqN3PsoSThQGr8TV3t5sM4YWU=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=olvbqLiF7pGRL4XAelUirqLX9xqlQnc43+0H0Eds9sp0QnnpJUBInxrr13OCCAnTpI349L+Ko2bkhciYSzom/0GcCfkCz0F3D/Ig6QSnf//7KJM7UdvgfnllHZRnSuRuFIoR1+bDu/wi+A6mju/OVht520hcTmbmmEDrvPSGNco= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9BF373858C50 Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-2fc3027c7aeso8709794a91.0 for ; Tue, 18 Feb 2025 19:35:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1739936132; x=1740540932; darn=sourceware.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=S3niuF02z227iNbEe3Ni/6TyK0mcxXXGgAfxgmuGtP0=; b=zFbdWUAMlGBMTXS8j7KvKCStc66K1kIpyiMv3YDmuuMh1ZLxcmbbJZOwenwpMXkXwd kL86bnAn0zRz6P12wnTMF5alexCev7yqJJKV7ZaI8qphbaHvDaVU2ciOPiCJv9eQQtZi DCzkRNI6ICJJiC9omPnKtgMKByfPrUr7qJlsqOXFHw/vcTmI8M/lEEOAUhSeJdBI0k6n RhBggqfh86eiwIv2HjPXoeKUn4pGSth8UIg85MXg7QLsvp23Wxy9wvWP6T2esb1/70Oq TdHK6DveBVrvbKOVGK3AYNAzJTfs5+eiQiFv/rS0HBfbGUfgOxhO7MB45y/3nq2aG42o sGhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739936132; x=1740540932; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=S3niuF02z227iNbEe3Ni/6TyK0mcxXXGgAfxgmuGtP0=; b=ROosHkJEMfHWvKDy8CpxYElyVWzwkn/ejSFAuosdnUyLo7VEs/MikUBqWpLsTiVpKG fHSXmdZS48wZQ6nKfTe0XOX3M3J1meqs/vesDwawy6rbboMOvzIhvgli5VS4iGdiGV7a pLhTKx7a1c34mdSLCsFCFdlZM7e0zb+qL8m7UG/yJpeK+VtzM8ykB+OPUDmS0D4SvSs8 41+m6KZT3oXTiecxcqS7UWk1QLiV8CcW0EfEY/jTUxoucNufNTHS3dsfy/0BgTk9gAKW /HOx73RCk9RKij+GxYGEINaCed7wnZTOPm8eQjmnYyzU3XVGS9bKM6BoRYwTo/PeqVwL gsFA== X-Gm-Message-State: AOJu0YwytH6goHNOfelA0TanI2O3G1+bLESJk/MJm1ZrQveHforiB3Zs PvQpKVNZuRLRK7coSjNLuNSgyafVXhaLjhbZVviqKNUah+2zhMaqtJ1wQKBnwGw= X-Gm-Gg: ASbGnculbqSCSxbnxMfpTsV7UjIXM9DaySe5HG98AyEwHf2UfHDU99QI4nXWWZlHqHG oKibndUEIozXcZILShDJHJEQazqKxAsQdZsVVXVKHBm4sK7Wg/y8SxNJHykhYl7hP+Ws6dOevBR R9Exx3gRxvvBV/XlWRj/DQ0hfbVeWCdTKuC3szzC2rp+tpebd/COwHTjJ7MxNgh7eORxM7S8mPV xeLUB+cA5yCzKAMcxVU3CfpEPvR5c8/yowJVek9ZdQHS/Bc4OHp5Ov8Cok1wuzy888gn7cBVjUG PMMnoyD5VQ9IRQwFLRLONczd1yMD2YU= X-Google-Smtp-Source: AGHT+IG5PGIDzwkMqi2V8SlwdxAof923E/MKfJ76tPcFF7sZMXIT2tWcmZWH2OS7e4jeRadvyQWo9g== X-Received: by 2002:a05:6a00:2d0b:b0:72a:9ddf:55ab with SMTP id d2e1a72fcca58-732617b5545mr22796563b3a.10.1739936132589; Tue, 18 Feb 2025 19:35:32 -0800 (PST) Received: from charlie.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-73292308e2asm2220065b3a.136.2025.02.18.19.35.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Feb 2025 19:35:31 -0800 (PST) From: Charlie Jenkins Date: Tue, 18 Feb 2025 19:35:21 -0800 Subject: [PATCH v2 1/2] RISC-V: Fix abort when displaying .dword MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20250218-fix_gas_abort-v2-1-14457aa7387e@rivosinc.com> References: <20250218-fix_gas_abort-v2-0-14457aa7387e@rivosinc.com> In-Reply-To: <20250218-fix_gas_abort-v2-0-14457aa7387e@rivosinc.com> To: jiawei , Nelson Chu , Charlie Jenkins , Jan Beulich , Andrew Burgess Cc: gdb-patches , Binutils X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2133; i=charlie@rivosinc.com; h=from:subject:message-id; bh=Dh9uiUCDmb0octbnKZmqN3PsoSThQGr8TV3t5sM4YWU=; b=owGbwMvMwCXWx5hUnlvL8Y3xtFoSQ/rWwMbAUl8WtdrqmQVs/4JvvK3mC3zluXt/a5XEw6+Pr WatC9/WUcrCIMbFICumyMJzrYG59Y5+2VHRsgkwc1iZQIYwcHEKwETMWhkZtm9tiNrA/9Rvb3y3 otHJTbxlBTcOtim0SXy+rCCi8iLRmJFh9ZdtXCttzQ7kb/9+Y+nEwKUHbfZ4uz1ON7So2PfSRWE yGwA= X-Developer-Key: i=charlie@rivosinc.com; a=openpgp; fpr=7D834FF11B1D8387E61C776FFB10D1F27D6B1354 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org In the normal case an instruction won't be split into 5, 6, or 7 byte sections. However a .dword disassembled with -D can cause an instruction to split across the 6 byte boundary. 6 byte instructions were not supported so riscv_disassemble_data() would abort. If data is encountered that is not a power of two, dump all of the data with a .byte directive. Signed-off-by: Charlie Jenkins Fixes: 6a04e8230707 ("RISC-V: Fix display of partial instructions") --- opcodes/riscv-dis.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c index 3956f588f8f749935b23e6a4dc4fab95ef66d013..d02723ed38ff368e9ce0a48e49d8f87820551a50 100644 --- a/opcodes/riscv-dis.c +++ b/opcodes/riscv-dis.c @@ -1317,14 +1317,6 @@ riscv_disassemble_data (bfd_vma memaddr ATTRIBUTE_UNUSED, (*info->fprintf_styled_func) (info->stream, dis_style_immediate, "0x%04x", (unsigned) data); break; - case 3: - info->bytes_per_line = 7; - (*info->fprintf_styled_func) - (info->stream, dis_style_assembler_directive, ".word"); - (*info->fprintf_styled_func) (info->stream, dis_style_text, "\t"); - (*info->fprintf_styled_func) - (info->stream, dis_style_immediate, "0x%06x", (unsigned) data); - break; case 4: info->bytes_per_line = 8; (*info->fprintf_styled_func) @@ -1344,7 +1336,16 @@ riscv_disassemble_data (bfd_vma memaddr ATTRIBUTE_UNUSED, (unsigned long long) data); break; default: - abort (); + /* Arbitrary data so just print the bits in the shape of an .byte + directive. */ + info->bytes_per_line = info->bytes_per_chunk; + (*info->fprintf_styled_func) + (info->stream, dis_style_assembler_directive, ".%dbyte", info->bytes_per_chunk); + (*info->fprintf_styled_func) (info->stream, dis_style_text, "\t"); + (*info->fprintf_styled_func) + (info->stream, dis_style_immediate, "0x%0llx", + (unsigned long long) data); + break; } return info->bytes_per_chunk; } -- 2.43.0