diff options
author | Masahiro Yamada <masahiroy@kernel.org> | 2022-03-05 13:56:05 +0100 |
---|---|---|
committer | Masahiro Yamada <masahiroy@kernel.org> | 2022-03-31 05:03:46 +0200 |
commit | 9fbed27a7a1101c926718dfa9b49aff1d04477b5 (patch) | |
tree | 9a49015d1354817e11e73fa5472c3c67675f2043 /usr | |
parent | fixdep: use fflush() and ferror() to ensure successful write to files (diff) | |
download | linux-9fbed27a7a1101c926718dfa9b49aff1d04477b5.tar.xz linux-9fbed27a7a1101c926718dfa9b49aff1d04477b5.zip |
kbuild: add --target to correctly cross-compile UAPI headers with Clang
When you compile-test UAPI headers (CONFIG_UAPI_HEADER_TEST=y) with
Clang, they are currently compiled for the host target (likely x86_64)
regardless of the given ARCH=.
In fact, some exported headers include libc headers. For example,
include/uapi/linux/agpgart.h includes <stdlib.h> after being exported.
The header search paths should match to the target we are compiling
them for.
Pick up the --target triple from KBUILD_CFLAGS in the same ways as
commit 7f58b487e9ff ("kbuild: make Clang build userprogs for target
architecture").
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Diffstat (limited to 'usr')
-rw-r--r-- | usr/include/Makefile | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/usr/include/Makefile b/usr/include/Makefile index ac206fb27c65..4215801e1110 100644 --- a/usr/include/Makefile +++ b/usr/include/Makefile @@ -10,7 +10,7 @@ UAPI_CFLAGS := -std=c90 -Wall -Werror=implicit-function-declaration # In theory, we do not care -m32 or -m64 for header compile tests. # It is here just because CONFIG_CC_CAN_LINK is tested with -m32 or -m64. -UAPI_CFLAGS += $(filter -m32 -m64, $(KBUILD_CFLAGS)) +UAPI_CFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CFLAGS)) # USERCFLAGS might contain sysroot location for CC. UAPI_CFLAGS += $(USERCFLAGS) |