Re: [PATCH v2] kbuild: Add environment variables for userprogs flags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 1/28/2022 2:49 PM, Nick Desaulniers wrote:
  On Fri, Jan 28, 2022 at 2:45 PM Fangrui Song <maskray@xxxxxxxxxx> 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@xxxxxxxxxx/
-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.



[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux