[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK7LNAQ4wXjLfz_+6QeT06tKr_2Pan0qtxf=adKQtCNagZ+5wQ@mail.gmail.com>
Date: Fri, 28 Jan 2022 11:40:56 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Elliot Berman <quic_eberman@...cinc.com>
Cc: Nick Desaulniers <ndesaulniers@...gle.com>,
Michal Marek <michal.lkml@...kovi.net>,
Nathan Chancellor <nathan@...nel.org>,
Fangrui Song <maskray@...gle.com>,
Matthias Maennich <maennich@...gle.com>,
Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
llvm@...ts.linux.dev, Arnd Bergmann <arnd@...db.de>
Subject: Re: [PATCH] kbuild: Add environment variables for userprogs flags
(+CC: Arnd)
On Thu, Jan 13, 2022 at 7:44 AM Elliot Berman <quic_eberman@...cinc.com> wrote:
>
> Allow additional arguments be passed to userprogs compilation.
> Reproducible clang builds need to provide a sysroot and gcc path to
> ensure same toolchain is used across hosts. KCFLAGS is not currently
> used for any user programs compilation, so add new USERCFLAGS and
> USERLDFLAGS which serves similar purpose as HOSTCFLAGS/HOSTLDFLAGS.
>
> Specifically, I'm trying to force CC_CAN_LINK to consistently fail in
> an environment where a user sysroot is not specifically available.
> Currently, Clang might automatically detect GCC installation on hosts
> which have it installed to a default location in /. With addition of
> these environment variables, our build environment can do like
> "--sysroot=/dev/null" to force sysroot detection to fail.
>
> Signed-off-by: Elliot Berman <quic_eberman@...cinc.com>
> ---
> --- a/usr/include/Makefile
> +++ b/usr/include/Makefile
> @@ -12,6 +12,9 @@ UAPI_CFLAGS := -std=c90 -Wall -Werror=implicit-function-declaration
> # It is here just because CONFIG_CC_CAN_LINK is tested with -m32 or -m64.
> UAPI_CFLAGS += $(filter -m32 -m64, $(KBUILD_CFLAGS))
>
> +# USERCFLAGS might contain sysroot location for CC
> +UAPI_CFLAGS += $(USERCFLAGS)
>
I am OK with this patch, but I was not sure with this line.
Initially, I thought exported UAPI headers should be self-contained.
In other words, we should be able to compile-test them without
relying on compiler or libc headers.
Is this achievable or not?
I think Arnd is an expert in this area.
I hope some input from him.
+
> override c_flags = $(UAPI_CFLAGS) -Wp,-MMD,$(depfile) -I$(objtree)/usr/include
>
> # The following are excluded for now because they fail to build.
> --
> 2.25.1
>
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists