[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwvOd=J=84vad_cR06NFDauMXbXsC2o=X4RbPj2cqA1280D=A@mail.gmail.com>
Date: Fri, 28 Jan 2022 15:29:44 -0800
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: Elliot Berman <quic_eberman@...cinc.com>
Cc: Masahiro Yamada <masahiroy@...nel.org>,
Michal Marek <michal.lkml@...kovi.net>,
Nathan Chancellor <nathan@...nel.org>,
Matthias Maennich <maennich@...gle.com>,
linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev, Fangrui Song <maskray@...gle.com>
Subject: Re: [PATCH v2] kbuild: Add environment variables for userprogs flags
On Fri, Jan 28, 2022 at 3:26 PM Elliot Berman <quic_eberman@...cinc.com> wrote:
>
>
>
> On 1/28/2022 2:49 PM, Nick Desaulniers wrote:
> > On Fri, Jan 28, 2022 at 2:45 PM Fangrui Song <maskray@...gle.com> wrote:
> >>
> >> On 2022-01-28, Elliot Berman 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, you can specify flags such as:
> >>>
> >>> $ make USERCFLAGS=--sysroot=/dev/null USERLDFLAGS=-Wl,--sysroot=/dev/null
> >>>
> >>> to force sysroot detection to fail.
> >>
> >> -Wl,--sysroot=/dev/null => --sysroot
> >>
> >> As I mentioned in
> >> https://lore.kernel.org/all/20220128031549.w5a4bilxbkppagfu@google.com/
> >> -Wl,--sysroot=/dev/null does not suppress search paths like -L/lib .
> >
> > In that case, Elliot, can you please test whether USERLDFLAGS is
> > necessary to be specified AT ALL? Maybe we can drop that addition from
> > this patch if so?
>
> USERLDFLAGS as --sysroot=/dev/null isn't necessary and not needed for
> the Android kernel usecase. I've included here since we have HOSTLDFLAGS
> and LDFLAGS for host programs and kernel respectively.
>
Ok, for symmetry it's ok to keep HOSTLDFLAGS, consider dropping it
from the "example" in the commit message. The note about -Wl, prefixes
exists in the docs now which is good enough for me.
--
Thanks,
~Nick Desaulniers
Powered by blists - more mailing lists