From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EB5E5C4167B for ; Mon, 4 Dec 2023 22:52:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9ufqQCw9FfkGE4q2tyQ1ahHY+PMrY55Efs1i0fRKb9g=; b=FlE0EFeU7HHbkU +YdjahWbmoSpdUZlbEE6ch0xj2HljmRD/SMoqUAQDJuZF65ognSKyO2esPo+Ae8o7BLhit7F8F34e 7UfA+cn0x55ZR216S5EYrcMF7ahRd0UYpIHbQ/9BkqCm/QQdqciLXFvqtFgCacjiznM23VoilchmV QE01CER2TBvLf1xCrdaQhuUjdZhyGEDgjMCvFDT4eHuHeayj4DNk0ND2fmiOrqhP9yKaYMzeNqKYv I5oDLUoVuyJ5F0+7RcbZzvRKwcpa1DnMUVpngc7OhrIhQK3DExJ95hN6E2Qa8psRFYpiQaXu3l+6T +OA978JWKkxZn62oXPxg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rAHnF-005kEl-0h; Mon, 04 Dec 2023 22:52:01 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rAHnC-005kDI-02 for linux-arm-kernel@lists.infradead.org; Mon, 04 Dec 2023 22:52:00 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 824B8CE1353; Mon, 4 Dec 2023 22:51:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36750C433C8; Mon, 4 Dec 2023 22:51:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701730310; bh=iEzFzN5srKwj/pYZXDgnZDTQQKCpoB6GASU+Xqwa6mA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=a3ZDkyh2bpKh8JseA3+i4SgPk6H55RJtemW2I8wAl/DDAcD0k8Ll0HTFlUfOpoFvr TB+0MNI6D0/MUnNnnAAgy+2ayR4GR3ToHJqxq3oWovx1ydNXaQYIR0SRBKStNahx07 Z+VZSMMXsyqIctUJmjd+xYexdydciiUA3Ye4g34rJSwW8FNSNjW2NxVHjjliHTkxtX FFiY+2kWoTXi8GCQBdeIQcohSENyHAT6wIPTzx+0HIyOmw7bnPGYiwxosglBskw4MW linlPJ6rqbrTMUt3V5n9SJCRc8ZZOghTgxEG+oWAU4IggFfsSEK46snit6VbAuRAAW Wyre5rfD+oHAg== Date: Mon, 4 Dec 2023 15:51:48 -0700 From: Nathan Chancellor To: Sylvestre Ledru Cc: Naresh Kamboju , clang-built-linux , Linux ARM , open list , Linux Regressions , lkft-triage@lists.linaro.org, Russell King - ARM Linux , Arnd Bergmann , Nick Desaulniers Subject: Re: clang-nightly: vdso/compat_gettimeofday.h:152:15: error: instruction variant requires ARMv6 or later Message-ID: <20231204225148.GA2094126@dev-arch.thelio-3990X> References: <20231204181304.GA2043538@dev-arch.thelio-3990X> <20231204223317.GA2053629@dev-arch.thelio-3990X> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231204_145158_409085_61C29E46 X-CRM114-Status: GOOD ( 42.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Dec 04, 2023 at 11:42:02PM +0100, Sylvestre Ledru wrote: > Hello, > = > = > Le 04/12/2023 =E0 23:33, Nathan Chancellor a =E9crit=A0: > > On Mon, Dec 04, 2023 at 11:13:04AM -0700, Nathan Chancellor wrote: > > > Hi Naresh, > > > = > > > On Mon, Dec 04, 2023 at 05:33:26PM +0530, Naresh Kamboju wrote: > > > > Following build errors noticed on Linux next-20231204 tag with clan= g-nightly > > > > for arm and arm64. > > > > = > > > > ## Test Regressions (compared to next-20231201) > > > > * arm64, build > > > > - clang-nightly-defconfig > > > > - clang-nightly-defconfig-40bc7ee5 > > > > - clang-nightly-lkftconfig > > > > - clang-nightly-lkftconfig-kselftest > > > > = > > > > * arm, build > > > > - clang-nightly-allnoconfig > > > > - clang-nightly-axm55xx_defconfig > > > > - clang-nightly-bcm2835_defconfig > > > > - clang-nightly-clps711x_defconfig > > > > - clang-nightly-defconfig > > > > - clang-nightly-exynos_defconfig > > > > - clang-nightly-imx_v6_v7_defconfig > > > > - clang-nightly-keystone_defconfig > > > > - clang-nightly-lkftconfig > > > > - clang-nightly-lkftconfig-kselftest > > > > - clang-nightly-omap2plus_defconfig > > > > - clang-nightly-pxa910_defconfig > > > > - clang-nightly-s3c6400_defconfig > > > > - clang-nightly-s5pv210_defconfig > > > > - clang-nightly-sama5_defconfig > > > > - clang-nightly-shmobile_defconfig > > > > - clang-nightly-tinyconfig > > > > - clang-nightly-u8500_defconfig > > > > - clang-nightly-vexpress_defconfig > > > > = > > > > = > > > > Reported-by: Linux Kernel Functional Testing > > > > = > > > > = > > > > Build log on arm64: > > > > --------- > > > > In file included from lib/vdso/gettimeofday.c:5: > > > > In file included from include/vdso/datapage.h:135: > > > > arch/arm64/include/asm/vdso/compat_gettimeofday.h:152:15: error: > > > > instruction variant requires ARMv6 or later > > > > 152 | asm volatile("mov %0, %1" : "=3Dr"(ret) : "r"(_vds= o_data)); > > > > | ^ > > > > :1:2: note: instantiated into assembly here > > > > 1 | mov r4, r1 > > > > | ^ > > > > In file included from :3: > > > > lib/vdso/gettimeofday.c:139:3: error: invalid instruction > > > > 139 | smp_rmb(); > > > > | ^ > > > > = > > > > Build log on arm: > > > > --------- > > > > In file included from arch/arm/vfp/vfpmodule.c:23: > > > > arch/arm/include/asm/cp15.h:101:2: error: instruction requires: dat= a-barriers > > > > 101 | isb(); > > > > | ^ > > > This is caused by a change to Debian's LLVM that changes the internal > > > defaults of the arm-linux-gnueabi and arm-linux-gnueabihf tuples: > > > = > > > https://salsa.debian.org/pkg-llvm-team/llvm-toolchain/-/commit/907baf= 024b9a5a1626893d9e731b6c79ccf45c87 > > > = > > > We use arm-linux-gnueabi for the kernel (see scripts/Makefile.clang) = so > > > now we have a hardcoded armv5te CPU, even if we are building for armv7 > > > or such. > > > = > > > I am still investigating into what (if anything) can be done to resol= ve > > > this on the kernel side. We could potentially revert commit > > > ddc72c9659b5 ("kbuild: clang: do not use CROSS_COMPILE for target > > > triple") but I am not sure that will save us from that change, as > > > tuxmake's CROSS_COMPILE=3Darm-linux-gnueabihf will cause us to have an > > > armv7 CPU even though we may not be building for armv7. > > Okay, this is a pretty awful situation the more I look into it :( > > = > > The arm64 compat vDSO build is easy enough to fix because we require use > > of the integrated assembler, which means we can add '-mcpu=3Dgeneric' (= the > > default in LLVM for those files based on my debugging) to those files > > and be done with it: > > = > > diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso= 32/Makefile > > index 1f911a76c5af..5f5cb722cfc2 100644 > > --- a/arch/arm64/kernel/vdso32/Makefile > > +++ b/arch/arm64/kernel/vdso32/Makefile > > @@ -9,6 +9,10 @@ include $(srctree)/lib/vdso/Makefile > > ifeq ($(CONFIG_CC_IS_CLANG), y) > > CC_COMPAT ?=3D $(CC) > > CC_COMPAT +=3D --target=3Darm-linux-gnueabi > > +# Some distributions (such as Debian) change the default CPU for the > > +# arm-linux-gnueabi target triple, which can break the build. Explicit= ly set > > +# the CPU to generic, which is the default for Linux in LLVM. > > +CC_COMPAT +=3D -mcpu=3Dgeneric > > else > > CC_COMPAT ?=3D $(CROSS_COMPILE_COMPAT)gcc > > endif > > = > > The failures for all the ARCH=3Darm configurations appear to be much mo= re > > difficult to fix because the default CPU value changes based on the > > '-march' value, which basically means that we would have to hardcode > > LLVM's default CPU logic into the kernel's Makefile, which is just not > > maintainable in my opinion. Just doing a multi_v7_defconfig build of > > arch/arm/ shows the value returned from ARM::getARMCPUForArch() in > > llvm/lib/TargetParser/ARMTargetParser.cpp can vary between "arm7tdmi" or > > "generic". Supplying '-mcpu=3Dgeneric' explicitly won't work with > > LLVM_IAS=3D0 because GNU as does not support it and clang just happily > > passes it along, even though it does not do that in the implicit default > > case. > > = > > Sylvestre, I strongly believe you should consider reverting that change > > or give us some compiler flag that allows us to fallback to upstream > > LLVM's default CPU selection logic. I think that hardcoding Debian's > > architecture defintions based on the target triple into the compiler > > could cause issues for other projects as well. For example, > > '--target=3Darm-linux-gnueabi -march=3Darmv7-a' won't actually target A= RMv7: > > = > > $ echo 'int main(void) { asm("dsb"); return 0; }' | \ > > clang --target=3Darm-linux-gnueabi -march=3Darmv7-a \ > > -x c -c -o /dev/null -v - > > ... > > "/usr/bin/clang-17" -cc1 -triple armv7-unknown-linux-gnueabi ... > > ... > > = > > vs. > > = > > $ echo 'int main(void) { asm("dsb"); return 0; }' | \ > > clang --target=3Darm-linux-gnueabi -march=3Darmv7-a \ > > -x c -c -o /dev/null -v - > > ... > > "/bin/clang-18" -cc1 -triple armv5e-unknown-linux-gnueabi ... > > ... > > = > I guess it is this patch, right? > = > https://salsa.debian.org/pkg-llvm-team/llvm-toolchain/-/commit/97633b6d51= ebc8579c5dbecd12a02fb933620620 Right, I should have made that clearer when bringing you in (I linked to the snapshot version of that change further up in the thread). > if so, do you want me to revert it? Yes, I think it should be reverted. Cheers, Nathan _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel