[klibc] [klibc:master] Kbuild: Fix include path for Clang builds

klibc-bot for Ben Hutchings ben at decadent.org.uk
Mon Dec 27 07:24:06 PST 2021


Commit-ID:  1643d07ebc9a776e90d4af62343c3339cfe2b324
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=1643d07ebc9a776e90d4af62343c3339cfe2b324
Author:     Ben Hutchings <ben at decadent.org.uk>
AuthorDate: Mon, 27 Dec 2021 15:46:14 +0100
Committer:  Ben Hutchings <ben at decadent.org.uk>
CommitDate: Mon, 27 Dec 2021 16:21:57 +0100

[klibc] Kbuild: Fix include path for Clang builds

Currently we add the Clang system header directory to the include path
with a -I option in Kbuild.klibc.  This causes it to be searched
before any include directories added by Kbuild files in individual
source directories.

In particular, Clang 13 added a "builtins.h" header which is found
before dash's generated "builtins.h" in the case of an out-of-tree
build.

Use the -isystem option instead, putting this directory after any
directories specified with -I.

Signed-off-by: Ben Hutchings <ben at decadent.org.uk>

---
 scripts/Kbuild.klibc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/Kbuild.klibc b/scripts/Kbuild.klibc
index 45b4e84a..e88bc003 100644
--- a/scripts/Kbuild.klibc
+++ b/scripts/Kbuild.klibc
@@ -115,7 +115,7 @@ KLIBCCPPFLAGS    := -nostdinc -iwithprefix include \
                     -I$(KLIBCOBJ)/../include		\
                     -I$(KLIBCINC)
 ifeq ($(cc-name),clang)
-KLIBCCPPFLAGS    += -I$(shell $(KLIBCCC) $(KLIBCCFLAGS) --print-file-name=include)
+KLIBCCPPFLAGS    += -isystem $(shell $(KLIBCCC) $(KLIBCCFLAGS) --print-file-name=include)
 endif
 
 # kernel include paths


More information about the klibc mailing list