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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 896CBC433F5 for ; Wed, 13 Oct 2021 03:05:26 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 56DDD60EB4 for ; Wed, 13 Oct 2021 03:05:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 56DDD60EB4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hGo9J8pG+N6T5LRt3rrRd+3caueXBymvIHhc2qGiCYM=; b=irsXwA7OXvX1h9 zTV7y0yjEdoPIP6fkwObUBTFquM+/QSkF4HxKVLMMEDz5o9vWAh/MIiSWxVG1r/IhOoXspzipIFwg eoUbsVxQOcQeHUeBbKWqOt3f2RXwgPQVcaf74O+qaQRCbt5v5ePjqAK2VqTFT4Pcb8sx1Td4hLLha KKaGUwdiYelzFXyNQDZU1eWZJeZPG9+QAp1ecGv2um9x7cgd16TDyE803abyiu2Dyk6EO6O0LFsZK in0qbTVXs4OLlG/oh6cHuf99nQ1yJypxAHsHhuCsWpcEdkRaG/n1X/oHWoStpyLHK9XuL1ntuBi3/ 7uFDyEWaA/6lpnNgox9Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1maUY6-00Egn7-Uy; Wed, 13 Oct 2021 03:03:23 +0000 Received: from conssluserg-02.nifty.com ([210.131.2.81]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1maUY2-00EgmO-FW for linux-arm-kernel@lists.infradead.org; Wed, 13 Oct 2021 03:03:20 +0000 Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) (authenticated) by conssluserg-02.nifty.com with ESMTP id 19D32sqm013926 for ; Wed, 13 Oct 2021 12:02:54 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-02.nifty.com 19D32sqm013926 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1634094174; bh=tNlDnh3wV/mofN17CR9XUn/PjqpItz5YDbO4h+r0dIU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=KkBZPPxtge3npCKyRpwGBeqURAumSl1E5HNdxYSRWJvSFMYTSGTBwL9cZXiA37efI s/ULWHY1LMAUw7syieFs5qjSEgUhf4YhzfVP8Q+3G9N2MG929WGXIhxMQ9NHPocJUU Qmkc22VTV029by29N08Nk0zNcvVHLTGsmzysHWTWvC+FIDwimZcjFXDFCr0rZZcwAS Kyv/92c45+lp3+YKf0k8oeY/yU3WmdqgqRYCLyCGCDpgJMQiM5DEaXDLrkG+vRa1nr I6sd5a3StNb7YFoB51rsbo5WZbAe890p9x3LkzVr72Vtw7wjVw6jaqyzLcpnT9RRZB hw+IJIonCnYcQ== X-Nifty-SrcIP: [209.85.216.41] Received: by mail-pj1-f41.google.com with SMTP id lk8-20020a17090b33c800b001a0a284fcc2so3333871pjb.2 for ; Tue, 12 Oct 2021 20:02:54 -0700 (PDT) X-Gm-Message-State: AOAM530huHVn0NXUwoYQS68VW+5Xph7/6/EUbCyinYsD0vjCjcua6quK a96UJ3PE1ybGeHu6OkBq9N2YVtl6p5wfWRYdtPI= X-Google-Smtp-Source: ABdhPJxU7LZNiD0CqnvHudknEPsQ2Waww+h2Z0Ej9EfhwBvI6wfB6dY2unbVVMrquQxV+Syc5ZF0AH2ALN/h8KSS4iU= X-Received: by 2002:a17:902:f703:b029:12c:982:c9ae with SMTP id h3-20020a170902f703b029012c0982c9aemr33656832plo.20.1634094173755; Tue, 12 Oct 2021 20:02:53 -0700 (PDT) MIME-Version: 1.0 References: <20211012234606.91717-1-ndesaulniers@google.com> <20211012234606.91717-3-ndesaulniers@google.com> In-Reply-To: <20211012234606.91717-3-ndesaulniers@google.com> From: Masahiro Yamada Date: Wed, 13 Oct 2021 12:02:16 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/3] arm64: vdso32: lazily invoke COMPAT_CC To: Nick Desaulniers Cc: Catalin Marinas , Will Deacon , llvm@lists.linux.dev, Linux Kernel Mailing List , linux-arm-kernel , Vincenzo Frascino , Lucas Henneman X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211012_200318_792962_98007EA6 X-CRM114-Status: GOOD ( 25.65 ) 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 Wed, Oct 13, 2021 at 8:46 AM Nick Desaulniers wrote: > > When running the following command without arm-linux-gnueabi-gcc in > one's $PATH, the following warning is observed: > > $ ARCH=arm64 CROSS_COMPILE_COMPAT=arm-linux-gnueabi- make -j72 LLVM=1 mrproper > make[1]: arm-linux-gnueabi-gcc: No such file or directory > > This is because KCONFIG is not run for mrproper, so CONFIG_CC_IS_CLANG > is not set, and we end up eagerly evaluating various variables that try > to invoke CC_COMPAT. > > This is a similar problem to what was observed in > commit 3ec8a5b33dea ("kbuild: do not export LDFLAGS_vmlinux") > > Cc: Masahiro Yamada > Reported-by: Lucas Henneman > Signed-off-by: Nick Desaulniers There are two ways to fix it: [1]: sink the error message to /dev/null (as in commit dc960bfeedb01cf832c5632ed1f3daed4416b142) [2]: use a recursively-expanded variable as you did. "Simple variable (:=) vs recursive variable (=)" is a trade-off. Please be careful about the cost when you try the [2] approach. Simple variables are immediately expanded while parsing Makefile. There are 7 call-sites for cc32-option, hence the compiler is invoked 7 times for building vdso32, 0 times for cleaning. (Since 57fd251c789647552d32d2fc51bedd4f90d70f9f, try-run is no-op for 'make clean'). Recursive variables are expanded every time they are used. IIUC, if_changed expands the command line 3 times. There are 2 objects (note.o and vgettimeofday.o) There are 7 call-sites for cc32-option. So, the compiler is invoked 42 (3 * 2 * 7) times for building vdso32. > --- > arch/arm64/kernel/vdso32/Makefile | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile > index 89299a26638b..d24b12318f4c 100644 > --- a/arch/arm64/kernel/vdso32/Makefile > +++ b/arch/arm64/kernel/vdso32/Makefile > @@ -38,12 +38,12 @@ cc32-disable-warning = $(call try-run,\ > # As a result we set our own flags here. > > # KBUILD_CPPFLAGS and NOSTDINC_FLAGS from top-level Makefile > -VDSO_CPPFLAGS := -DBUILD_VDSO -D__KERNEL__ -nostdinc -isystem $(shell $(CC_COMPAT) -print-file-name=include) > +VDSO_CPPFLAGS = -DBUILD_VDSO -D__KERNEL__ -nostdinc -isystem $(shell $(CC_COMPAT) -print-file-name=include) > VDSO_CPPFLAGS += $(LINUXINCLUDE) > > # Common C and assembly flags > # From top-level Makefile > -VDSO_CAFLAGS := $(VDSO_CPPFLAGS) > +VDSO_CAFLAGS = $(VDSO_CPPFLAGS) > ifneq ($(shell $(CC_COMPAT) --version 2>&1 | head -n 1 | grep clang),) > VDSO_CAFLAGS += --target=$(notdir $(CROSS_COMPILE_COMPAT:%-=%)) > endif > @@ -73,7 +73,7 @@ VDSO_CAFLAGS += -DDISABLE_BRANCH_PROFILING > VDSO_CAFLAGS += $(call cc32-option,-march=armv8-a -D__LINUX_ARM_ARCH__=8,\ > -march=armv7-a -D__LINUX_ARM_ARCH__=7) > > -VDSO_CFLAGS := $(VDSO_CAFLAGS) > +VDSO_CFLAGS = $(VDSO_CAFLAGS) > VDSO_CFLAGS += -DENABLE_COMPAT_VDSO=1 > # KBUILD_CFLAGS from top-level Makefile > VDSO_CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ > @@ -108,7 +108,7 @@ else > VDSO_CFLAGS += -marm > endif > > -VDSO_AFLAGS := $(VDSO_CAFLAGS) > +VDSO_AFLAGS = $(VDSO_CAFLAGS) > VDSO_AFLAGS += -D__ASSEMBLY__ > > # From arm vDSO Makefile > -- > 2.33.0.882.g93a45727a2-goog > -- Best Regards Masahiro Yamada _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel