Message ID | 6efd2f1eab5550461e715c007272a3120ebd3dc8.1721751185.git.aburgess@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <binutils-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E69D5386480F for <patchwork@sourceware.org>; Tue, 23 Jul 2024 16:13:55 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id CCF063860757 for <binutils@sourceware.org>; Tue, 23 Jul 2024 16:13:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CCF063860757 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CCF063860757 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721751213; cv=none; b=HKItP/yeMb8jXiZgNvd/9yy7qp6yGfRC5/V5RLp+N+ng34qOnh3ZEpIe8iha/FKTcotV2mU88/hM9Rza27VTQN5e9gQPrH67q/qFzXmWiYz3JhQHL3HZIHjVqXV3EdvyUIdcxil33HkfBBfMQShJUo/PYTE8RLPrDK/ND4gYhyM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721751213; c=relaxed/simple; bh=iYnyYZz6cYDw1s3KJZodxQX/hHBXqh7zVurVwzOxju0=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=DJL4QEYb67i5MeVWsca+VayG9hLHAJJW5RITbFehfLDQgs59+YcXyQQgbohJFWvtUEbOo5edZOkq06Ob5jq2/PBjZCd1km4K9CHVOHdOvlWXA96kWjHr7IT1+55rRJxR0h7vO9zfJH4xN4K6Cy4KBjj+mmzLDvAijiQ9I3xfvOM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1721751211; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vgosWK+/gUvKzqoHAYfHqfGdLjLk6UBRTkgCebDaxpw=; b=HOJiKb0o7ZEMJqrntUhavnXrCP5bxpjovINwiBCp5GKQQnQz/9ksHtBXeWDVGCOJ//tuHK qE4A5PiO3YGH9PwYYGtPQ5+0IvgPCVkH55tKNmEUWBJWnNn+6xV+Gwps67P4y64NtE7DBe W0VN+4rPr7VUdkXFyli5I3ogHrg6YpE= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-540-OR8BW7tINwqlE6ozS2zlqQ-1; Tue, 23 Jul 2024 12:13:30 -0400 X-MC-Unique: OR8BW7tINwqlE6ozS2zlqQ-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-36835daf8b7so4258280f8f.2 for <binutils@sourceware.org>; Tue, 23 Jul 2024 09:13:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721751208; x=1722356008; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vgosWK+/gUvKzqoHAYfHqfGdLjLk6UBRTkgCebDaxpw=; b=T259m82Wnab62XO7S20gS0c3resvyw9N9usUjPRY0ohen44J2vgXJGXEYG+nzBaXHL +tjXC0CwwVvakK4FcduJ9tNTvtN0bOppMfxp5DHMnOeDuLXcsIECNWC9so0meAtmR4ok pB6sB/TCHwrTQzfzgX5MW/280LXW79iTWqJn1E2v5GbINe67M7b1zQeGEYX0t+gh1bmK FkzIgdxAQZhAsujd9quYUsw8UIkknRnVb/GBpDHEGXC7aA/ndNXA2eLzpgiB3jVM3Zqi x9z/jOfwYK9YkboTYEuz8HI5JaIXYNsH/TCynOW6KRoKiJ8y4mON8hjJLtRcQ9O67l/q bXjw== X-Gm-Message-State: AOJu0Yywrb+ORil8CJXQCBz9KRuy9nILMufjBDlKxfTfZoawOkFhdCw1 IdsRYiPwaK67RPS2KDs+18O7kMvrjHSGqOoWWBOjU9JN3UXzaAOAoAo3AtoEIHDJyg+B+tUVDpU jujP7j1PMLdyHh+P/613wOYTzjmrV6yofj4SO9Bl8+cXkfOD6PwLj6i4YTQLbDI7GijWN8nQtP2 l18FbBdNh2h9SSRKwh9HWeXRhBvCKrhfbh9SoIvFc= X-Received: by 2002:a05:6000:194c:b0:368:37dd:c2b1 with SMTP id ffacd0b85a97d-369f09e2705mr202656f8f.36.1721751208514; Tue, 23 Jul 2024 09:13:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF23tUCUHTnrkSxV5Jj0UOfi3jes6CejyTj+9AqFB8BddvYAxxIgWeOEfQlEv4ATuU+IDm5vg== X-Received: by 2002:a05:6000:194c:b0:368:37dd:c2b1 with SMTP id ffacd0b85a97d-369f09e2705mr202629f8f.36.1721751208000; Tue, 23 Jul 2024 09:13:28 -0700 (PDT) Received: from localhost ([31.111.84.186]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427d2a3b763sm208032965e9.10.2024.07.23.09.13.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jul 2024 09:13:27 -0700 (PDT) From: Andrew Burgess <aburgess@redhat.com> To: binutils@sourceware.org Cc: Andrew Burgess <aburgess@redhat.com> Subject: [PATCH] opcodes/x86: fix minor missed styling case Date: Tue, 23 Jul 2024 17:13:23 +0100 Message-Id: <6efd2f1eab5550461e715c007272a3120ebd3dc8.1721751185.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP 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 <binutils.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/binutils>, <mailto:binutils-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/binutils/> List-Post: <mailto:binutils@sourceware.org> List-Help: <mailto:binutils-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/binutils>, <mailto:binutils-request@sourceware.org?subject=subscribe> Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org |
Series |
opcodes/x86: fix minor missed styling case
|
|
Checks
Context | Check | Description |
---|---|---|
linaro-tcwg-bot/tcwg_binutils_build--master-arm | success | Build passed |
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 | success | Build passed |
linaro-tcwg-bot/tcwg_binutils_check--master-arm | fail | Patch failed to apply |
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 | fail | Patch failed to apply |
Commit Message
Andrew Burgess
July 23, 2024, 4:13 p.m. UTC
I noticed that the x86 instruction: sar $0x1,%rsi would fail to style the '$0x1' as an immediate. This commit fixes that case. --- opcodes/i386-dis.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) base-commit: 40578beee8a593e3668852238fd8e9f53790f2c9
Comments
> -----Original Message----- > From: Andrew Burgess <aburgess@redhat.com> > Sent: Wednesday, July 24, 2024 12:13 AM > To: binutils@sourceware.org > Cc: Andrew Burgess <aburgess@redhat.com> > Subject: [PATCH] opcodes/x86: fix minor missed styling case > > I noticed that the x86 instruction: > > sar $0x1,%rsi > > would fail to style the '$0x1' as an immediate. This commit fixes that case. > --- > opcodes/i386-dis.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c index > bc141f31770..d44fee33eb5 100644 > --- a/opcodes/i386-dis.c > +++ b/opcodes/i386-dis.c > @@ -12414,11 +12414,8 @@ OP_I (instr_info *ins, int bytemode, int > sizeflag) > } > break; > case const_1_mode: > - if (ins->intel_syntax) > - oappend (ins, "1"); > - else > - oappend (ins, "$1"); It seems fixed the issue when the immediate is not decimal format right? Thx, Haochen > - return true; > + op = 1; > + break; > default: > oappend (ins, INTERNAL_DISASSEMBLER_ERROR); > return true; > > base-commit: 40578beee8a593e3668852238fd8e9f53790f2c9 > -- > 2.25.4
> > I noticed that the x86 instruction: > > > > sar $0x1,%rsi > > > > would fail to style the '$0x1' as an immediate. This commit fixes that case. > > I'm afraid it is not a bug, it is to distinguish between the two formats below. sar r/m8, 1 sar r/m8, imm8 Lili. > > opcodes/i386-dis.c | 7 ++----- > > 1 file changed, 2 insertions(+), 5 deletions(-) > > > > diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c index > > bc141f31770..d44fee33eb5 100644 > > --- a/opcodes/i386-dis.c > > +++ b/opcodes/i386-dis.c > > @@ -12414,11 +12414,8 @@ OP_I (instr_info *ins, int bytemode, int > > sizeflag) > > } > > break; > > case const_1_mode: > > - if (ins->intel_syntax) > > - oappend (ins, "1"); > > - else > > - oappend (ins, "$1"); > > It seems fixed the issue when the immediate is not decimal format right? > > Thx, > Haochen > > > - return true; > > + op = 1; > > + break; > > default: > > oappend (ins, INTERNAL_DISASSEMBLER_ERROR); > > return true; > > > > base-commit: 40578beee8a593e3668852238fd8e9f53790f2c9 > > -- > > 2.25.4
On 24.07.2024 04:31, Cui, Lili wrote: >>> I noticed that the x86 instruction: >>> >>> sar $0x1,%rsi >>> >>> would fail to style the '$0x1' as an immediate. This commit fixes that case. >>> > > I'm afraid it is not a bug, it is to distinguish between the two formats below. > > sar r/m8, 1 > sar r/m8, imm8 It is a bug, but it also is a bug to change 1 to 0x1, as that way said distinction goes away. (I also don't immediately see how the code change alone would pass the testsuite; I'm pretty sure we have expectations which would have required adjustment, which would have made more obvious that the change wants doing differently.) Jan
> On 24.07.2024 04:31, Cui, Lili wrote: > >>> I noticed that the x86 instruction: > >>> > >>> sar $0x1,%rsi > >>> > >>> would fail to style the '$0x1' as an immediate. This commit fixes that case. > >>> > > > > I'm afraid it is not a bug, it is to distinguish between the two formats below. > > > > sar r/m8, 1 > > sar r/m8, imm8 > > It is a bug, but it also is a bug to change 1 to 0x1, as that way said distinction > goes away. (I also don't immediately see how the code change alone would > pass the testsuite; I'm pretty sure we have expectations which would have > required adjustment, which would have made more obvious that the change > wants doing differently.) > Jan, do you have any suggestions on how to distinguish between IMM1 and IMM8? It seems that the current distinction can easily cause confusion. Currently, Intel format: disassembler prints 1 for Imm1 and 0x1 for Imm8. ATT format: disassembler prints $1 for Imm1 and $0x1 for Imm8. Thanks, Lili.
On 24.07.2024 10:42, Cui, Lili wrote: >> On 24.07.2024 04:31, Cui, Lili wrote: >>>>> I noticed that the x86 instruction: >>>>> >>>>> sar $0x1,%rsi >>>>> >>>>> would fail to style the '$0x1' as an immediate. This commit fixes that case. >>>>> >>> >>> I'm afraid it is not a bug, it is to distinguish between the two formats below. >>> >>> sar r/m8, 1 >>> sar r/m8, imm8 >> >> It is a bug, but it also is a bug to change 1 to 0x1, as that way said distinction >> goes away. (I also don't immediately see how the code change alone would >> pass the testsuite; I'm pretty sure we have expectations which would have >> required adjustment, which would have made more obvious that the change >> wants doing differently.) >> > Jan, do you have any suggestions on how to distinguish between IMM1 and IMM8? It seems that the current distinction can easily cause confusion. > > Currently, > Intel format: disassembler prints 1 for Imm1 and 0x1 for Imm8. > ATT format: disassembler prints $1 for Imm1 and $0x1 for Imm8. And that's fine. It's just that the Imm1 case also wants styling as immediate (without the prepending any 0x). If and when we move to not always emitting 0x for immediates in general (which is a plan I have been having for quite some time), your question would actually become relevant. Provided we actually continue to think there is a need to distinguish the two forms in disassembly. I don't think we make recognizable which encoding is in use in a number of other cases where multiple encodings exist. Jan
diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c index bc141f31770..d44fee33eb5 100644 --- a/opcodes/i386-dis.c +++ b/opcodes/i386-dis.c @@ -12414,11 +12414,8 @@ OP_I (instr_info *ins, int bytemode, int sizeflag) } break; case const_1_mode: - if (ins->intel_syntax) - oappend (ins, "1"); - else - oappend (ins, "$1"); - return true; + op = 1; + break; default: oappend (ins, INTERNAL_DISASSEMBLER_ERROR); return true;