Received: by 2002:a9a:4c47:0:b029:116:c383:538 with SMTP id u7csp1217058lko; Tue, 13 Jul 2021 19:51:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPKiMcfrkOE9t1LA8wsYjECyCvodzppPUcnM+zP2jhEP0dbMhNp7GMcc/pifNVkH3TKOst X-Received: by 2002:a17:906:990f:: with SMTP id zl15mr9575646ejb.34.1626231081742; Tue, 13 Jul 2021 19:51:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626231081; cv=none; d=google.com; s=arc-20160816; b=bSR3y7+oCo6JrGSdZSRxXw0LSX8WePXF/aQyyB+n2q54dx4LaHZqF+jmMxIuWPPfrk iiFtIdz7To0IC3cc9bp+ihsX5eJxvSFPT3oniBTA87hjUb1V0CvLyTH/TXm79OLHeJFV k+ZtZkWClIMMwytnM3JhSzI2Bxn9dr5Gj7tLji2BQTdQ2craTd7uLzvz7BAxdctutY3s CTGFOranSYf38RQ1YAVloP7IBMnfnbf7dO2k/vX+rpv47W/8XFFBXLQa7P0FvkUe8KGj 2+TyoC0df9igfdOXJAitcYsmapeL+bM5dTKcovj169XrEnq8kvqq6tQ74DWsK/XJh/rR ukhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature:dkim-filter; bh=LnUl50BHavFxu7eFMFZuwtQbwZaQ3SxkzsrU6pPoM7I=; b=v6iBng+D6vdufU75uYthjFQeu1ZPvVnT2xmsIt0a3AaFop8Mmj93vklgtBecDt+p29 yct+DyVBTbARL28KDgceZ/UI0343qx2kzQwxlGmc8WPSnkSgmVm1GboKYhyVMnvkvN6b WUF5TLFWaeckA2GrKjMzNcbSh/ROQJsWfgFXWBwibc5X1ldc1p2cSrEU0W+GcnYNnNNx aFL8gjfFgT5NCtrtkIm3ICxiItXntNmugve7D40lyKhX13h5dkMIUSpaNYC6g0CbqhDN uIW129X+b7fQjofwvqA8F0FoDsj73pVxdX78uubGoMecpfo8K/YNizuIz5BjLRO7ayZy SQxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Psy593hp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r18si1031823edd.215.2021.07.13.19.51.00; Tue, 13 Jul 2021 19:51:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Psy593hp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S237717AbhGNCuP (ORCPT + 99 others); Tue, 13 Jul 2021 22:50:15 -0400 Received: from conssluserg-05.nifty.com ([210.131.2.90]:43013 "EHLO conssluserg-05.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237711AbhGNCuP (ORCPT ); Tue, 13 Jul 2021 22:50:15 -0400 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (authenticated) by conssluserg-05.nifty.com with ESMTP id 16E2kpEp022366; Wed, 14 Jul 2021 11:47:02 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-05.nifty.com 16E2kpEp022366 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1626230823; bh=LnUl50BHavFxu7eFMFZuwtQbwZaQ3SxkzsrU6pPoM7I=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Psy593hpyuA7XOSRMzLMTnIeUC25fyGRxvJibNDgsQjrqHZnaNDKKrN20sKNAZkes r5scIcpH+sssgVPnbqdapUVPjk1bXKq21cEVedya811OPMq6RU4+GTssyJbmLtH1+k VhA8McCMD4e6sdjhXW2yiQ8LRtKmnB46TxqoEDwQxIvRgwa6nGzb1GKegIjvrgWwUw MTPNHDmOVAtJHcxTJLnaHl6rnKeff9/4oRTCsXg4xy6WZe3+ILQ9RWUF3LL8fEgXbQ Hnutfpn4CiOeDBxtUxIO2spRVzu9S42+cTE215XZwoMfJjtpSTZq2PzoD32oTykbr0 GMqE8rFGKo96A== X-Nifty-SrcIP: [209.85.214.178] Received: by mail-pl1-f178.google.com with SMTP id v14so717196plg.9; Tue, 13 Jul 2021 19:47:02 -0700 (PDT) X-Gm-Message-State: AOAM533fEbf4QTfEhx+yg1q5rEcScgs1lFGQG39UWVA50ZmZxlNxipwF VPZF/n+RHCF9587igrUxIc9ArvMxN4iWDs2hzV0= X-Received: by 2002:a17:90a:c506:: with SMTP id k6mr1447795pjt.198.1626230811130; Tue, 13 Jul 2021 19:46:51 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Masahiro Yamada Date: Wed, 14 Jul 2021 11:46:13 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 1/1] Kbuild, clang: add option for choosing a ThinLTO cache directory To: Tor Vic Cc: "linux-kernel@vger.kernel.org" , Nathan Chancellor , "ndesaulniers@google.com" , Kees Cook , Linux Kbuild mailing list , "clang-built-linux@googlegroups.com" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 14, 2021 at 1:41 AM Tor Vic wrote: > > On some distros and configurations, it might be useful to allow for > specifying a directory where Clang stores its ThinLTO cache. > > More specifically, when building the VirtualBox extramodules on Arch with > its proper 'makepkg' build system and DKMS, against an already installed > ThinLTO kernel, the build fails because it tries to create the ThinLTO > cache in a directory that is not user-writable. Again, I do not understand. Is this fixing the root cause? To me, it looks like "Anyway, this worked for me" patch. Besides, 'make clean' will never clean up the cache directory. > A similar problem has been reported with openSUSE's OBS build system. > > Add a Kconfig option that allows users to choose a directory in which > Clang's ThinLTO can store its cache. > > Link: https://github.com/ClangBuiltLinux/linux/issues/1104 > Signed-off-by: Tor Vic > --- > Changes from v1 to v2: remove unneeded changes in scripts/Makefile > > Makefile | 5 +++-- > arch/Kconfig | 10 ++++++++++ > 2 files changed, 13 insertions(+), 2 deletions(-) > > diff --git a/Makefile b/Makefile > index c3f9bd191b89..472bc8bfff03 100644 > --- a/Makefile > +++ b/Makefile > @@ -932,7 +932,8 @@ endif > ifdef CONFIG_LTO_CLANG > ifdef CONFIG_LTO_CLANG_THIN > CC_FLAGS_LTO := -flto=thin -fsplit-lto-unit > -KBUILD_LDFLAGS += --thinlto-cache-dir=$(extmod_prefix).thinlto-cache > +export thinlto-dir = $(if > $(CONFIG_LTO_CLANG_THIN_CACHEDIR),$(CONFIG_LTO_CLANG_THIN_CACHEDIR)/) > +KBUILD_LDFLAGS += > --thinlto-cache-dir=$(thinlto-dir)$(extmod_prefix).thinlto-cache > else > CC_FLAGS_LTO := -flto > endif > @@ -1728,7 +1729,7 @@ PHONY += compile_commands.json > > clean-dirs := $(KBUILD_EXTMOD) > clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers > $(KBUILD_EXTMOD)/modules.nsdeps \ > - $(KBUILD_EXTMOD)/compile_commands.json $(KBUILD_EXTMOD)/.thinlto-cache > + $(KBUILD_EXTMOD)/compile_commands.json > $(thinlto-dir)$(KBUILD_EXTMOD)/.thinlto-cache > > PHONY += help > help: > diff --git a/arch/Kconfig b/arch/Kconfig > index 129df498a8e1..19e4d140e12a 100644 > --- a/arch/Kconfig > +++ b/arch/Kconfig > @@ -696,6 +696,16 @@ config LTO_CLANG_THIN > https://clang.llvm.org/docs/ThinLTO.html > > If unsure, say Y. > + > +config LTO_CLANG_THIN_CACHEDIR > + string "Clang ThinLTO cache directory" > + depends on LTO_CLANG_THIN > + default "" > + help > + This option allows users to choose a directory that stores > + Clang's ThinLTO cache. > + Leave empty for default. > + > endchoice > > config ARCH_SUPPORTS_CFI_CLANG > -- > 2.32.0 > -- Best Regards Masahiro Yamada