Message ID | 20221114225719.1657174-1-nathan@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2407727wru; Mon, 14 Nov 2022 15:03:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf6OqczExgqTnrvDsSFqrqHJLVZnj2AntfPthdlVHpti/A2cDSzRnbSrhh3msjCFK5wcjKLc X-Received: by 2002:a05:6402:1750:b0:467:d741:f359 with SMTP id v16-20020a056402175000b00467d741f359mr5855006edx.100.1668467001878; Mon, 14 Nov 2022 15:03:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668467001; cv=none; d=google.com; s=arc-20160816; b=Av+QzJidPisnUoALk1hXcZjaig56O1sdDYL8xWycL06z73O8uU+NuVRuKK1BStPTdr d0eYfPHudlEj0vr4o4CTcWteOV72VeEiFeJkvYjkHHWKxZO4k4eB7rC1+0alwIitAW71 TD7Q3gmK0cpO0wp88h6nmsafxtmsCfJxACwj9p2yY9NmkwLRAVSb8VeffeO5jhJH6I6l a6e0Y38jImzNByMY0UJbmv0vRQ0sjojdBEHtQl32N9DG0b7zoSMImvBRWUN+JEGcJqZI HUXUDwGaOORNDqSeLgny+x+m2qxxebpEFpFGOBIR8PVnPTOdfLi0XNuV58a4i2o97j4t ZWmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=aMGU8gAVkYgoZArLfpL/arJ0CxUdqEKQ4t78r6gI5jo=; b=ZvsbBXz8eTt1EjAZYkOqxPNYXpOwbZ6g1SlkpvVw3BXbz9LOmS6XW6GrKlUhB4Qh+z TBvopuRcLXBSRuXDmGqMwESlQtZc4aUh8T1Fh3dw4mgHLlG62ORCd0bbBklYRzdNRp6R bIpv3jar6LDXNVTOJ01O7oeeklwu/J75QBV8njZi+1R/SVKq2vY7RMwrOpCOGHYai/As fe8bJQX3ev9QahUyR5v3ieAZ6BhvDM/Apv6y0BsmRCVEwpj0uDgTCW7NvOguiuq0utT7 4dP2dXvC9u5rIedtbeDHkfwHfJTH+9FLszifO73zz0w5eqfP86Bz8RhjcZnwuKdXOW1P LgqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AKx2hahi; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k1-20020a170906970100b007ad7e81a30csi7867910ejx.167.2022.11.14.15.02.46; Mon, 14 Nov 2022 15:03:21 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AKx2hahi; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237658AbiKNW6V (ORCPT <rfc822;zwp10758@gmail.com> + 99 others); Mon, 14 Nov 2022 17:58:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237504AbiKNW6S (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 14 Nov 2022 17:58:18 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 183021ADAC for <linux-kernel@vger.kernel.org>; Mon, 14 Nov 2022 14:58:16 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B3EF1B81250 for <linux-kernel@vger.kernel.org>; Mon, 14 Nov 2022 22:58:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B89B1C433D7; Mon, 14 Nov 2022 22:58:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668466693; bh=z2liwwd8gcod1sLF+wz7lbOEfJTIH9wHoEzy8NzIIsM=; h=From:To:Cc:Subject:Date:From; b=AKx2hahilaGrxP4DvrTV2cksv2YTL451RIIVe4TPwQNuRQNToNnmAD/6IGKdD6xgf 0la3A6xBrkIUxsEZZqAq0G6fJvHFpGzIJXXMOv+stAYqzhT39X0vwEmL07MGVpfTuk Bo4mgE7kkGm4MBneTTs8sfh6BbnqC+gLDaH+MSq713UGThuaX9DtwHa9oisvK65GZt KR1b2JiYMX64t5GlL1AEwJ5UVbAMXUoobSbmyidWlZe4rZgpGttkkHxcdO6So7CyBV MB8kv3zy0iec/liBKZpJUP9QKtrH59MeyAeuzCUHmKRp+QU/It6BAWfE7mAGh7B3Mj fw39e10Nro/Gg== From: Nathan Chancellor <nathan@kernel.org> To: Russell King <linux@armlinux.org.uk>, Nick Desaulniers <ndesaulniers@google.com> Cc: Arnd Bergmann <arnd@arndb.de>, Ard Biesheuvel <ardb@kernel.org>, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, patches@lists.linux.dev, Nathan Chancellor <nathan@kernel.org>, "kernelci.org bot" <bot@kernelci.org> Subject: [PATCH] ARM: Drop '-mthumb' from AFLAGS_ISA Date: Mon, 14 Nov 2022 15:57:20 -0700 Message-Id: <20221114225719.1657174-1-nathan@kernel.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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?1749514454958980182?= X-GMAIL-MSGID: =?utf-8?q?1749514454958980182?= |
Series |
ARM: Drop '-mthumb' from AFLAGS_ISA
|
|
Commit Message
Nathan Chancellor
Nov. 14, 2022, 10:57 p.m. UTC
When building with CONFIG_THUMB2_KERNEL=y + a version of clang from
Debian, the following warning occurs frequently:
<built-in>:383:9: warning: '__thumb2__' macro redefined [-Wmacro-redefined]
#define __thumb2__ 2
^
<built-in>:353:9: note: previous definition is here
#define __thumb2__ 1
^
1 warning generated.
Debian carries a downstream patch that changes the default CPU of the
arm-linux-gnueabihf target from 'arm1176jzf-s' (v6) to 'cortex-a7' (v7).
As a result, '-mthumb' defines both '__thumb__' and '__thumb2__'. The
define of '__thumb2__' via the command line was purposefully added to
catch a situation like this.
In a similar vein as commit 26b12e084bce ("ARM: 9264/1: only use
-mtp=cp15 for the compiler"), do not add '-mthumb' to AFLAGS_ISA, as it
is already passed to the assembler via '-Wa,-mthumb' and '__thumb2__' is
already defined for preprocessing.
Fixes: 1d2e9b67b001 ("ARM: 9265/1: pass -march= only to compiler")
Link: htps://salsa.debian.org/pkg-llvm-team/llvm-toolchain/-/blob/17354b030ac4252ff6c5e9d01f4eba28bd406b2d/debian/patches/930008-arm.diff
Reported-by: "kernelci.org bot" <bot@kernelci.org>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
arch/arm/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
base-commit: 0c52591d22e99759da3793f19249bbf45ad742bd
Comments
On Mon, Nov 14, 2022 at 2:58 PM Nathan Chancellor <nathan@kernel.org> wrote: > > When building with CONFIG_THUMB2_KERNEL=y + a version of clang from > Debian, the following warning occurs frequently: I also needed to explicitly set CROSS_COMPILE=arm-linux-gnueabihf- to reproduce. Please add that detail to the commit message. Thanks for helping spot that difference on IRC. It sounds like tuxmake (which our CI is built on) and perhaps kernelCI are both setting that variable, which is no longer necessary when using LLVM=1 for ARCH=arm. Not CROSS_COMPILE=arm-linux-gnueabi- like the triple we use by default for ARCH=arm in scripts/Makefile.clang. So this issue arises from: 1. using debian's clang, which is carrying an out of tree patch affecting this. 2. using `CROSS_COMPILE=arm-linux-gnueabihf-`. The use of both of those in conjunction I'd like to think would be relatively unlikely, but it seems that we have both CI systems doing this (and the patch LGTM regardless of changing the CI). > > <built-in>:383:9: warning: '__thumb2__' macro redefined [-Wmacro-redefined] > #define __thumb2__ 2 > ^ > <built-in>:353:9: note: previous definition is here > #define __thumb2__ 1 > ^ > 1 warning generated. > > Debian carries a downstream patch that changes the default CPU of the > arm-linux-gnueabihf target from 'arm1176jzf-s' (v6) to 'cortex-a7' (v7). > As a result, '-mthumb' defines both '__thumb__' and '__thumb2__'. The > define of '__thumb2__' via the command line was purposefully added to > catch a situation like this. And we caught something! It's almost like Ard has sight-beyond-sight or something when he made that suggestion. Coincidence? I think not... :P > > In a similar vein as commit 26b12e084bce ("ARM: 9264/1: only use > -mtp=cp15 for the compiler"), do not add '-mthumb' to AFLAGS_ISA, as it > is already passed to the assembler via '-Wa,-mthumb' and '__thumb2__' is > already defined for preprocessing. > > Fixes: 1d2e9b67b001 ("ARM: 9265/1: pass -march= only to compiler") > Link: htps://salsa.debian.org/pkg-llvm-team/llvm-toolchain/-/blob/17354b030ac4252ff6c5e9d01f4eba28bd406b2d/debian/patches/930008-arm.diff Would you mind using https://salsa.debian.org/pkg-llvm-team/llvm-toolchain/-/blob/snapshot/debian/patches/930008-arm.diff as the link instead? The link on this commit message is a diff against llvm-14, not ToT which is currently llvm-16; the context is quite different as the logic moved source files completely. Though it does look like Sylvestre has not yet cut a 16 branch for debian's patches. If not, at least re-add the missing `t` from the protocol in the URL (s/htps/https/). > Reported-by: "kernelci.org bot" <bot@kernelci.org> > Signed-off-by: Nathan Chancellor <nathan@kernel.org> I verified this locally with LLVM built from source, comparing no out of tree patches vs just debian's 930008-arm.diff applied. Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Tested-by: Nick Desaulniers <ndesaulniers@google.com> --- If memory serves, this is perhaps the third time downstream debian patches to llvm have caused us initially-difficult-to-reproduce bugs. Sylvestre, going forward, would you mind please giving your diff's more descriptive file names, or making them actual commits with some context in the commit message? Time and resource permitting, submitting them upstream, even if they're not accepted, but pointing to the upstream discussion (if any) from commit messages would provide us more context for these kind of things. Maybe Serge could help you burn down those out of tree patches? ;) > --- > arch/arm/Makefile | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/arm/Makefile b/arch/arm/Makefile > index 357f0d9b8607..d1ebb746ff40 100644 > --- a/arch/arm/Makefile > +++ b/arch/arm/Makefile > @@ -131,8 +131,9 @@ endif > AFLAGS_NOWARN :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W) > > ifeq ($(CONFIG_THUMB2_KERNEL),y) > -CFLAGS_ISA :=-mthumb -Wa,-mimplicit-it=always $(AFLAGS_NOWARN) > +CFLAGS_ISA :=-Wa,-mimplicit-it=always $(AFLAGS_NOWARN) > AFLAGS_ISA :=$(CFLAGS_ISA) -Wa$(comma)-mthumb -D__thumb2__=2 > +CFLAGS_ISA +=-mthumb > else > CFLAGS_ISA :=$(call cc-option,-marm,) $(AFLAGS_NOWARN) > AFLAGS_ISA :=$(CFLAGS_ISA) > > base-commit: 0c52591d22e99759da3793f19249bbf45ad742bd > -- > 2.38.1 >
On Thu, Nov 17, 2022 at 11:15:09AM -0800, Nick Desaulniers wrote: > On Mon, Nov 14, 2022 at 2:58 PM Nathan Chancellor <nathan@kernel.org> wrote: > > > > When building with CONFIG_THUMB2_KERNEL=y + a version of clang from > > Debian, the following warning occurs frequently: > > I also needed to explicitly set > CROSS_COMPILE=arm-linux-gnueabihf- > to reproduce. Please add that detail to the commit message. Thanks > for helping spot that difference on IRC. Ack. > It sounds like tuxmake (which our CI is built on) and perhaps kernelCI > are both setting that variable, which is no longer necessary when > using LLVM=1 for ARCH=arm. Right; I suspect that it is unlikely that either of those entities will drop CROSS_COMPILE because they aim to work with multiple trees, which may still require CROSS_COMPILE. Maybe in five years when 5.15 is the oldest stable release that we support ;) > Not CROSS_COMPILE=arm-linux-gnueabi- like the triple we use by default > for ARCH=arm in scripts/Makefile.clang. So this issue arises from: > 1. using debian's clang, which is carrying an out of tree patch affecting this. > 2. using `CROSS_COMPILE=arm-linux-gnueabihf-`. > > The use of both of those in conjunction I'd like to think would be > relatively unlikely, but it seems that we have both CI systems doing > this (and the patch LGTM regardless of changing the CI). > > > > > <built-in>:383:9: warning: '__thumb2__' macro redefined [-Wmacro-redefined] > > #define __thumb2__ 2 > > ^ > > <built-in>:353:9: note: previous definition is here > > #define __thumb2__ 1 > > ^ > > 1 warning generated. > > > > Debian carries a downstream patch that changes the default CPU of the > > arm-linux-gnueabihf target from 'arm1176jzf-s' (v6) to 'cortex-a7' (v7). > > As a result, '-mthumb' defines both '__thumb__' and '__thumb2__'. The > > define of '__thumb2__' via the command line was purposefully added to > > catch a situation like this. > > And we caught something! It's almost like Ard has sight-beyond-sight > or something when he made that suggestion. Coincidence? I think not... > :P Or perhaps a deep familiarity with the potential pitfalls of all this ;) > > In a similar vein as commit 26b12e084bce ("ARM: 9264/1: only use > > -mtp=cp15 for the compiler"), do not add '-mthumb' to AFLAGS_ISA, as it > > is already passed to the assembler via '-Wa,-mthumb' and '__thumb2__' is > > already defined for preprocessing. > > > > Fixes: 1d2e9b67b001 ("ARM: 9265/1: pass -march= only to compiler") > > Link: htps://salsa.debian.org/pkg-llvm-team/llvm-toolchain/-/blob/17354b030ac4252ff6c5e9d01f4eba28bd406b2d/debian/patches/930008-arm.diff > > Would you mind using > https://salsa.debian.org/pkg-llvm-team/llvm-toolchain/-/blob/snapshot/debian/patches/930008-arm.diff > as the link instead? The link on this commit message is a diff against > llvm-14, not ToT which is currently llvm-16; the context is quite > different as the logic moved source files completely. Though it does > look like Sylvestre has not yet cut a 16 branch for debian's patches. I would rather use an actual hash to reduce the risk of the link going stale from either a branch rename or file rename/removal. I can use a hash from the snapshot branch instead, if that would work for you? > If not, at least re-add the missing `t` from the protocol in the URL > (s/htps/https/). Oh whoops, good catch! > > Reported-by: "kernelci.org bot" <bot@kernelci.org> > > Signed-off-by: Nathan Chancellor <nathan@kernel.org> > > I verified this locally with LLVM built from source, comparing no out > of tree patches vs just debian's 930008-arm.diff applied. > > Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> > Tested-by: Nick Desaulniers <ndesaulniers@google.com> Thanks for the testing and review! I will send a v2 later today and submit it to Russell's patch tracker on Monday so that it can be picked up for -next. > --- > > If memory serves, this is perhaps the third time downstream debian > patches to llvm have caused us initially-difficult-to-reproduce bugs. > Sylvestre, going forward, would you mind please giving your diff's > more descriptive file names, or making them actual commits with some > context in the commit message? Time and resource permitting, > submitting them upstream, even if they're not accepted, but pointing > to the upstream discussion (if any) from commit messages would provide > us more context for these kind of things. Maybe Serge could help you > burn down those out of tree patches? ;) At the very least, it is the second time; the first was https://github.com/ClangBuiltLinux/linux/issues/1355. > > --- > > arch/arm/Makefile | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/arch/arm/Makefile b/arch/arm/Makefile > > index 357f0d9b8607..d1ebb746ff40 100644 > > --- a/arch/arm/Makefile > > +++ b/arch/arm/Makefile > > @@ -131,8 +131,9 @@ endif > > AFLAGS_NOWARN :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W) > > > > ifeq ($(CONFIG_THUMB2_KERNEL),y) > > -CFLAGS_ISA :=-mthumb -Wa,-mimplicit-it=always $(AFLAGS_NOWARN) > > +CFLAGS_ISA :=-Wa,-mimplicit-it=always $(AFLAGS_NOWARN) > > AFLAGS_ISA :=$(CFLAGS_ISA) -Wa$(comma)-mthumb -D__thumb2__=2 > > +CFLAGS_ISA +=-mthumb > > else > > CFLAGS_ISA :=$(call cc-option,-marm,) $(AFLAGS_NOWARN) > > AFLAGS_ISA :=$(CFLAGS_ISA) > > > > base-commit: 0c52591d22e99759da3793f19249bbf45ad742bd > > -- > > 2.38.1 > > Cheers, Nathan
On Thu, Nov 17, 2022 at 11:34 AM Nathan Chancellor <nathan@kernel.org> wrote: > > On Thu, Nov 17, 2022 at 11:15:09AM -0800, Nick Desaulniers wrote: > > On Mon, Nov 14, 2022 at 2:58 PM Nathan Chancellor <nathan@kernel.org> wrote: > > > > > > Fixes: 1d2e9b67b001 ("ARM: 9265/1: pass -march= only to compiler") > > > Link: htps://salsa.debian.org/pkg-llvm-team/llvm-toolchain/-/blob/17354b030ac4252ff6c5e9d01f4eba28bd406b2d/debian/patches/930008-arm.diff > > > > Would you mind using > > https://salsa.debian.org/pkg-llvm-team/llvm-toolchain/-/blob/snapshot/debian/patches/930008-arm.diff > > as the link instead? The link on this commit message is a diff against > > llvm-14, not ToT which is currently llvm-16; the context is quite > > different as the logic moved source files completely. Though it does > > look like Sylvestre has not yet cut a 16 branch for debian's patches. > > I would rather use an actual hash to reduce the risk of the link going > stale from either a branch rename or file rename/removal. I can use a > hash from the snapshot branch instead, if that would work for you? It doesn't matter much to me; I trust your judgement; you pick. Perhaps that depends if the snapshot branch has stable SHAs or whether they change over time? Maybe Sylvestre can comment on that.
Le 17/11/2022 à 23:51, Nick Desaulniers a écrit : > On Thu, Nov 17, 2022 at 11:34 AM Nathan Chancellor <nathan@kernel.org> wrote: >> >> On Thu, Nov 17, 2022 at 11:15:09AM -0800, Nick Desaulniers wrote: >>> On Mon, Nov 14, 2022 at 2:58 PM Nathan Chancellor <nathan@kernel.org> wrote: >>>> >>>> Fixes: 1d2e9b67b001 ("ARM: 9265/1: pass -march= only to compiler") >>>> Link: htps://salsa.debian.org/pkg-llvm-team/llvm-toolchain/-/blob/17354b030ac4252ff6c5e9d01f4eba28bd406b2d/debian/patches/930008-arm.diff >>> >>> Would you mind using >>> https://salsa.debian.org/pkg-llvm-team/llvm-toolchain/-/blob/snapshot/debian/patches/930008-arm.diff >>> as the link instead? The link on this commit message is a diff against >>> llvm-14, not ToT which is currently llvm-16; the context is quite >>> different as the logic moved source files completely. Though it does >>> look like Sylvestre has not yet cut a 16 branch for debian's patches. >> >> I would rather use an actual hash to reduce the risk of the link going >> stale from either a branch rename or file rename/removal. I can use a >> hash from the snapshot branch instead, if that would work for you? > > It doesn't matter much to me; I trust your judgement; you pick. > Perhaps that depends if the snapshot branch has stable SHAs or whether > they change over time? Maybe Sylvestre can comment on that. Yeah, it can change overtime. I have to rebase them from time to time. Cheers, Sylvestre
diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 357f0d9b8607..d1ebb746ff40 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -131,8 +131,9 @@ endif AFLAGS_NOWARN :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W) ifeq ($(CONFIG_THUMB2_KERNEL),y) -CFLAGS_ISA :=-mthumb -Wa,-mimplicit-it=always $(AFLAGS_NOWARN) +CFLAGS_ISA :=-Wa,-mimplicit-it=always $(AFLAGS_NOWARN) AFLAGS_ISA :=$(CFLAGS_ISA) -Wa$(comma)-mthumb -D__thumb2__=2 +CFLAGS_ISA +=-mthumb else CFLAGS_ISA :=$(call cc-option,-marm,) $(AFLAGS_NOWARN) AFLAGS_ISA :=$(CFLAGS_ISA)