From: Jan Kiszka <[email protected]>

Since 4.17, kbuild pulls in linux/compiler_types.h via -include in a way
we cannot avoid as long as we are using kbuild. This is not only against
our intention to avoid kernel headers for everything but the driver
module, it also breaks the build as we do not provide a search path for
the headers that compiler_types.h includes itself.

Fortunately, we can avoid the evaluation of that header simply by
defining its include guard.

Signed-off-by: Jan Kiszka <[email protected]>
---
 configs/Makefile    | 2 +-
 hypervisor/Makefile | 3 ++-
 inmates/Makefile    | 3 ++-
 tools/Makefile      | 1 +
 4 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/configs/Makefile b/configs/Makefile
index 5396bbcb0..1e59840e7 100644
--- a/configs/Makefile
+++ b/configs/Makefile
@@ -15,7 +15,7 @@
 LINUXINCLUDE := -I$(src)/../hypervisor/arch/$(SRCARCH)/include \
                -I$(src)/../hypervisor/include \
                -I$(src)/../include
-KBUILD_CFLAGS := -Wextra
+KBUILD_CFLAGS := -Wextra -D__LINUX_COMPILER_TYPES_H
 
 ifneq ($(wildcard $(obj)/../include/jailhouse/config.h),)
 KBUILD_CFLAGS += -include $(obj)/../include/jailhouse/config.h
diff --git a/hypervisor/Makefile b/hypervisor/Makefile
index 5d441a035..1d809fd65 100644
--- a/hypervisor/Makefile
+++ b/hypervisor/Makefile
@@ -26,7 +26,8 @@ LINUXINCLUDE := -I$(src)/arch/$(SRCARCH)/include \
 KBUILD_CFLAGS := -g -Os -Wall -Wstrict-prototypes -Wtype-limits \
                 -Wmissing-declarations -Wmissing-prototypes \
                 -fno-strict-aliasing -fno-pic -fno-common \
-                -fno-stack-protector -fno-builtin-ffsl
+                -fno-stack-protector -fno-builtin-ffsl \
+                -D__LINUX_COMPILER_TYPES_H
 
 include $(src)/arch/$(SRCARCH)/Makefile
 
diff --git a/inmates/Makefile b/inmates/Makefile
index 2f26bf55d..595338d54 100644
--- a/inmates/Makefile
+++ b/inmates/Makefile
@@ -27,7 +27,8 @@ LINUXINCLUDE  := $(INCLUDES)
 KBUILD_CFLAGS := -g -Os -Wall -Wstrict-prototypes -Wtype-limits \
                 -Wmissing-declarations -Wmissing-prototypes \
                 -fno-strict-aliasing -fomit-frame-pointer -fno-pic \
-                -fno-common -fno-stack-protector -ffreestanding
+                -fno-common -fno-stack-protector -ffreestanding \
+                -D__LINUX_COMPILER_TYPES_H
 ifneq ($(wildcard $(INC_CONFIG_H)),)
 KBUILD_CFLAGS += -include $(INC_CONFIG_H)
 endif
diff --git a/tools/Makefile b/tools/Makefile
index 6bab351a5..c94c7981e 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -20,6 +20,7 @@ NOSTDINC_FLAGS :=
 LINUXINCLUDE := -I$(src)/../driver
 KBUILD_CFLAGS := -g -O3 -DLIBEXECDIR=\"$(libexecdir)\" \
        -Wall -Wextra -Wmissing-declarations -Wmissing-prototypes -Werror \
+       -D__LINUX_COMPILER_TYPES_H \
        -DJAILHOUSE_VERSION=\"$(shell cat $(src)/../VERSION)\" $(EXTRA_CFLAGS)
 LDFLAGS :=
 
-- 
2.13.6

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to