linux: use -isystem instead of -I in HOSTCC

A package might install headers that are incompatible with the kernel's
header. One example is the most recent version of pahole (1.24).
HOST_CC includes -I$(HOST_DIR)/include which comes before any include
logic the kernel might have thus forcing the kernel to prefer headers in
HOST_DIR.

The logic to substituting -I with -isystem is taken from
boot/uboot/uboot.mk.

Signed-off-by: Daniel Lang <d.lang@abatec.at>
Reviewed-by: Francis Laniel <flaniel@linux.microsoft.com>
Tested-by: Francis Laniel <flaniel@linux.microsoft.com>
Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
This commit is contained in:
Lang Daniel 2023-02-15 09:58:51 +00:00 committed by Arnout Vandecappelle
parent 863811974e
commit 37be4bda85

View File

@ -150,7 +150,7 @@ endif
# Disable building host tools with -Werror: newer gcc versions can be
# extra picky about some code (https://bugs.busybox.net/show_bug.cgi?id=14826)
LINUX_MAKE_FLAGS = \
HOSTCC="$(HOSTCC) $(HOST_CFLAGS) $(HOST_LDFLAGS)" \
HOSTCC="$(HOSTCC) $(subst -I/,-isystem /,$(subst -I /,-isystem /,$(HOST_CFLAGS))) $(HOST_LDFLAGS)" \
ARCH=$(KERNEL_ARCH) \
INSTALL_MOD_PATH=$(TARGET_DIR) \
CROSS_COMPILE="$(TARGET_CROSS)" \