From patchwork Tue Feb 6 11:33:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 197324 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1474761dyb; Tue, 6 Feb 2024 03:34:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IH4FNGvgcsKMAvJp9Fwq/omQUvWUdkKjnjZeqyiVUBG9eRN24mAatTlKrhIrP4DtM6sderb X-Received: by 2002:a81:4956:0:b0:5ff:a52b:55ac with SMTP id w83-20020a814956000000b005ffa52b55acmr1324311ywa.34.1707219256156; Tue, 06 Feb 2024 03:34:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707219256; cv=pass; d=google.com; s=arc-20160816; b=htsFA8X/61Z8gDHiynJl6KuxHnlnL2TkIGnSEKoX68RUicQc36KCCOXntUMtQ2g+qJ 1XILECrSejg7n91fscPvOnMFqKQFN1YxrFFsGj61rDrIIusGgVOGShTSeB1uyWAPxsPN 1ZrRANkKktsREJ+vVbBWEsHpAKpDg+TWue4kD7Kj9QH/2PR3Pa/ZjWzyxo96nq10dhQf ydrhksS+ODqm6tXODxlOTy9RxN2uCPKkwsjTIZtq3PPpnGRtDziJ+Vha2W4+dNIpvqCh mKbXX5GXwpyg/iPfJKceWVWsgA1RISzPikT1rmurMVuBAwyvrtdSlKnSasmFCybVefpQ RnSA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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 :arc-filter:dmarc-filter:delivered-to; bh=8nXEOgLifMIeqMDcIG6uyEXnqKoLeRU+PRLSvtGAkyc=; fh=pZTsq6ZxXr3lwTLwQbYPv3qTICUOda2XtM5VNor4vEU=; b=CeEi8VMJkgTzvfhSadQLHmumLLl8hV6mLK1jtQfNZZ13EJNw//Lkr1EbpO+s1bPg3Z UvsxODfzSPCxty1JMo5uTam3eSbLM8Yw78Viqb/vByyHo2yksQjtCJdYZCWjketXXcbT T7DDxkb11jgRYx2PqqRkGI7yv16cdsApdqGhyNTdfB9lG1vzLkRo6ewsb+Ro7GWvQTup 8V9+St4SVM4WlkQATOfI1OCfwbf5md99y/YkQb71J6lj1bij24NrdKQPTICS2oQMOVax OKpSked0nVJ44CXm9HvGxICHEUPjd+1B4OB15HHMi4ljouBlpQZv7DnWt93oGG8N7hnp hU3w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=JOiWMLj0; arc=pass (i=1); 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"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=1; AJvYcCWCcZQCEHrVxR7+GKFIVWs2W4ip3QzS1dqo9FYQ3d7ymmbw6WsmEClmCfg3tzW2/vDEMWHutnXYHTpINIweaow+f5wF+w== Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id d8-20020a05620a136800b0078384c13cccsi2130834qkl.668.2024.02.06.03.34.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 03:34:16 -0800 (PST) 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=@gmail.com header.s=20230601 header.b=JOiWMLj0; arc=pass (i=1); 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"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CC5F7385840C for ; Tue, 6 Feb 2024 11:34:15 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by sourceware.org (Postfix) with ESMTPS id AD2AD3858D35 for ; Tue, 6 Feb 2024 11:34:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AD2AD3858D35 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 AD2AD3858D35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::102a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707219246; cv=none; b=WjrGBQaG29r86UE7YFnS5jx2LGodai8fKA7Q5IoCwZb9+4aRpgV/L+d1VUPeiin0/uZEQSlI9Xkrgc9EVDrMZ7/hWQ/yyg0T2oN6fp6JBN6yORe9U9jU83E02jIfv1Ms+jo2n9bgEFailKjSgPzF3ORf4Rqlr7SEBC1FgvGW9KE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707219246; c=relaxed/simple; bh=ljCoyDX5XcZd1MKStYAQ9cmQkvLpRujwIz21c8Pv3+8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=AI2NUI6hKxwQ1uwpJ0A+xyImuExFDHlTAYjNQy7a1a+/QpVzl+rwWgxVJz72WObWumN/0D0sS6jUHuJEtJ45XuovqOFSC5UtLcNNtqOnUCTDNQ+mhe2fztu6BZwfQAOuuWFuo5B+fFwhST9f5GlUYOoeylAbmVyPKYlM8bTBzoo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pj1-x102a.google.com with SMTP id 98e67ed59e1d1-295f9a4a656so4505677a91.1 for ; Tue, 06 Feb 2024 03:34:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707219240; x=1707824040; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=8nXEOgLifMIeqMDcIG6uyEXnqKoLeRU+PRLSvtGAkyc=; b=JOiWMLj0eUr+KewTGvCwgUczbQXJNRRLMRAJCwah2Gp8zcdLRxwMh8B98PmEK4mksm 1XMMocLVrwIrXS/QSIWOn9qVV7n6eyFeGkJ7zey2KXRQZvMr2pNrXi6nPeMYtQL3b8ja kgerFKuJdg0RYaBxUWoZ4LaIPyu7h1CMLEbDkm3itHP2AqcR7vk84F3tTI5cpkt9lNBN pq/snFDqTreMbybxKzXVkneONKhjvROK4CuPiyBXWPs7zGZkAsKtAbbv0S+k870rtmXZ isFbkTE2pbbWfIt+CX9U4IRGD8hTdL0L5FTg3U+HVBPVPz14rcsoXWEMzn2aZcjx49xs I+nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707219240; x=1707824040; 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=8nXEOgLifMIeqMDcIG6uyEXnqKoLeRU+PRLSvtGAkyc=; b=gYMMVWWlwzlg0aSMhX3fr41NKRme6ihdFPmFTxPKY8vRyHQqfRnmqLDx4izvMSpDQR XfsoKkZpwhe+q8rkdB/FA5dOrw2lx+gZwkhIiFQwGt24MHD7x+zIYd4ueKcvXrRdAvfu 0zBjgEm8zRoVlvtex9m8YuwfOaoY5fGJHywAbX18jORDmYep2Qk8mH3fMSoUz7TRDM1Q E4i/fF9DAWWysKLIXqdY3+llOHIhsg5RYh29w1x/um91zw36kgx95QEVFBS5SIMxmraA ETxjAMiubKEWHGwMq/n77ZepM9gyf+wJ1Z7ea4ItKjrwvO5SJjIHAPDwjDH5qNjNC8JA +BZw== X-Gm-Message-State: AOJu0YzeVfjCZA2+9chXQZgDslakJH5SAbQWxSIO9r1oaaGgCIkrAdIE it/UHhu4YFk7y8vQ4KvzJOFg/aMCBz5i9liYLF964mxbso5IFUxjtHw6+ImT X-Received: by 2002:a17:90b:3911:b0:296:341b:a60 with SMTP id ob17-20020a17090b391100b00296341b0a60mr2042922pjb.13.1707219240271; Tue, 06 Feb 2024 03:34:00 -0800 (PST) Received: from gnu-cfl-3.localdomain ([172.56.168.224]) by smtp.gmail.com with ESMTPSA id bk7-20020a17090b080700b00296b2f99946sm1328330pjb.30.2024.02.06.03.33.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 03:33:59 -0800 (PST) Received: from gnu-cfl-3.. (localhost [IPv6:::1]) by gnu-cfl-3.localdomain (Postfix) with ESMTP id E2F1F74016D; Tue, 6 Feb 2024 03:33:58 -0800 (PST) From: "H.J. Lu" To: binutils@sourceware.org Cc: jbeulich@suse.com Subject: [PATCH v2] x86: Warn .insn instruction with length > 15 bytes Date: Tue, 6 Feb 2024 03:33:58 -0800 Message-ID: <20240206113358.999065-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Spam-Status: No, score=-3023.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, 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 X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790149138613616875 X-GMAIL-MSGID: 1790149138613616875 Change .insn instruction with length > 15 bytes from error to warning. PR gas/31323 * config/tc-i386.c (output_insn): Issue a warning when .insn instruction length exceeds the limit of 15 bytes. * testsuite/gas/i386/oversized64.s: Add a test for .insn * testsuite/gas/i386/oversized64.l: Updated. --- gas/config/tc-i386.c | 10 ++++++++-- gas/testsuite/gas/i386/oversized64.l | 8 ++++++++ gas/testsuite/gas/i386/oversized64.s | 3 +++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 8f3a1b6f686..047aaba567e 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -11780,8 +11780,14 @@ output_insn (const struct last_insn *last_insn) { j = encoding_length (insn_start_frag, insn_start_off, frag_more (0)); if (j > 15) - as_bad (_("instruction length of %u bytes exceeds the limit of 15"), - j); + { + if (dot_insn ()) + as_warn (_("instruction length of %u bytes exceeds the limit of 15"), + j); + else + as_bad (_("instruction length of %u bytes exceeds the limit of 15"), + j); + } else if (fragP) { /* NB: Don't add prefix with GOTPC relocation since diff --git a/gas/testsuite/gas/i386/oversized64.l b/gas/testsuite/gas/i386/oversized64.l index ac32c4d8139..f709456c5e5 100644 --- a/gas/testsuite/gas/i386/oversized64.l +++ b/gas/testsuite/gas/i386/oversized64.l @@ -4,6 +4,7 @@ .*:7: Error: instruction length.* .*:9: Error: instruction length.* .*:10: Error: instruction length.* +.*:13: Warning: instruction length.* GAS LISTING .* @@ -37,4 +38,11 @@ GAS LISTING .* [ ]*10[ ]+48812CC5[ ]* [ ]*10[ ]+00000000[ ]* [ ]*10[ ]+44332211[ ]* +[ ]*11[ ]+ +[ ]*12[ ]+\.att_syntax prefix +[ ]*13[ ]+\?\?\?\? 6762F1FC[ ]+.insn EVEX.L0.0f 12/0, \$0x11223344,\(,%eax,8\),%rax +\*\*\*\* Warning: instruction length of 16 bytes exceeds the limit of 15 +[ ]*13[ ]+080C04C5[ ]* +[ ]*13[ ]+00000000[ ]* +[ ]*13[ ]+44332211[ ]* #pass diff --git a/gas/testsuite/gas/i386/oversized64.s b/gas/testsuite/gas/i386/oversized64.s index 9db09af3f15..77a08a9c533 100644 --- a/gas/testsuite/gas/i386/oversized64.s +++ b/gas/testsuite/gas/i386/oversized64.s @@ -8,3 +8,6 @@ long64: xacquire lock add qword ptr gs:[eax*8], 0x11223344 xrelease lock sub qword ptr gs:[eax*8], 0x11223344 + + .att_syntax prefix + .insn EVEX.L0.0f 12/0, $0x11223344,(,%eax,8),%rax