Messages in this thread | | | From | Masahiro Yamada <> | Date | Fri, 28 Jan 2022 11:40:56 +0900 | 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@quicinc.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@quicinc.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
| |