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 DEC32C4167B for ; Tue, 5 Dec 2023 15:04:57 +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=MUnLuX5Pw/Zq6EDhqntetwrLpbTKHoXjgefikpZKSzI=; b=WwVaVheFyL3Wxx u6mA4S8OyR+nPYT41L3b8JaadS8XugkEB0i2K64XlVn2AgQGyNuCWLnRhwRpaS+Il+nxFTbkRxTFU AC41wCvl8jgHB6fRFjk1bkbNW3CpcB6kpUmNsQpeor4pFWPeu4Cdz440EjnYY5eleagiW5rmrGPJ1 yqg0uYQMz3F7SANKgaIC+0WcuicgxDrTMILjt/tomc1bmjpSLUJ+HyBErYDWoLYDv9WjCPEgMLWlI 5O4hwekPPy+9VLPN8k5UWDQ/E81QmWs9TFGsu60dKdlSmI6iMSecMXkJXDRNHUSoOq3bFi2uRbzAZ HjFBHKYezoGTB2dQdJyA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rAWyF-007fnU-2w; Tue, 05 Dec 2023 15:04:23 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rAWyD-007fmn-0L for linux-arm-kernel@lists.infradead.org; Tue, 05 Dec 2023 15:04:22 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 9FACC6178F; Tue, 5 Dec 2023 15:04:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA6F8C433C7; Tue, 5 Dec 2023 15:04:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701788660; bh=e8q7+35/iVX1elBCHB500XRbravlaCnerL4Y9qT4K8c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VMvZ5dfO0erFqqjsjz04m6e1D3O7dSzlKfEix3OFQmcThSr6rfVE3Gb7pPV9suXOF O5Lr3rhiq2N0oT2LtOBOSfBmWc3N5tLFyYNdbGbeaSCKkyPQnG07umFycCcyNRDz8u Azr7ljg9RaFfxtCO78IlQpRsH6q4pUC3lbnYZrClFWdmWSkB8MCJuWzIvcXR7ZbM4H yZEPLrmVBQQ8y1lD0JTPJgAXPnoF8dBCteYVriMrPPOy3sll8b4UJCUAz0vd2m0Dka eK8TX2QI/QdhZNcMgMo5uKU1SAtx42iovyaElrGyBF7QE/TddfYKmdotKCt3fuP6va mq5Kvod0WQhfg== Date: Tue, 5 Dec 2023 08:04:17 -0700 From: Nathan Chancellor To: Arnd Bergmann Cc: Naresh Kamboju , clang-built-linux , Linux ARM , open list , Linux Regressions , lkft-triage@lists.linaro.org, Russell King , Nick Desaulniers , Sylvestre Ledru Subject: Re: clang-nightly: vdso/compat_gettimeofday.h:152:15: error: instruction variant requires ARMv6 or later Message-ID: <20231205150417.GA349053@dev-arch.thelio-3990X> References: <20231204181304.GA2043538@dev-arch.thelio-3990X> <20231204223317.GA2053629@dev-arch.thelio-3990X> <36a25113-731c-4b28-a695-f3fbb0996d6e@app.fastmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <36a25113-731c-4b28-a695-f3fbb0996d6e@app.fastmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231205_070421_229146_9FAFEADC X-CRM114-Status: GOOD ( 37.83 ) 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="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Dec 05, 2023 at 07:34:40AM +0100, Arnd Bergmann wrote: > On Mon, Dec 4, 2023, at 23:33, Nathan Chancellor wrote: > > On Mon, Dec 04, 2023 at 11:13:04AM -0700, Nathan Chancellor wrote: > > > >> I am still investigating into what (if anything) can be done to resolve > >> 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=arm-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=generic' (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/vdso32/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 ?= $(CC) > > CC_COMPAT += --target=arm-linux-gnueabi > > +# Some distributions (such as Debian) change the default CPU for the > > +# arm-linux-gnueabi target triple, which can break the build. > > Explicitly set > > +# the CPU to generic, which is the default for Linux in LLVM. > > +CC_COMPAT += -mcpu=generic > > else > > CC_COMPAT ?= $(CROSS_COMPILE_COMPAT)gcc > > endif > > I'm still trying to follow what is actually going on. I > see that we pass > > VDSO_CAFLAGS += -march=armv8-a > > which is meant to tell the compiler that we want it to > use ARMv8 compatible instructions. Is the problem that > clang ignores this flag, or do we not pass it correctly? > > I would have expected -march=armv8-a to be better than > -mcpu=generic here, as it allows the compiler to use > a wider set of instructions that is still guaranteed to > be available on everything it will run on. I should have made it clearer in that message that adding '-mcpu=generic' was only to avoid the logic added by that Debian LLVM change, not because I believe the kernel is doing something incorrectly now. From what I could tell following through LLVM's code, '-march=' determines the default CPU, which is then used to further inform the full target triple and by overriding the CPU where that patch did, it was just blowing away the user's request. By providing an '-mcpu=' option explicitly, it would avoid the default selection logic and we would get what we asked for. > > 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=arm-linux-gnueabi -march=armv7-a' won't actually target ARMv7: > > > > $ echo 'int main(void) { asm("dsb"); return 0; }' | \ > > clang --target=arm-linux-gnueabi -march=armv7-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=arm-linux-gnueabi -march=armv7-a \ > > -x c -c -o /dev/null -v - > > ... > > "/bin/clang-18" -cc1 -triple armv5e-unknown-linux-gnueabi ... > > ... > > Right, the kernel definitely relies on -march= taking > precedence over the default CPU, the same way that we > tell the compiler to pick a non-default endianess or ABI. Agreed, I have yet to test the new version of the patch but I see you and Ard have given input on it, so hopefully it does not have any problems like this. Cheers, Nathan _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel