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 15921C4167B for ; Tue, 5 Dec 2023 06:35:37 +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:Subject:Cc:To:From:Date:References: In-Reply-To:Message-Id:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pihiWg2MewLBqt3dnIjFu0LWvMl24tPQDDvp0QENrSs=; b=ySlrges2qKEogW OqnwzbTf1KuHsSyBIqul96ruJJbqllRLjC5c9RBJdJ1V4TWqECjuM4yHRUsRSO3ON6+Tyu4s8ELGU SUnCbPZzAEG9KZg+t2Mm79PU2uS3JYFTRCySu1MLoXV1X+mH0rTMZinZI+YWyTlcDLtmXUDaDk/D1 xqLrUsLzNpQCMGQKQGx09idGpiPI6lHqCOGWcp2RnUVsdsD3JpidQsrisAnEabqIPLcGjV6VSZsxF i1IR+W0FDAvqUQAuIgdLbw+NMJfr4ONXObtNCuhuB6HOa9Q+YtpyEkx61JpmrsRNrQ8SU8AGNSg/2 pgBeVE6JfVKjtiD5zKqQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rAP1T-006PN5-2M; Tue, 05 Dec 2023 06:35:11 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rAP1Q-006PML-1K for linux-arm-kernel@lists.infradead.org; Tue, 05 Dec 2023 06:35:10 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id B93893200A39; Tue, 5 Dec 2023 01:35:01 -0500 (EST) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Tue, 05 Dec 2023 01:35:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1701758101; x=1701844501; bh=Nu G/6/Yb8lCUL8zFD4dfH32Me2vLPL01Z8/hfRvZ+5Q=; b=zbNV8n7Fo/M7Fhfb9S /Zj0Pybk3s74kElk47wi1vWdwOGJECAbQh/Dw9IkxaX05aBnAURLkDpMRjxZwn76 eYX++Ae6lxX2p6zghqBIgnBkn8+KcdJ56QtYRcglV2zxKBR+OX/vnDIkaghnz+3A MK3rb/kOyKZf1sEav96h0WowCLaOHWfIxIsvWuhFU8l4MOR5rix08RvOQmoqrT/6 TJbXVTwgpBj5/7h+tctjongW9UTMpjFO/Yfm++6ZDRDY2geWNJKvi60BRFZteQSr lN3zHgB6k7yILkROoJ717qoojsFm5T5jjderNZQlmx3A/U7RHWbdVS8hS3zsXKRb +jSg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1701758101; x=1701844501; bh=NuG/6/Yb8lCUL 8zFD4dfH32Me2vLPL01Z8/hfRvZ+5Q=; b=cu6M4cDDuig0gcodZ84Nr8YBHIk/e ZdPv4PBhc3A2hKmkT6JlNd1XTuNDwvf3AzavlzwRd5g3mWsApH/0PBnUkaEp9ESb a6FRmjCHqbosnpCh+UXPo5atyselG3EC/BLhaimiHjtcJVP3daCBt5+4HID0gRLc tq5i4IckvVx6UPwDZiSCYPu/TSHIX6ptV46ognEnUsC1OWKLk48eUa14iz2yEke9 BWbuZRrOSxbeSuhlQMk2Xtd2Xv6lo90BtxHh91ojV6WB9HbzVqHWh3wUudkDextN HM2cyvKrL20Js8s0HAoE+JofceHmqe1DBe0ijKfMzndaDWZibBw7+AUHA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudejjedgleekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedftehr nhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrfgrth htvghrnhepffehueegteeihfegtefhjefgtdeugfegjeelheejueethfefgeeghfektdek teffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hrnhgusegrrhhnuggsrdguvg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id E03AAB60089; Tue, 5 Dec 2023 01:35:00 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-1178-geeaf0069a7-fm-20231114.001-geeaf0069 MIME-Version: 1.0 Message-Id: <36a25113-731c-4b28-a695-f3fbb0996d6e@app.fastmail.com> In-Reply-To: <20231204223317.GA2053629@dev-arch.thelio-3990X> References: <20231204181304.GA2043538@dev-arch.thelio-3990X> <20231204223317.GA2053629@dev-arch.thelio-3990X> Date: Tue, 05 Dec 2023 07:34:40 +0100 From: "Arnd Bergmann" To: "Nathan Chancellor" , "Naresh Kamboju" Cc: 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231204_223508_851595_D28C01A7 X-CRM114-Status: GOOD ( 23.73 ) 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 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. > 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. Arnd _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel