From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id CC9QBaDFZWfRVSUAWB0awg (envelope-from ) for ; Fri, 20 Dec 2024 14:29:36 -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=gmvChXjU; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 12BDC1E097; Fri, 20 Dec 2024 14:29:36 -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=unavailable 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 B97B31E091 for ; Fri, 20 Dec 2024 14:29:35 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 66FAB3858D3C for ; Fri, 20 Dec 2024 19:29:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 66FAB3858D3C 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=gmvChXjU Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by sourceware.org (Postfix) with ESMTPS id 24B963858D38 for ; Fri, 20 Dec 2024 19:27:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 24B963858D38 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 24B963858D38 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::634 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734722835; cv=none; b=ND/IXZaFgfDt64KW0CXYji1uAN/DdOIS12gZ3ro4b64kK1EMDw/4yCeGg3AtjnF1CR9CMgZQ7lSCJGuOa4xKYakXgkHUCZa3PDj2W8b70Z0fmUjCFvfjMa6dIQJoU+0ShOQyA+kRN5WYCHiQjdgNJ/UP8Wx6+LKcYQLomC/Krvg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734722835; c=relaxed/simple; bh=0+/W7aLYAHHm5Qcborj5V2QvFpntt3b98wQrq5arhJg=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=ipQk8c++pBHm+Wo48HzYDEHAZXvbu3YTHiRxC6KFhSM1Kl0r8MTLHAGi4LxxHfkPLuq8IO2N9pisYYE3UlAXLtm9u9otPtucZr1nUyNi7ZD2WVnToEhdvO6uOWUwBZMCmpMgdBNLiONQB1SNb56xxUxq2bHrbOsuuZRepComZNs= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 24B963858D38 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-2163b0c09afso22299165ad.0 for ; Fri, 20 Dec 2024 11:27:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1734722829; x=1735327629; darn=sourceware.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=q19FlH+5pLhzNZ7KhqXu68pRdPVr2TOq0qhdmPF6i+o=; b=gmvChXjU82kLCL/HkU/av15CHxWJjzao+YI9YNTnTtq4Sr7uUphk1yd62D4ulzIZV9 bDkqPeGup/KAVJ6G9nxGjpkDw7tosQqSS00AnXpZVRb0+Kd0r12oihBO91kRSr9L/JYC joTg83WUa/KfpL6Wrxvuk+jfyfb0HWrc7IMfhTGX6+hZj6DvNq2BL2z7jAeVi9pDRw9j 7/rDAyPr23ZLbc1VTS+6BB8FvfImxbsUGaCOEBluH3oVXjgW/Z+61UKm4yVD0MWRMxI9 FrymPGT7loWtAab9pHRlTK8W/wcBSj56UpvGXGTfA3kCREIv0l7JARJ9CZCC/gcOAVrY SlPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734722829; x=1735327629; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=q19FlH+5pLhzNZ7KhqXu68pRdPVr2TOq0qhdmPF6i+o=; b=hv9H/gbbyAW2CXSGXlfq8CCietZdayN8PKCueCflXPvkxljk0dhVLdowfPVjKhdla1 Zd2FlJXdWtC3FZKpis/8zJ2yqW+1ZCnlu+kNGTbxCaNE8E7wCoo5Hd/MAn+z3NLNYUCy W3e1z3/zI/ErNuMpOWgcneK2vjTLxpWNO5FpEJ28WEZQBwzW0RHGsu8n0841DhenOpRX D/+9RTWLmTysyp1I4l0gDWVD/wRhPfQAtPOyyenlRVuZpTgk2DxL+cfaq90FoH35DSqq 30K7tRn8GhHxmi4D4wqWB3ESG+8mLz6tonuWhUg/gBUi+bYr6ip4Qtursk1LFvoliBuC vS3g== X-Forwarded-Encrypted: i=1; AJvYcCXv92Jr8fWduQioCgq6NLPJFIchdrC72i9nXduDb0dmD/G3Ecdu4fUiRq1cWi+rQNqtrsYbDVQIh0Q9lw==@sourceware.org X-Gm-Message-State: AOJu0YzYn2FXK5ZkJRpvnWD9WYh9pFijt3ipYa0H2XmLXQitSPzT/TxF aQQLK9dHO0BOQLuK7720q87Up24MbGDZAsDfylZvpgfwtU/chANaWfeJV6sMfzs= X-Gm-Gg: ASbGnct7UrzTT/XPgaSv99gv6vLQwicDCSYyND/4zaD0H096BMiqftWquD9QK2ZV/5M h4q98NYUqoSLdfEqD13JZClx8HYkBnCrknYPARfymM9mkYeUxLk2yOIqY+QLOwPtQ7V8cm8W5Es WxkYD6t8S6mQxhLFrkLbCKVvE5gYB510BSaTENH2gUOU/7lZ4+NzNPHmO+6N7GCOZmTYmb+0lOH qb9BOpIC5sHIPULQJDZ3m8r3PSgm626fRimVtbP2LM2V/tMgVzu X-Google-Smtp-Source: AGHT+IGUwjq3HjSbSaTf8CHCKo1XxXs7PAbYsUIPcIUdcKAibarzCAN+CNNoogIaY3s5V4hiaoex3w== X-Received: by 2002:a17:90b:2e06:b0:2ea:853b:2761 with SMTP id 98e67ed59e1d1-2f452eeb5d6mr6411561a91.37.1734722828999; Fri, 20 Dec 2024 11:27:08 -0800 (PST) Received: from ghost ([2601:647:6700:64d0:208e:f6e5:4c0b:b6a7]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f363dd7013sm5835550a91.47.2024.12.20.11.27.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2024 11:27:08 -0800 (PST) Date: Fri, 20 Dec 2024 11:27:04 -0800 From: Charlie Jenkins To: Jan Beulich Cc: Nelson Chu , jiawei , gdb-patches , Binutils , Andrew Burgess Subject: Re: [PATCH v2] RISC-V: Fix disassembly of partial instructions Message-ID: References: <20241216-fix_objdump_partial_insn-v2-1-8de88a115dbc@rivosinc.com> <2b869ed1-5969-4ac8-890e-5c82f1877543@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2b869ed1-5969-4ac8-890e-5c82f1877543@suse.com> 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 On Fri, Dec 20, 2024 at 11:38:01AM +0100, Jan Beulich wrote: > On 19.12.2024 18:37, Nelson Chu wrote: > > Some minor GNU coding styles as follows. Also cc Jan and Andrew, hope they > > still have time in their busy schedules can help to see if there are some > > side effects. > > I did actually take a look, but then pretty quickly decided I must be missing > something: There's no disassembly of anything here afaics, and I also can't > see how a partial insn could be disassembled in the first place. Such can > only ever be displayed as raw hex data, I think. And that's what the patch I think this is just an issue with my terminology. I was referring to raw hex data as the "disassembly". Should the title say "raw hex data" instead of "disassembly"? I was thinking that "disassembly" included any instruction data that was being output from objdump. > appears to be doing, just that it's description says otherwise. That plus the > lack of a testcase demonstrating the intended behavior made me simply stop > any effort here. I should have posted a minimal test case. The test case I was using was the linux perf test case that I posted. Here is a better example where I have the output on binutils 2.40, 2.41, and with this patch. As a summary, on 2.40 the hex of the instruction is shown even if the full instruction can't be dumped. On 2.41 it errors with "Address is out of bounds." in this case. With this patch, it reverts to the 2.40 behavior of showing the hex, but also encodes the partial instruction using assembler directives instead of printing the "out of bounds" error. $ cat objdump.s c.lw a0, 0(a0) .option push .option norvc nop .option pop $ riscv64-linux-gnu-gcc -c objdump.s Example 2.40: $ ./objdump-2.40 --start-address 0 --stop-address 4 -d -z objdump.o objdump.o: file format elf64-littleriscv Disassembly of section .text: 0000000000000000 <.text>: 0: 4108 lw a0,0(a0) 2: 13 00 Address 0x2 is out of bounds. Example 2.41 $ ./objdump-2.41 --start-address 0 --stop-address 4 -d -z objdump.o objdump.o: file format elf64-littleriscv Disassembly of section .text: 0000000000000000 <.text>: 0: 4108 lw a0,0(a0) 2: Address 0x2 is out of bounds. Example with this patch: $ ./binutils/objdump --start-address 0 --stop-address 4 -d -z objdump.o [11:20:54] objdump.o: file format elf64-littleriscv Disassembly of section .text: 0000000000000000 <.text>: 0: 4108 lw a0,0(a0) 2: 0013 .short 0x0013 The difference here being that "Address
is out of bounds" is replaced by the raw hex data. > > Jan