Message ID | 20230418064228.21577-1-w@1wt.eu |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2630793vqo; Mon, 17 Apr 2023 23:57:41 -0700 (PDT) X-Google-Smtp-Source: AKy350YIR3EJovA+mAsjBr8e2QFtLrQLYqvNNt9Ze/rk2m2qXmhYSB32A5AmR0hKMar4+4OwQhfE X-Received: by 2002:a05:6a20:4b2a:b0:ec:faa:cb77 with SMTP id fp42-20020a056a204b2a00b000ec0faacb77mr14435264pzb.1.1681801061216; Mon, 17 Apr 2023 23:57:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681801061; cv=none; d=google.com; s=arc-20160816; b=aChR/kvvS1kO0Fw8aSkVyvwqMhlt+dtr8wTqM375ooP2mCtj/eu9nxmESqXSYYXsvH 9HPEQn7JykU7CzgamKItBMkx0YDfd3EqkZkCWhgXQmSbQus6VLKmHlqlQTFWssPq9vYL +BPEZcuUU8mcBxYkEuczw6Jv6h6v+4zu9jnbPcURO0KPCFCvg2RNJNOHe6o/NI4Rb955 dK/FOVvTJi/90Sz4hXTxJY+XDYeEjiWL7bVcOEhn5qwFgU5MD4Lh9u9BDYiYWNq/ge5x GZ/h14y4PV/KSTJ3LyPsnC/9M70L6iOHHdV4CDgLrzNcoqZ7/9LYLMwS1lqa8beaulE2 MSkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=kY5fTg1/hjnDQAYC6FQv8akXgLdIdxWsuUWP4XAvCNw=; b=hOnPI8NO1x96SbiAoE1sLQhY5bl1/aaKPn6wCYqKtRA3fjVFSQvotQJnF0042YWaXC s/GkOyORwQGvhj8nDn6JpHCb7LtWIPUwFJ47NvwrliSTjRA9G2/FDIV8f5tLH3Jgda1o boKXjFyfYkl1bKPfChgJsEKA6JTyO606cv7UWD0gAQxmpeIbI2hmaoaRjjiFppqbW8y8 nHkjAiDJdfbmNScB6AAJAXae4QtBMX0NS26A2fcvTsQUaFiSzgcToo0dC1310F+JDUdV Mnpc7XeKjMTeT8Li8nj7LeHnFJNf0wh3C8edaCtWQsJUIph9/n6eO6XcqBm+d8OSLa5o atAQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j3-20020a63e743000000b00519d9206ff6si13581301pgk.314.2023.04.17.23.57.26; Mon, 17 Apr 2023 23:57:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230471AbjDRGnW (ORCPT <rfc822;leviz.kernel.dev@gmail.com> + 99 others); Tue, 18 Apr 2023 02:43:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230036AbjDRGnR (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 18 Apr 2023 02:43:17 -0400 Received: from 1wt.eu (ded1.1wt.eu [163.172.96.212]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 09D131FFD for <linux-kernel@vger.kernel.org>; Mon, 17 Apr 2023 23:43:14 -0700 (PDT) Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id 33I6gYsK021620; Tue, 18 Apr 2023 08:42:34 +0200 From: Willy Tarreau <w@1wt.eu> To: Borislav Petkov <bp@alien8.de> Cc: Jingbo Xu <jefflexu@linux.alibaba.com>, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org, Willy Tarreau <w@1wt.eu> Subject: [PATCH] x86/alternatives: fix build issue with binutils before 2.28 Date: Tue, 18 Apr 2023 08:42:28 +0200 Message-Id: <20230418064228.21577-1-w@1wt.eu> X-Mailer: git-send-email 2.17.5 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763496229596413256?= X-GMAIL-MSGID: =?utf-8?q?1763496229596413256?= |
Series |
x86/alternatives: fix build issue with binutils before 2.28
|
|
Commit Message
Willy Tarreau
April 18, 2023, 6:42 a.m. UTC
The usage of the BIT() macro in asm code was introduced in 6.3 in by
commit 5d1dd961e743 ("x86/alternatives: Add alt_instr.flags") but this
macro uses "1UL" in the shift operations, while gas before 2.28 do not
support the "L" suffix after a number, and those before 2.27 do not
support the "U" suffix, resulting in build errors such as the following
with such versions:
./arch/x86/include/asm/uaccess_64.h:124: Error: found 'L', expected: ')'
./arch/x86/include/asm/uaccess_64.h:124: Error: junk at end of line,
first unrecognized character is `L'
There's a single use of this macro here, let's revert to (1 << 0) that
works with such older binutils.
Cc: Jingbo Xu <jefflexu@linux.alibaba.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Link: https://lore.kernel.org/lkml/a9aae568-3046-306c-bd71-92c1fc8eeddc@linux.alibaba.com/
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
Boris, I understood from your message that 2.28 was the first working version,
so that's what I mentioned here. My tests showed that 2.27 wasn't sufficient
and that 2.29 was OK. If I was wrong and it's 2.29 instead, feel free to edit
the subject line, description and the comment, I'm totally fine with this!
arch/x86/include/asm/alternative.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 4/18/23 2:42 PM, Willy Tarreau wrote: > The usage of the BIT() macro in asm code was introduced in 6.3 in by > commit 5d1dd961e743 ("x86/alternatives: Add alt_instr.flags") but this > macro uses "1UL" in the shift operations, while gas before 2.28 do not > support the "L" suffix after a number, and those before 2.27 do not > support the "U" suffix, resulting in build errors such as the following > with such versions: > > ./arch/x86/include/asm/uaccess_64.h:124: Error: found 'L', expected: ')' > ./arch/x86/include/asm/uaccess_64.h:124: Error: junk at end of line, > first unrecognized character is `L' > > There's a single use of this macro here, let's revert to (1 << 0) that > works with such older binutils. > > Cc: Jingbo Xu <jefflexu@linux.alibaba.com> > Cc: Borislav Petkov <bp@alien8.de> > Cc: "H. Peter Anvin" <hpa@zytor.com> > Link: https://lore.kernel.org/lkml/a9aae568-3046-306c-bd71-92c1fc8eeddc@linux.alibaba.com/ > Signed-off-by: Willy Tarreau <w@1wt.eu> > --- > > Boris, I understood from your message that 2.28 was the first working version, > so that's what I mentioned here. My tests showed that 2.27 wasn't sufficient > and that 2.29 was OK. If I was wrong and it's 2.29 instead, feel free to edit > the subject line, description and the comment, I'm totally fine with this! > > > arch/x86/include/asm/alternative.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alternative.h > index e2975a32d443..b119685c0b31 100644 > --- a/arch/x86/include/asm/alternative.h > +++ b/arch/x86/include/asm/alternative.h > @@ -8,7 +8,7 @@ > > #define ALT_FLAGS_SHIFT 16 > > -#define ALT_FLAG_NOT BIT(0) > +#define ALT_FLAG_NOT (1 << 0) /* note: gas < 2.28 can't use BIT(0) */ > #define ALT_NOT(feature) ((ALT_FLAG_NOT << ALT_FLAGS_SHIFT) | (feature)) > > #ifndef __ASSEMBLY__ It works for me. Tested-by: Jingbo Xu <jefflexu@linux.alibaba.com>
On Tue, Apr 18, 2023 at 08:42:28AM +0200, Willy Tarreau wrote: > Boris, I understood from your message that 2.28 was the first working version, > so that's what I mentioned here. My tests showed that 2.27 wasn't sufficient > and that 2.29 was OK. No, you have it right above: U suffix - 2.27 L/LL suffixes - 2.28 I was wondering where to put that info for future reference but didn't find a good place so I extended your commit message with it. Now at least we have left bread crumbs in case we need it in the future. Thx.
On Tue, Apr 18, 2023 at 12:02:12PM +0200, Borislav Petkov wrote: > On Tue, Apr 18, 2023 at 08:42:28AM +0200, Willy Tarreau wrote: > > Boris, I understood from your message that 2.28 was the first working version, > > so that's what I mentioned here. My tests showed that 2.27 wasn't sufficient > > and that 2.29 was OK. > > No, you have it right above: > > U suffix - 2.27 > L/LL suffixes - 2.28 > > I was wondering where to put that info for future reference but didn't > find a good place so I extended your commit message with it. Now at > least we have left bread crumbs in case we need it in the future. I wondered the same which is why I left it in the comment as a warning for future wanderers. Thanks! Willy
diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alternative.h index e2975a32d443..b119685c0b31 100644 --- a/arch/x86/include/asm/alternative.h +++ b/arch/x86/include/asm/alternative.h @@ -8,7 +8,7 @@ #define ALT_FLAGS_SHIFT 16 -#define ALT_FLAG_NOT BIT(0) +#define ALT_FLAG_NOT (1 << 0) /* note: gas < 2.28 can't use BIT(0) */ #define ALT_NOT(feature) ((ALT_FLAG_NOT << ALT_FLAGS_SHIFT) | (feature)) #ifndef __ASSEMBLY__