mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
UPSTREAM: 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 commit7f58b487e9("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> Bug: 190019968 Change-Id: I9f4867b4fc1d0c4cf1af2bb3d6f53c3a8a8f4437 (cherry picked from commit9fbed27a7a)
This commit is contained in:
committed by
Nick Desaulniers
parent
d9f210a14d
commit
e6cb41be83
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user