summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
authorElliot Berman <quic_eberman@quicinc.com>2022-02-02 00:35:42 +0300
committerMasahiro Yamada <masahiroy@kernel.org>2022-02-14 04:37:32 +0300
commitf67695c9962e5f444549b3437fb8d840ec6222c8 (patch)
tree96a786f023dd51a8037a55bfc846dacd6c24cb06 /usr
parenta5575df58004e8444e5a2a307407c3f1a6ecf175 (diff)
downloadlinux-f67695c9962e5f444549b3437fb8d840ec6222c8.tar.xz
kbuild: Add environment variables for userprogs flags
Allow additional arguments be passed to userprogs compilation. Reproducible clang builds need to provide a sysroot and gcc path to ensure the 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. Clang might 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=/path/to/sysroot This can also be used to specify different sysroots such as musl or bionic which may be installed on the host in paths that the compiler may not search by default. Signed-off-by: Elliot Berman <quic_eberman@quicinc.com> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Reviewed-by: Fangrui Song <maskray@google.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'usr')
-rw-r--r--usr/include/Makefile3
1 files changed, 3 insertions, 0 deletions
diff --git a/usr/include/Makefile b/usr/include/Makefile
index 83822c33e9e7..5bc0d566cfe0 100644
--- 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)
+
override c_flags = $(UAPI_CFLAGS) -Wp,-MMD,$(depfile) -I$(objtree)/usr/include
# The following are excluded for now because they fail to build.