public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Adrian Ratiu <adrian.ratiu@collabora.com>
Cc: llvm@lists.linux.dev, linux-kernel@vger.kernel.org,
	Nick Desaulniers <ndesaulniers@google.com>,
	Manoj Gupta <manojgupta@chromium.com>
Subject: Re: [PATCH] tools: fix unavoidable GCC call in Clang builds
Date: Thu, 17 Feb 2022 11:10:42 -0700	[thread overview]
Message-ID: <Yg6PousYSZXimFCS@dev-arch.archlinux-ax161> (raw)
In-Reply-To: <20220217033648.1453303-1-adrian.ratiu@collabora.com>

Hi Adrian

On Thu, Feb 17, 2022 at 05:36:48AM +0200, Adrian Ratiu wrote:
> In ChromeOS and Gentoo we catch any unwanted mixed Clang/LLVM
> and GCC/binutils usage via toolchain wrappers which fail builds.

Neat for hermetic builds.

> This has revealed that GCC is called unconditionally in Clang
> configured builds to populate GCC_TOOLCHAIN_DIR.
> 
> Allow overriding the variable to avoid the GCC call - in our
> case we can set GCC_TOOLCHAIN_DIR directly in the ebuild recipe.

Would you just set GCC_TOOLCHAIN_DIR to nothing to avoid triggering the
'gcc -print-sysroot' call?

An alternative might be allowing CLANG_CROSS_FLAGS to be supplied by the
user, so that you can stil benefit from cross compiling tools, but with
the flags and sysroot that you expect.

> Suggested-by: Manoj Gupta <manojgupta@chromium.com>
> Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>

Regardless, as long as it works for your use case:

Acked-by: Nathan Chancellor <nathan@kernel.org>

The change that this patch fixes [1] went via bpf-next [2] last cycle,
you could either target that tree to have it fixed for 5.18 or make a
case for having it merged in the 5.17 cycle via bpf [3]. I would resend
this change to the kernel/bpf maintainers, as Nick and I do not
currently pick up patches.

[1]: https://lore.kernel.org/r/20211216163842.829836-2-jean-philippe@linaro.org/
[2]: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/
[3]: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git/

> ---
>  tools/scripts/Makefile.include | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include
> index 79d102304470..98c098c064dd 100644
> --- a/tools/scripts/Makefile.include
> +++ b/tools/scripts/Makefile.include
> @@ -90,7 +90,7 @@ EXTRA_WARNINGS += -Wstrict-aliasing=3
>  
>  else ifneq ($(CROSS_COMPILE),)
>  CLANG_CROSS_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%))
> -GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)gcc 2>/dev/null))
> +GCC_TOOLCHAIN_DIR ?= $(dir $(shell which $(CROSS_COMPILE)gcc 2>/dev/null))
>  ifneq ($(GCC_TOOLCHAIN_DIR),)
>  CLANG_CROSS_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
>  CLANG_CROSS_FLAGS += --sysroot=$(shell $(CROSS_COMPILE)gcc -print-sysroot)
> -- 
> 2.35.0
> 

  reply	other threads:[~2022-02-17 18:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-17  3:36 [PATCH] tools: fix unavoidable GCC call in Clang builds Adrian Ratiu
2022-02-17 18:10 ` Nathan Chancellor [this message]
2022-02-18  7:27   ` Adrian Ratiu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yg6PousYSZXimFCS@dev-arch.archlinux-ax161 \
    --to=nathan@kernel.org \
    --cc=adrian.ratiu@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=manojgupta@chromium.com \
    --cc=ndesaulniers@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox