From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) by sourceware.org (Postfix) with ESMTPS id 165CA385841D for ; Tue, 6 Feb 2024 16:28:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 165CA385841D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 165CA385841D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::b36 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707236923; cv=none; b=PyNraVko7cGSPQC8VGGEjKm1CKyqUwl9IaGUcbXA2jnmpgUDKUqcvxu3PDv8ptimdD0lpbIo2bezIVM8piu2DDIDWTkCb9QMax2nMPXiFeE/Cfj85LklZDDb5pugOBewpgJJI6vsl6ZnNinw+3eUoDYbSmRhqXo9o/p9/UXtBgI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707236923; c=relaxed/simple; bh=DeRSzWQ5gYficjtCcNrrQ2I6jfJSd757l8eyZ8dP5lo=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=JAuKT0en6jP8VbrWXxDz4LYiqv6Hxnj7eNQa5CXd+Dqev95f5EvJMqGLhHQkmy+zih3WrEsvMrdyPq0SmMM7hCS1fCWktyff4ogRXrWqU8ohpsKTTcHQC5kEyYUAPhqruYnMWtZyadhtSgTFLT+LgOKZSKII8HMhZmqyHuKZep4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yb1-xb36.google.com with SMTP id 3f1490d57ef6-dc6db13f1abso5051295276.2 for ; Tue, 06 Feb 2024 08:28:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707236921; x=1707841721; darn=sourceware.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=NtnPXYxkDEiM5038i5ctok1MeJ8ya7VJg/46XvH9AsM=; b=SJdUnGj9MKRKTAmfjPdo97U9vw+tpzSuDwHa7PYgcTSe7y+afixhR7aRvt2lLrq+LF KdHLzZXYzhlwXoy+fYlNYFh6YwUy6DnTTNLIrA2BiG5u8xT184H/Yj3PUPIzCV1P0ygG ntnxfLFZSWp2LBB+HkofOF/eXVlpbgFUGzF0gBlb7KPOjVNn+7Ol2+lM1DQNkwPzUOSS EziTS1oR3k1Wyh8bNnxGyyMUnHJcgzFAWI4fVxD8WmnT+oI6tG4Sm8G87ZNTnwkEluwy mMG9Vmf9L4y/BL1Bj08Lk6Iwnf6ZqbbtHQWDwSl54oGUVvBBJ/iRHvXN6vBx5ih/F0Bd HoUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707236921; x=1707841721; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NtnPXYxkDEiM5038i5ctok1MeJ8ya7VJg/46XvH9AsM=; b=FNAvTquIpb/B9A/q5FUv0CfsPeDi2s4k5N/uavd2JnsHQR0OT8inASy6ppn/ctDQHk oxphkunz0IOjsHPLeQEfhU4Vlg8/hcotrxUIQD8aajulNlqgeEZ+q9DBeVSxu8om5izD CiaANBzj/ckszv5rdmW2pH9yMGcblsWF1/4yQ4f6jvxklgIaldiWOzuVZguM06FFJutx b3AMQESWWUkJHx9pKi1OB96cKpF/Du2NA/cI0wlsIXiqwN4BFBYhYA+atC8jPnyepOKT m9WKqQXuZ5TyqEKVZpsKWe1+UU+GcUAoT//NRpKPjg/LqXuP3sjq30gu9Su76R2V0Rdr q09A== X-Gm-Message-State: AOJu0YzGxoHFKjSFzDIISG3FW24wcW0hO0QQ7ruoCURbvDeyh1pJUvY2 cMOXTwtES8eivpWpjjq/nAdcv9XXvaGaneHQH58NgU7ExrywOzwPgojy7zKWHAA82UuAtEcgwam iU9VJJFlgNzhuoI/PojWWcRCb0pAtecGG X-Google-Smtp-Source: AGHT+IGotB2Lkj4HFXewQr4pUHTnynqXQQWBT3Kt4zNhuIe4rqFWA+owhYZyNdPEDAZsoBJa1dZWvMOGpuSLTlGTGeY= X-Received: by 2002:a25:820e:0:b0:dc2:32e6:18d9 with SMTP id q14-20020a25820e000000b00dc232e618d9mr2045391ybk.8.1707236921323; Tue, 06 Feb 2024 08:28:41 -0800 (PST) MIME-Version: 1.0 References: <20240205200028.219844-1-hjl.tools@gmail.com> <4b1c3da8-d218-460b-89e6-6844096ed393@suse.com> <533a896f-8eec-b73b-cb18-26240ad822fc@suse.de> <8059bdee-392a-b9cd-41d5-8dea538c957c@suse.de> In-Reply-To: From: "H.J. Lu" Date: Tue, 6 Feb 2024 08:28:04 -0800 Message-ID: Subject: Re: [PATCH] x86: Warn .insn instruction with length > 15 bytes To: Michael Matz Cc: Jan Beulich , binutils@sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3014.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,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 List-Id: On Tue, Feb 6, 2024 at 7:48=E2=80=AFAM Michael Matz wrote: > > Hello, > > On Tue, 6 Feb 2024, H.J. Lu wrote: > > > > > > > It is an error on both Intel and AMD processors. There is no > > > > > > valid reason not to be an error at the moment. > > > > > > > > > > Jan gave you one. I would prefer for the assembler to not be ana= lly > > > > > > > > That is not a valid reason. > > > > > > Yes it is. > > > > > > > There is no such processor in the foreseeable future. > > > > > > Doesn't matter. > > > > > > > When a warning is given, a decodable instruction should still > > be generated. > > A software library can decode such instruction just fine. A human as wel= l. > > > Assembler shouldn't generate something which > > can't be decoded by default. > > That's the important words: "by default". Here's the documentation for > as_bad and as_warn: > > as_bad() is used to mark errors that result in what we > presume to be a useless object file. Say, we ignored > something that might have been vital. > ... > > as_warn() is used when we have an error from which we > have a plausible error recovery. eg, masking the top > bits of a constant that is longer than will fit in the > destination. In this case we will continue to assemble > the source, although we may have made a bad assumption, > and we will produce an object file and return normal exit > status (ie, no error). > ... > > It's obvious to me that just continuing to assemble the over-long > instruction is a "plausible error recovery". It's even more plausible > than "masking the top bits of a constant". Certainly an object file > containing a byte sequence correspending to the overlong instruction is > not "useless". With as_bad, assembler will continue to assemble, just not generate an object file. We ran into this with APX. Not everyone checks assembler warnings closely. It led to mysterious crashes. I am not against it if someone else implements an assembler option to turn this error into a warning. > I understand why you want to give an error by default, even though I > disagree with even that (in my book only a warning is justified). But > ruling out that this can be demoted to a warning, possibly with an option= , > is not in line with my expectation of how the GNU assembler should work > and has traditionally worked. > > > Ciao, > Michael. --=20 H.J.