summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/kbuild/headers_install.rst7
-rw-r--r--Documentation/kbuild/kbuild.rst9
-rw-r--r--Documentation/kbuild/makefiles.rst22
-rw-r--r--Makefile117
-rw-r--r--arch/arc/Makefile2
-rw-r--r--arch/arc/configs/tb10x_defconfig1
-rw-r--r--arch/nds32/configs/defconfig1
-rw-r--r--arch/parisc/Makefile12
-rw-r--r--arch/parisc/configs/a500_defconfig1
-rw-r--r--arch/parisc/configs/b180_defconfig1
-rw-r--r--arch/parisc/configs/c3000_defconfig1
-rw-r--r--arch/parisc/configs/default_defconfig1
-rw-r--r--arch/powerpc/configs/ppc6xx_defconfig1
-rw-r--r--arch/s390/configs/debug_defconfig1
-rw-r--r--arch/um/Makefile2
-rw-r--r--drivers/gpu/drm/i915/.gitignore1
-rw-r--r--drivers/gpu/drm/i915/Makefile.header-test12
-rw-r--r--include/Kbuild1270
-rw-r--r--include/uapi/Kbuild (renamed from include/uapi/linux/Kbuild)6
-rw-r--r--init/Kconfig33
-rwxr-xr-xkernel/gen_kheaders.sh51
-rw-r--r--lib/Kconfig.debug25
-rw-r--r--lib/raid6/Makefile98
-rw-r--r--net/bpfilter/Kconfig2
-rw-r--r--samples/Kconfig14
-rw-r--r--samples/Makefile4
-rw-r--r--scripts/Kbuild.include28
-rw-r--r--scripts/Makefile5
-rw-r--r--scripts/Makefile.build11
-rw-r--r--scripts/Makefile.extrawarn3
-rw-r--r--scripts/Makefile.headersinst134
-rw-r--r--scripts/Makefile.host2
-rw-r--r--scripts/Makefile.lib26
-rw-r--r--scripts/Makefile.modbuiltin2
-rw-r--r--scripts/basic/fixdep.c51
-rw-r--r--scripts/coccinelle/api/kstrdup.cocci8
-rw-r--r--scripts/coccinelle/api/stream_open.cocci8
-rw-r--r--scripts/coccinelle/free/put_device.cocci11
-rw-r--r--scripts/gdb/linux/Makefile2
-rw-r--r--scripts/genksyms/keywords.c4
-rw-r--r--scripts/genksyms/parse.y2
-rwxr-xr-xscripts/headers.sh29
-rwxr-xr-xscripts/headers_install.sh48
-rw-r--r--scripts/kallsyms.c3
-rwxr-xr-xscripts/package/builddeb2
-rwxr-xr-xscripts/package/mkspec2
-rwxr-xr-xscripts/tags.sh43
-rw-r--r--tools/testing/selftests/Makefile2
-rw-r--r--tools/testing/selftests/lib.mk4
-rw-r--r--usr/.gitignore1
-rw-r--r--usr/Makefile2
-rw-r--r--usr/include/.gitignore3
-rw-r--r--usr/include/Makefile132
53 files changed, 1805 insertions, 458 deletions
diff --git a/Documentation/kbuild/headers_install.rst b/Documentation/kbuild/headers_install.rst
index 1ab7294e41ac..f6c6b74a609c 100644
--- a/Documentation/kbuild/headers_install.rst
+++ b/Documentation/kbuild/headers_install.rst
@@ -40,12 +40,5 @@ INSTALL_HDR_PATH indicates where to install the headers. It defaults to
An 'include' directory is automatically created inside INSTALL_HDR_PATH and
headers are installed in 'INSTALL_HDR_PATH/include'.
-The command "make headers_install_all" exports headers for all architectures
-simultaneously. (This is mostly of interest to distribution maintainers,
-who create an architecture-independent tarball from the resulting include
-directory.) You also can use HDR_ARCH_LIST to specify list of architectures.
-Remember to provide the appropriate linux/asm directory via "mv" or "ln -s"
-before building a C library with headers exported this way.
-
The kernel header export infrastructure is maintained by David Woodhouse
<dwmw2@infradead.org>.
diff --git a/Documentation/kbuild/kbuild.rst b/Documentation/kbuild/kbuild.rst
index e774e760522d..b25548963d70 100644
--- a/Documentation/kbuild/kbuild.rst
+++ b/Documentation/kbuild/kbuild.rst
@@ -200,6 +200,15 @@ The output directory is often set using "O=..." on the commandline.
The value can be overridden in which case the default value is ignored.
+KBUILD_ABS_SRCTREE
+--------------------------------------------------
+Kbuild uses a relative path to point to the tree when possible. For instance,
+when building in the source tree, the source tree path is '.'
+
+Setting this flag requests Kbuild to use absolute path to the source tree.
+There are some useful cases to do so, like when generating tag files with
+absolute path entries etc.
+
KBUILD_SIGN_PIN
---------------
This variable allows a passphrase or PIN to be passed to the sign-file
diff --git a/Documentation/kbuild/makefiles.rst b/Documentation/kbuild/makefiles.rst
index 9274cdcc9bd2..093f2d79ab95 100644
--- a/Documentation/kbuild/makefiles.rst
+++ b/Documentation/kbuild/makefiles.rst
@@ -999,11 +999,7 @@ When kbuild executes, the following steps are followed (roughly):
------------------------------------
The archheaders: rule is used to generate header files that
- may be installed into user space by "make header_install" or
- "make headers_install_all". In order to support
- "make headers_install_all", this target has to be able to run
- on an unconfigured tree, or a tree configured for another
- architecture.
+ may be installed into user space by "make header_install".
It is run before "make archprepare" when run on the
architecture itself.
@@ -1140,6 +1136,22 @@ When kbuild executes, the following steps are followed (roughly):
In this example, extra-y is used to list object files that
shall be built, but shall not be linked as part of built-in.a.
+ header-test-y
+
+ header-test-y specifies headers (*.h) in the current directory that
+ should be compile tested to ensure they are self-contained,
+ i.e. compilable as standalone units. If CONFIG_HEADER_TEST is enabled,
+ this builds them as part of extra-y.
+
+ header-test-pattern-y
+
+ This works as a weaker version of header-test-y, and accepts wildcard
+ patterns. The typical usage is:
+
+ header-test-pattern-y += *.h
+
+ This specifies all the files that matches to '*.h' in the current
+ directory, but the files in 'header-test-' are excluded.
6.7 Commands useful for building a boot image
---------------------------------------------
diff --git a/Makefile b/Makefile
index 3e4868a6498b..2c5d00ba537e 100644
--- a/Makefile
+++ b/Makefile
@@ -212,6 +212,13 @@ endif
ifdef SUBDIRS
$(warning ================= WARNING ================)
$(warning 'SUBDIRS' will be removed after Linux 5.3)
+ $(warning )
+ $(warning If you are building an individual subdirectory)
+ $(warning in the kernel tree, you can do like this:)
+ $(warning $$ make path/to/dir/you/want/to/build/)
+ $(warning (Do not forget the trailing slash))
+ $(warning )
+ $(warning If you are building an external module,)
$(warning Please use 'M=' or 'KBUILD_EXTMOD' instead)
$(warning ==========================================)
KBUILD_EXTMOD ?= $(SUBDIRS)
@@ -221,9 +228,12 @@ ifeq ("$(origin M)", "command line")
KBUILD_EXTMOD := $(M)
endif
+export KBUILD_CHECKSRC KBUILD_EXTMOD
+
ifeq ($(abs_srctree),$(abs_objtree))
# building in the source tree
srctree := .
+ building_out_of_srctree :=
else
ifeq ($(abs_srctree)/,$(dir $(abs_objtree)))
# building in a subdirectory of the source tree
@@ -231,22 +241,17 @@ else
else
srctree := $(abs_srctree)
endif
-
- # TODO:
- # KBUILD_SRC is only used to distinguish in-tree/out-of-tree build.
- # Replace it with $(srctree) or something.
- KBUILD_SRC := $(abs_srctree)
+ building_out_of_srctree := 1
endif
-export KBUILD_CHECKSRC KBUILD_EXTMOD KBUILD_SRC
+ifneq ($(KBUILD_ABS_SRCTREE),)
+srctree := $(abs_srctree)
+endif
objtree := .
-src := $(srctree)
-obj := $(objtree)
-
VPATH := $(srctree)
-export srctree objtree VPATH
+export building_out_of_srctree srctree objtree VPATH
# To make sure we do not include .config for any of the *config targets
# catch them early, and hand them over to scripts/kconfig/Makefile
@@ -262,7 +267,7 @@ old_version_h := include/linux/version.h
clean-targets := %clean mrproper cleandocs
no-dot-config-targets := $(clean-targets) \
cscope gtags TAGS tags help% %docs check% coccicheck \
- $(version_h) headers_% archheaders archscripts \
+ $(version_h) headers headers_% archheaders archscripts \
%asm-generic kernelversion %src-pkg
no-sync-config-targets := $(no-dot-config-targets) install %install \
kernelrelease
@@ -449,7 +454,7 @@ USERINCLUDE := \
LINUXINCLUDE := \
-I$(srctree)/arch/$(SRCARCH)/include \
-I$(objtree)/arch/$(SRCARCH)/include/generated \
- $(if $(filter .,$(srctree)),,-I$(srctree)/include) \
+ $(if $(building_out_of_srctree),-I$(srctree)/include) \
-I$(objtree)/include \
$(USERINCLUDE)
@@ -510,7 +515,7 @@ PHONY += outputmakefile
# At the same time when output Makefile generated, generate .gitignore to
# ignore whole output directory
outputmakefile:
-ifneq ($(srctree),.)
+ifdef building_out_of_srctree
$(Q)ln -fsn $(srctree) source
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree)
$(Q)test -e .gitignore || \
@@ -527,7 +532,10 @@ endif
ifneq ($(GCC_TOOLCHAIN),)
CLANG_FLAGS += --gcc-toolchain=$(GCC_TOOLCHAIN)
endif
+ifeq ($(shell $(AS) --version 2>&1 | head -n 1 | grep clang),)
CLANG_FLAGS += -no-integrated-as
+endif
+CLANG_FLAGS += -Werror=unknown-warning-option
KBUILD_CFLAGS += $(CLANG_FLAGS)
KBUILD_AFLAGS += $(CLANG_FLAGS)
export CLANG_FLAGS
@@ -608,6 +616,7 @@ ifeq ($(KBUILD_EXTMOD),)
init-y := init/
drivers-y := drivers/ sound/
drivers-$(CONFIG_SAMPLES) += samples/
+drivers-$(CONFIG_KERNEL_HEADER_TEST) += include/
net-y := net/
libs-y := lib/
core-y := usr/
@@ -1053,9 +1062,6 @@ vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE
targets := vmlinux
-# Some samples need headers_install.
-samples: headers_install
-
# The actual objects are generated when descending,
# make sure no implicit rule kicks in
$(sort $(vmlinux-deps)): $(vmlinux-dirs) ;
@@ -1096,12 +1102,12 @@ PHONY += prepare archprepare prepare1 prepare3
# and if so do:
# 1) Check that make has not been executed in the kernel src $(srctree)
prepare3: include/config/kernel.release
-ifneq ($(srctree),.)
+ifdef building_out_of_srctree
@$(kecho) ' Using $(srctree) as source for kernel'
$(Q)if [ -f $(srctree)/.config -o \
-d $(srctree)/include/config -o \
-d $(srctree)/arch/$(SRCARCH)/include/generated ]; then \
- echo >&2 " $(srctree) is not clean, please run 'make mrproper'"; \
+ echo >&2 " $(srctree) is not clean, please run 'make ARCH=$(ARCH) mrproper'"; \
echo >&2 " in the '$(srctree)' directory.";\
/bin/false; \
fi;
@@ -1181,39 +1187,44 @@ headerdep:
#Default location for installed headers
export INSTALL_HDR_PATH = $(objtree)/usr
-# If we do an all arch process set dst to include/arch-$(SRCARCH)
-hdr-dst = $(if $(KBUILD_HEADERS), dst=include/arch-$(SRCARCH), dst=include)
+quiet_cmd_headers_install = INSTALL $(INSTALL_HDR_PATH)/include
+ cmd_headers_install = \
+ mkdir -p $(INSTALL_HDR_PATH); \
+ rsync -mrl --include='*/' --include='*\.h' --exclude='*' \
+ usr/include $(INSTALL_HDR_PATH)
-PHONY += archheaders archscripts
+PHONY += headers_install
+headers_install: headers
+ $(call cmd,headers_install)
-PHONY += __headers
-__headers: $(version_h) scripts_basic uapi-asm-generic archheaders archscripts
- $(Q)$(MAKE) $(build)=scripts build_unifdef
+PHONY += archheaders archscripts
-PHONY += headers_install_all
-headers_install_all:
- $(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh install
+hdr-inst := -f $(srctree)/scripts/Makefile.headersinst obj
-PHONY += headers_install
-headers_install: __headers
+PHONY += headers
+headers: $(version_h) scripts_unifdef uapi-asm-generic archheaders archscripts
$(if $(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/Kbuild),, \
$(error Headers not exportable for the $(SRCARCH) architecture))
- $(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include
- $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi $(hdr-dst)
-
-PHONY += headers_check_all
-headers_check_all: headers_install_all
- $(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh check
+ $(Q)$(MAKE) $(hdr-inst)=include/uapi
+ $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi
PHONY += headers_check
-headers_check: headers_install
- $(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include HDRCHECK=1
- $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi $(hdr-dst) HDRCHECK=1
+headers_check: headers
+ $(Q)$(MAKE) $(hdr-inst)=include/uapi HDRCHECK=1
+ $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi HDRCHECK=1
+
+ifdef CONFIG_HEADERS_INSTALL
+prepare: headers
+endif
ifdef CONFIG_HEADERS_CHECK
all: headers_check
endif
+PHONY += scripts_unifdef
+scripts_unifdef: scripts_basic
+ $(Q)$(MAKE) $(build)=scripts scripts/unifdef
+
# ---------------------------------------------------------------------------
# Kernel selftest
@@ -1283,18 +1294,24 @@ all: modules
# using awk while concatenating to the final file.
PHONY += modules
-modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin
- $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order
+modules: $(if $(KBUILD_BUILTIN),vmlinux) modules.order modules.builtin
@$(kecho) ' Building modules, stage 2.';
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh
-modules.builtin: $(vmlinux-dirs:%=%/modules.builtin)
- $(Q)$(AWK) '!x[$$0]++' $^ > $(objtree)/modules.builtin
+modules.order: $(vmlinux-dirs)
+ $(Q)$(AWK) '!x[$$0]++' $(addsuffix /$@, $(vmlinux-dirs)) > $@
+
+modbuiltin-dirs := $(addprefix _modbuiltin_, $(vmlinux-dirs))
-%/modules.builtin: include/config/auto.conf include/config/tristate.conf
- $(Q)$(MAKE) $(modbuiltin)=$*
+modules.builtin: $(modbuiltin-dirs)
+ $(Q)$(AWK) '!x[$$0]++' $(addsuffix /$@, $(vmlinux-dirs)) > $@
+PHONY += $(modbuiltin-dirs)
+# tristate.conf is not included from this Makefile. Add it as a prerequisite
+# here to make it self-healing in case somebody accidentally removes it.
+$(modbuiltin-dirs): include/config/tristate.conf
+ $(Q)$(MAKE) $(modbuiltin)=$(patsubst _modbuiltin_%,%,$@)
# Target to prepare building external modules
PHONY += modules_prepare
@@ -1360,7 +1377,7 @@ CLEAN_DIRS += $(MODVERDIR) include/ksym
CLEAN_FILES += modules.builtin.modinfo
# Directories & files removed with 'make mrproper'
-MRPROPER_DIRS += include/config usr/include include/generated \
+MRPROPER_DIRS += include/config include/generated \
arch/$(SRCARCH)/include/generated .tmp_objdiff
MRPROPER_FILES += .config .config.old .version \
Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \
@@ -1551,7 +1568,7 @@ $(DOC_TARGETS): scripts_basic FORCE
# ---------------------------------------------------------------------------
PHONY += scripts_gdb
-scripts_gdb: prepare
+scripts_gdb: prepare0
$(Q)$(MAKE) $(build)=scripts/gdb
$(Q)ln -fsn $(abspath $(srctree)/scripts/gdb/vmlinux-gdb.py)
@@ -1698,7 +1715,7 @@ CHECKSTACK_ARCH := $(ARCH)
endif
checkstack:
$(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \
- $(PERL) $(src)/scripts/checkstack.pl $(CHECKSTACK_ARCH)
+ $(PERL) $(srctree)/scripts/checkstack.pl $(CHECKSTACK_ARCH)
kernelrelease:
@echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))"
@@ -1717,11 +1734,11 @@ endif
tools/: FORCE
$(Q)mkdir -p $(objtree)/tools
- $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(src)/tools/
+ $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/
tools/%: FORCE
$(Q)mkdir -p $(objtree)/tools
- $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(src)/tools/ $*
+ $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/ $*
# Single targets
# ---------------------------------------------------------------------------
@@ -1755,8 +1772,6 @@ build-dir = $(patsubst %/,%,$(dir $(build-target)))
PHONY += /
/: ./
-# Make sure the latest headers are built for Documentation
-Documentation/ samples/: headers_install
%/: prepare FORCE
$(Q)$(MAKE) KBUILD_MODULES=1 $(build)=$(build-dir)
diff --git a/arch/arc/Makefile b/arch/arc/Makefile
index 03a0b19c92cd..ee6d1184c2b1 100644
--- a/arch/arc/Makefile
+++ b/arch/arc/Makefile
@@ -19,7 +19,7 @@ ifdef CONFIG_ARC_CURR_IN_REG
# any kernel headers, and missing the r25 global register
# Can't do unconditionally because of recursive include issues
# due to <linux/thread_info.h>
-LINUXINCLUDE += -include ${src}/arch/arc/include/asm/current.h
+LINUXINCLUDE += -include $(srctree)/arch/arc/include/asm/current.h
endif
cflags-y += -fsection-anchors
diff --git a/arch/arc/configs/tb10x_defconfig b/arch/arc/configs/tb10x_defconfig
index 5b5119d2b5d5..dc739bd093e3 100644
--- a/arch/arc/configs/tb10x_defconfig
+++ b/arch/arc/configs/tb10x_defconfig
@@ -94,6 +94,7 @@ CONFIG_CONFIGFS_FS=y
CONFIG_DEBUG_INFO=y
CONFIG_STRIP_ASM_SYMS=y
CONFIG_DEBUG_FS=y
+CONFIG_HEADERS_INSTALL=y
CONFIG_HEADERS_CHECK=y
CONFIG_DEBUG_SECTION_MISMATCH=y
CONFIG_MAGIC_SYSRQ=y
diff --git a/arch/nds32/configs/defconfig b/arch/nds32/configs/defconfig
index 65ce9259081b..40313a635075 100644
--- a/arch/nds32/configs/defconfig
+++ b/arch/nds32/configs/defconfig
@@ -92,6 +92,7 @@ CONFIG_DEBUG_INFO=y
CONFIG_DEBUG_INFO_DWARF4=y
CONFIG_GDB_SCRIPTS=y
CONFIG_READABLE_ASM=y
+CONFIG_HEADERS_INSTALL=y
CONFIG_HEADERS_CHECK=y
CONFIG_DEBUG_SECTION_MISMATCH=y
CONFIG_MAGIC_SYSRQ=y
diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
index 58d46665cad9..8acb8fa1f8d6 100644
--- a/arch/parisc/Makefile
+++ b/arch/parisc/Makefile
@@ -120,8 +120,8 @@ PALO := $(shell if (which palo 2>&1); then : ; \
elif [ -x /sbin/palo ]; then echo /sbin/palo; \
fi)
-PALOCONF := $(shell if [ -f $(src)/palo.conf ]; then echo $(src)/palo.conf; \
- else echo $(obj)/palo.conf; \
+PALOCONF := $(shell if [ -f $(srctree)/palo.conf ]; then echo $(srctree)/palo.conf; \
+ else echo $(objtree)/palo.conf; \
fi)
palo lifimage: vmlinuz
@@ -131,8 +131,8 @@ palo lifimage: vmlinuz
false; \
fi
@if test ! -f "$(PALOCONF)"; then \
- cp $(src)/arch/parisc/defpalo.conf $(obj)/palo.conf; \
- echo 'A generic palo config file ($(obj)/palo.conf) has been created for you.'; \
+ cp $(srctree)/arch/parisc/defpalo.conf $(objtree)/palo.conf; \
+ echo 'A generic palo config file ($(objree)/palo.conf) has been created for you.'; \
echo 'You should check it and re-run "make palo".'; \
echo 'WARNING: the "lifimage" file is now placed in this directory by default!'; \
false; \
@@ -162,10 +162,10 @@ vmlinuz: vmlinux
endif
install:
- $(CONFIG_SHELL) $(src)/arch/parisc/install.sh \
+ $(CONFIG_SHELL) $(srctree)/arch/parisc/install.sh \
$(KERNELRELEASE) vmlinux System.map "$(INSTALL_PATH)"
zinstall:
- $(CONFIG_SHELL) $(src)/arch/parisc/install.sh \
+ $(CONFIG_SHELL) $(srctree)/arch/parisc/install.sh \
$(KERNELRELEASE) vmlinuz System.map "$(INSTALL_PATH)"
CLEAN_FILES += lifimage
diff --git a/arch/parisc/configs/a500_defconfig b/arch/parisc/configs/a500_defconfig
index a8859496b0b9..3335734bfadd 100644
--- a/arch/parisc/configs/a500_defconfig
+++ b/arch/parisc/configs/a500_defconfig
@@ -166,6 +166,7 @@ CONFIG_NLS_ISO8859_1=m
CONFIG_NLS_ISO8859_15=m
CONFIG_NLS_UTF8=m
CONFIG_DEBUG_FS=y
+CONFIG_HEADERS_INSTALL=y
CONFIG_HEADERS_CHECK=y
CONFIG_MAGIC_SYSRQ=y
# CONFIG_DEBUG_BUGVERBOSE is not set
diff --git a/arch/parisc/configs/b180_defconfig b/arch/parisc/configs/b180_defconfig
index 0cae9664bf67..07fde5bd6974 100644
--- a/arch/parisc/configs/b180_defconfig
+++ b/arch/parisc/configs/b180_defconfig
@@ -90,6 +90,7 @@ CONFIG_NLS_ASCII=m
CONFIG_NLS_ISO8859_1=m
CONFIG_NLS_ISO8859_15=m
CONFIG_NLS_UTF8=m
+CONFIG_HEADERS_INSTALL=y
CONFIG_HEADERS_CHECK=y
CONFIG_MAGIC_SYSRQ=y
CONFIG_DEBUG_KERNEL=y
diff --git a/arch/parisc/configs/c3000_defconfig b/arch/parisc/configs/c3000_defconfig
index 6c29b841735c..64d45a8b6ca0 100644
--- a/arch/parisc/configs/c3000_defconfig
+++ b/arch/parisc/configs/c3000_defconfig
@@ -139,6 +139,7 @@ CONFIG_NLS_ISO8859_1=m
CONFIG_NLS_ISO8859_15=m
CONFIG_NLS_UTF8=m
CONFIG_DEBUG_FS=y
+CONFIG_HEADERS_INSTALL=y
CONFIG_HEADERS_CHECK=y
CONFIG_MAGIC_SYSRQ=y
CONFIG_DEBUG_MUTEXES=y
diff --git a/arch/parisc/configs/default_defconfig b/arch/parisc/configs/default_defconfig
index 6a91cc2623e8..5b877ca34ebf 100644
--- a/arch/parisc/configs/default_defconfig
+++ b/arch/parisc/configs/default_defconfig
@@ -183,6 +183,7 @@ CONFIG_NLS_KOI8_R=m
CONFIG_NLS_KOI8_U=m
CONFIG_NLS_UTF8=y
CONFIG_DEBUG_FS=y
+CONFIG_HEADERS_INSTALL=y
CONFIG_HEADERS_CHECK=y
CONFIG_MAGIC_SYSRQ=y
CONFIG_DEBUG_KERNEL=y
diff --git a/arch/powerpc/configs/ppc6xx_defconfig b/arch/powerpc/configs/ppc6xx_defconfig
index aa51b9b66fa2..1c074fb95df2 100644
--- a/arch/powerpc/configs/ppc6xx_defconfig
+++ b/arch/powerpc/configs/ppc6xx_defconfig
@@ -1123,6 +1123,7 @@ CONFIG_NLS_KOI8_R=m
CONFIG_NLS_KOI8_U=m
CONFIG_DEBUG_INFO=y
CONFIG_UNUSED_SYMBOLS=y
+CONFIG_HEADERS_INSTALL=y
CONFIG_HEADERS_CHECK=y
CONFIG_MAGIC_SYSRQ=y
CONFIG_DEBUG_KERNEL=y
diff --git a/arch/s390/configs/debug_defconfig b/arch/s390/configs/debug_defconfig
index a6dc01a22048..e26d4413d34c 100644
--- a/arch/s390/configs/debug_defconfig
+++ b/arch/s390/configs/debug_defconfig
@@ -588,6 +588,7 @@ CONFIG_GDB_SCRIPTS=y
CONFIG_FRAME_WARN=1024
CONFIG_READABLE_ASM=y
CONFIG_UNUSED_SYMBOLS=y
+CONFIG_HEADERS_INSTALL=y
CONFIG_HEADERS_CHECK=y
CONFIG_DEBUG_SECTION_MISMATCH=y
CONFIG_MAGIC_SYSRQ=y
diff --git a/arch/um/Makefile b/arch/um/Makefile
index 273130cf91d1..d2daa206872d 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -73,7 +73,7 @@ KBUILD_AFLAGS += $(ARCH_INCLUDE)
USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -I%,,$(KBUILD_CFLAGS))) \
$(ARCH_INCLUDE) $(MODE_INCLUDE) $(filter -I%,$(CFLAGS)) \
-D_FILE_OFFSET_BITS=64 -idirafter $(srctree)/include \
- -idirafter $(obj)/include -D__KERNEL__ -D__UM_HOST__
+ -idirafter $(objtree)/include -D__KERNEL__ -D__UM_HOST__
#This will adjust *FLAGS accordingly to the platform.
include $(ARCH_DIR)/Makefile-os-$(OS)
diff --git a/drivers/gpu/drm/i915/.gitignore b/drivers/gpu/drm/i915/.gitignore
deleted file mode 100644
index cff45d81f42f..000000000000
--- a/drivers/gpu/drm/i915/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-header_test_*.c
diff --git a/drivers/gpu/drm/i915/Makefile.header-test b/drivers/gpu/drm/i915/Makefile.header-test
index c1c391816fa7..639b596a06a9 100644
--- a/drivers/gpu/drm/i915/Makefile.header-test
+++ b/drivers/gpu/drm/i915/Makefile.header-test
@@ -2,7 +2,7 @@
# Copyright © 2019 Intel Corporation
# Test the headers are compilable as standalone units
-header_test := \
+header-test-$(CONFIG_DRM_I915_WERROR) := \
i915_active_types.h \
i915_gem_context_types.h \
i915_priolist_types.h \
@@ -35,13 +35,3 @@ header_test := \
intel_sprite.h \
intel_tv.h \
intel_workarounds_types.h
-
-quiet_cmd_header_test = HDRTEST $@
- cmd_header_test = echo "\#include \"$(<F)\"" > $@
-
-header_test_%.c: %.h
- $(call cmd,header_test)
-
-i915-$(CONFIG_DRM_I915_WERROR) += $(foreach h,$(header_test),$(patsubst %.h,header_test_%.o,$(h)))
-
-clean-files += $(foreach h,$(header_test),$(patsubst %.h,header_test_%.c,$(h)))
diff --git a/include/Kbuild b/include/Kbuild
new file mode 100644
index 000000000000..7e9f1acb9dd5
--- /dev/null
+++ b/include/Kbuild
@@ -0,0 +1,1270 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+# Add header-test-$(CONFIG_...) guard to headers that are only compiled
+# for particular architectures.
+#
+# Headers listed in header-test- are excluded from the test coverage.
+# Many headers are excluded for now because they fail to build. Please
+# consider to fix headers first before adding new ones to the blacklist.
+#
+# Sorted alphabetically.
+header-test- += acpi/acbuffer.h
+header-test- += acpi/acpi.h
+header-test- += acpi/acpi_bus.h
+header-test- += acpi/acpi_drivers.h
+header-test- += acpi/acpi_io.h
+header-test- += acpi/acpi_lpat.h
+header-test- += acpi/acpiosxf.h
+header-test- += acpi/acpixf.h
+header-test- += acpi/acrestyp.h
+header-test- += acpi/actbl.h
+header-test- += acpi/actbl1.h
+header-test- += acpi/actbl2.h
+header-test- += acpi/actbl3.h
+header-test- += acpi/actypes.h
+header-test- += acpi/battery.h
+header-test- += acpi/cppc_acpi.h
+header-test- += acpi/nfit.h
+header-test- += acpi/platform/acenv.h
+header-test- += acpi/platform/acenvex.h
+header-test- += acpi/platform/acintel.h
+header-test- += acpi/platform/aclinux.h
+header-test- += acpi/platform/aclinuxex.h
+header-test- += acpi/processor.h
+header-test- += clocksource/hyperv_timer.h
+header-test- += clocksource/timer-sp804.h
+header-test- += crypto/cast_common.h
+header-test- += crypto/internal/cryptouser.h
+header-test- += crypto/pkcs7.h
+header-test- += crypto/poly1305.h
+header-test- += crypto/sha3.h
+header-test- += drm/ati_pcigart.h
+header-test- += drm/bridge/dw_hdmi.h
+header-test- += drm/bridge/dw_mipi_dsi.h
+header-test- += drm/drm_audio_component.h
+header-test- += drm/drm_auth.h
+header-test- += drm/drm_debugfs.h
+header-test- += drm/drm_debugfs_crc.h
+header-test- += drm/drm_displayid.h
+header-test- += drm/drm_encoder_slave.h
+header-test- += drm/drm_fb_cma_helper.h
+header-test- += drm/drm_fb_helper.h
+header-test- += drm/drm_fixed.h
+header-test- += drm/drm_format_helper.h
+header-test- += drm/drm_lease.h
+header-test- += drm/drm_legacy.h
+header-test- += drm/drm_panel.h
+header-test- += drm/drm_plane_helper.h
+header-test- += drm/drm_rect.h
+header-test- += drm/i915_component.h
+header-test- += drm/intel-gtt.h
+header-test- += drm/tinydrm/tinydrm-helpers.h
+header-test- += drm/ttm/ttm_debug.h
+header-test- += keys/asymmetric-parser.h
+header-test- += keys/asymmetric-subtype.h
+header-test- += keys/asymmetric-type.h
+header-test- += keys/big_key-type.h
+header-test- += keys/request_key_auth-type.h
+header-test- += keys/trusted.h
+header-test- += kvm/arm_arch_timer.h
+header-test- += kvm/arm_pmu.h
+header-test-$(CONFIG_ARM) += kvm/arm_psci.h
+header-test-$(CONFIG_ARM64) += kvm/arm_psci.h
+header-test- += kvm/arm_vgic.h
+header-test- += linux/8250_pci.h
+header-test- += linux/a.out.h
+header-test- += linux/adxl.h
+header-test- += linux/agpgart.h
+header-test- += linux/alcor_pci.h
+header-test- += linux/amba/clcd.h
+header-test- += linux/amba/pl080.h
+header-test- += linux/amd-iommu.h
+header-test-$(CONFIG_ARM) += linux/arm-cci.h
+header-test-$(CONFIG_ARM64) += linux/arm-cci.h
+header-test- += linux/arm_sdei.h
+header-test- += linux/asn1_decoder.h
+header-test- += linux/ata_platform.h
+header-test- += linux/ath9k_platform.h
+header-test- += linux/atm_tcp.h
+header-test- += linux/atomic-fallback.h
+header-test- += linux/avf/virtchnl.h
+header-test- += linux/bcm47xx_sprom.h
+header-test- += linux/bcma/bcma_driver_gmac_cmn.h
+header-test- += linux/bcma/bcma_driver_mips.h
+header-test- += linux/bcma/bcma_driver_pci.h
+header-test- += linux/bcma/bcma_driver_pcie2.h
+header-test- += linux/bit_spinlock.h
+header-test- += linux/blk-mq-rdma.h
+header-test- += linux/blk-mq.h
+header-test- += linux/blktrace_api.h
+header-test- += linux/blockgroup_lock.h
+header-test- += linux/bma150.h
+header-test- += linux/bpf_lirc.h
+header-test- += linux/bpf_types.h
+header-test- += linux/bsg-lib.h
+header-test- += linux/bsg.h
+header-test- += linux/btf.h
+header-test- += linux/btree-128.h
+header-test- += linux/btree-type.h
+header-test-$(CONFIG_CPU_BIG_ENDIAN) += linux/byteorder/big_endian.h
+header-test- += linux/byteorder/generic.h
+header-test-$(CONFIG_CPU_LITTLE_ENDIAN) += linux/byteorder/little_endian.h
+header-test- += linux/c2port.h
+header-test- += linux/can/dev/peak_canfd.h
+header-test- += linux/can/platform/cc770.h
+header-test- += linux/can/platform/sja1000.h
+header-test- += linux/ceph/ceph_features.h
+header-test- += linux/ceph/ceph_frag.h
+header-test- += linux/ceph/ceph_fs.h
+header-test- += linux/ceph/debugfs.h
+header-test- += linux/ceph/msgr.h
+header-test- += linux/ceph/rados.h
+header-test- += linux/cgroup_subsys.h
+header-test- += linux/clk/sunxi-ng.h
+header-test- += linux/clk/ti.h
+header-test- += linux/cn_proc.h
+header-test- += linux/coda_psdev.h
+header-test- += linux/compaction.h
+header-test- += linux/console_struct.h
+header-test- += linux/count_zeros.h
+header-test- += linux/cs5535.h
+header-test- += linux/cuda.h
+header-test- += linux/cyclades.h
+header-test- += linux/dcookies.h
+header-test- += linux/delayacct.h
+header-test- += linux/delayed_call.h
+header-test- += linux/device-mapper.h
+header-test- += linux/devpts_fs.h
+header-test- += linux/dio.h
+header-test- += linux/dirent.h
+header-test- += linux/dlm_plock.h
+header-test- += linux/dm-dirty-log.h
+header-test- += linux/dm-region-hash.h
+header-test- += linux/dma-debug.h
+header-test- += linux/dma/mmp-pdma.h
+header-test- += linux/dma/sprd-dma.h
+header-test- += linux/dns_resolver.h
+header-test- += linux/drbd_genl.h
+header-test- += linux/drbd_genl_api.h
+header-test- += linux/dw_apb_timer.h
+header-test- += linux/dynamic_debug.h
+header-test- += linux/dynamic_queue_limits.h
+header-test- += linux/ecryptfs.h
+header-test- += linux/edma.h
+header-test- += linux/eeprom_93cx6.h
+header-test- += linux/efs_vh.h
+header-test- += linux/elevator.h
+header-test- += linux/elfcore-compat.h
+header-test- += linux/error-injection.h
+header-test- += linux/errseq.h
+header-test- += linux/eventpoll.h
+header-test- += linux/ext2_fs.h
+header-test- += linux/f75375s.h
+header-test- += linux/falloc.h
+header-test- += linux/fault-inject.h
+header-test- += linux/fbcon.h
+header-test- += linux/firmware/intel/stratix10-svc-client.h
+header-test- += linux/firmware/meson/meson_sm.h
+header-test- += linux/firmware/trusted_foundations.h
+header-test- += linux/firmware/xlnx-zynqmp.h
+header-test- += linux/fixp-arith.h
+header-test- += linux/flat.h
+header-test- += linux/fs_types.h
+header-test- += linux/fs_uart_pd.h
+header-test- += linux/fsi-occ.h
+header-test- += linux/fsi-sbefifo.h
+header-test- += linux/fsl/bestcomm/ata.h
+header-test- += linux/fsl/bestcomm/bestcomm.h
+header-test- += linux/fsl/bestcomm/bestcomm_priv.h
+header-test- += linux/fsl/bestcomm/fec.h
+header-test- += linux/fsl/bestcomm/gen_bd.h
+header-test- += linux/fsl/bestcomm/sram.h
+header-test- += linux/fsl_hypervisor.h
+header-test- += linux/fsldma.h
+header-test- += linux/ftrace_irq.h
+header-test- += linux/gameport.h
+header-test- += linux/genl_magic_func.h
+header-test- += linux/genl_magic_struct.h
+header-test- += linux/gpio/aspeed.h
+header-test- += linux/gpio/gpio-reg.h
+header-test- += linux/hid-debug.h
+header-test- += linux/hiddev.h
+header-test- += linux/hippidevice.h
+header-test- += linux/hmm.h
+header-test- += linux/hp_sdc.h
+header-test- += linux/huge_mm.h
+header-test- += linux/hugetlb_cgroup.h
+header-test- += linux/hugetlb_inline.h
+header-test- += linux/hwmon-vid.h
+header-test- += linux/hyperv.h
+header-test- += linux/i2c-algo-pca.h
+header-test- += linux/i2c-algo-pcf.h
+header-test- += linux/i3c/ccc.h
+header-test- += linux/i3c/device.h
+header-test- += linux/i3c/master.h
+header-test- += linux/i8042.h
+header-test- += linux/ide.h
+header-test- += linux/idle_inject.h
+header-test- += linux/if_frad.h
+header-test- += linux/if_rmnet.h
+header-test- += linux/if_tap.h
+header-test- += linux/iio/accel/kxcjk_1013.h
+header-test- += linux/iio/adc/ad_sigma_delta.h
+header-test- += linux/iio/buffer-dma.h
+header-test- += linux/iio/buffer_impl.h
+header-test- += linux/iio/common/st_sensors.h
+header-test- += linux/iio/common/st_sensors_i2c.h
+header-test- += linux/iio/common/st_sensors_spi.h
+header-test- += linux/iio/dac/ad5421.h
+header-test- += linux/iio/dac/ad5504.h
+header-test- += linux/iio/dac/ad5791.h
+header-test- += linux/iio/dac/max517.h
+header-test- += linux/iio/dac/mcp4725.h
+header-test- += linux/iio/frequency/ad9523.h
+header-test- += linux/iio/frequency/adf4350.h
+header-test- += linux/iio/hw-consumer.h
+header-test- += linux/iio/imu/adis.h
+header-test- += linux/iio/sysfs.h
+header-test- += linux/iio/timer/stm32-timer-trigger.h
+header-test- += linux/iio/trigger.h
+header-test- += linux/iio/triggered_event.h
+header-test- += linux/imx-media.h
+header-test- += linux/inet_diag.h
+header-test- += linux/init_ohci1394_dma.h
+header-test- += linux/initrd.h
+header-test- += linux/input/adp5589.h
+header-test- += linux/input/bu21013.h
+header-test- += linux/input/cma3000.h
+header-test- += linux/input/kxtj9.h
+header-test- += linux/input/lm8333.h
+header-test- += linux/input/sparse-keymap.h
+header-test- += linux/input/touchscreen.h
+header-test- += linux/input/tps6507x-ts.h
+header-test-$(CONFIG_X86) += linux/intel-iommu.h
+header-test- += linux/intel-ish-client-if.h
+header-test- += linux/intel-pti.h
+header-test- += linux/intel-svm.h
+header-test- += linux/interconnect-provider.h
+header-test- += linux/ioc3.h
+header-test- += linux/ipack.h
+header-test- += linux/irq_cpustat.h
+header-test- += linux/irq_poll.h
+header-test- += linux/irqchip/arm-gic-v3.h
+header-test- += linux/irqchip/arm-gic-v4.h
+header-test- += linux/irqchip/irq-madera.h
+header-test- += linux/irqchip/irq-sa11x0.h
+header-test- += linux/irqchip/mxs.h
+header-test- += linux/irqchip/versatile-fpga.h
+header-test- += linux/irqdesc.h
+header-test- += linux/irqflags.h
+header-test- += linux/iscsi_boot_sysfs.h
+header-test- += linux/isdn/capiutil.h
+header-test- += linux/isdn/hdlc.h
+header-test- += linux/isdn_ppp.h
+header-test- += linux/jbd2.h
+header-test- += linux/jump_label.h
+header-test- += linux/jump_label_ratelimit.h
+header-test- += linux/jz4740-adc.h
+header-test- += linux/kasan.h
+header-test- += linux/kcore.h
+header-test- += linux/kdev_t.h
+header-test- += linux/kernelcapi.h
+header-test- += linux/khugepaged.h
+header-test- += linux/kobj_map.h
+header-test- += linux/kobject_ns.h
+header-test- += linux/kvm_host.h
+header-test- += linux/kvm_irqfd.h
+header-test- += linux/kvm_para.h
+header-test- += linux/lantiq.h
+header-test- += linux/lapb.h
+header-test- += linux/latencytop.h
+header-test- += linux/led-lm3530.h
+header-test- += linux/leds-bd2802.h
+header-test- += linux/leds-lp3944.h
+header-test- += linux/leds-lp3952.h
+header-test- += linux/leds_pwm.h
+header-test- += linux/libata.h
+header-test- += linux/license.h
+header-test- += linux/lightnvm.h
+header-test- += linux/lis3lv02d.h
+header-test- += linux/list_bl.h
+header-test- += linux/list_lru.h
+header-test- += linux/list_nulls.h
+header-test- += linux/lockd/share.h
+header-test- += linux/lzo.h
+header-test- += linux/mailbox/zynqmp-ipi-message.h
+header-test- += linux/maple.h
+header-test- += linux/mbcache.h
+header-test- += linux/mbus.h
+header-test- += linux/mc146818rtc.h
+header-test- += linux/mc6821.h
+header-test- += linux/mdev.h
+header-test- += linux/mem_encrypt.h
+header-test- += linux/memfd.h
+header-test- += linux/mfd/88pm80x.h
+header-test- += linux/mfd/88pm860x.h
+header-test- += linux/mfd/abx500/ab8500-bm.h
+header-test- += linux/mfd/abx500/ab8500-gpadc.h
+header-test- += linux/mfd/adp5520.h
+header-test- += linux/mfd/arizona/pdata.h
+header-test- += linux/mfd/as3711.h
+header-test- += linux/mfd/as3722.h
+header-test- += linux/mfd/cros_ec_commands.h
+header-test- += linux/mfd/da903x.h
+header-test- += linux/mfd/da9055/pdata.h
+header-test- += linux/mfd/da9063/pdata.h
+header-test- += linux/mfd/db8500-prcmu.h
+header-test- += linux/mfd/dbx500-prcmu.h
+header-test- += linux/mfd/dln2.h
+header-test- += linux/mfd/dm355evm_msp.h
+header-test- += linux/mfd/ds1wm.h
+header-test- += linux/mfd/ezx-pcap.h
+header-test- += linux/mfd/intel_msic.h
+header-test- += linux/mfd/janz.h
+header-test- += linux/mfd/kempld.h
+header-test- += linux/mfd/lm3533.h
+header-test- += linux/mfd/lp8788-isink.h
+header-test- += linux/mfd/lpc_ich.h
+header-test- += linux/mfd/max77693.h
+header-test- += linux/mfd/max8998-private.h
+header-test- += linux/mfd/menelaus.h
+header-test- += linux/mfd/mt6397/core.h
+header-test- += linux/mfd/palmas.h
+header-test- += linux/mfd/pcf50633/backlight.h
+header-test- += linux/mfd/rc5t583.h
+header-test- += linux/mfd/retu.h
+header-test- += linux/mfd/samsung/core.h
+header-test- += linux/mfd/si476x-platform.h
+header-test- += linux/mfd/si476x-reports.h
+header-test- += linux/mfd/sky81452.h
+header-test- += linux/mfd/smsc.h
+header-test- += linux/mfd/sta2x11-mfd.h
+header-test- += linux/mfd/stmfx.h
+header-test- += linux/mfd/tc3589x.h
+header-test- += linux/mfd/tc6387xb.h
+header-test- += linux/mfd/tc6393xb.h
+header-test- += linux/mfd/tps65090.h
+header-test- += linux/mfd/tps6586x.h
+header-test- += linux/mfd/tps65910.h
+header-test- += linux/mfd/tps80031.h
+header-test- += linux/mfd/ucb1x00.h
+header-test- += linux/mfd/viperboard.h
+header-test- += linux/mfd/wm831x/core.h
+header-test- += linux/mfd/wm831x/otp.h
+header-test- += linux/mfd/wm831x/pdata.h
+header-test- += linux/mfd/wm8994/core.h
+header-test- += linux/mfd/wm8994/pdata.h
+header-test- += linux/mlx4/doorbell.h
+header-test- += linux/mlx4/srq.h
+header-test- += linux/mlx5/doorbell.h
+header-test- += linux/mlx5/eq.h
+header-test- += linux/mlx5/fs_helpers.h
+header-test- += linux/mlx5/mlx5_ifc.h
+header-test- += linux/mlx5/mlx5_ifc_fpga.h
+header-test- += linux/mm-arch-hooks.h
+header-test- += linux/mm_inline.h
+header-test- += linux/mmu_context.h
+header-test- += linux/mpage.h
+header-test- += linux/mtd/bbm.h
+header-test- += linux/mtd/cfi.h
+header-test- += linux/mtd/doc2000.h
+header-test- += linux/mtd/flashchip.h
+header-test- += linux/mtd/ftl.h
+header-test- += linux/mtd/gen_probe.h
+header-test- += linux/mtd/jedec.h
+header-test- += linux/mtd/nand_bch.h
+header-test- += linux/mtd/nand_ecc.h
+header-test- += linux/mtd/ndfc.h
+header-test- += linux/mtd/onenand.h
+header-test- += linux/mtd/pismo.h
+header-test- += linux/mtd/plat-ram.h
+header-test- += linux/mtd/spi-nor.h
+header-test- += linux/mv643xx.h
+header-test- += linux/mv643xx_eth.h
+header-test- += linux/mvebu-pmsu.h
+header-test- += linux/mxm-wmi.h
+header-test- += linux/n_r3964.h
+header-test- += linux/ndctl.h
+header-test- += linux/netfilter/ipset/ip_set.h
+header-test- += linux/netfilter/ipset/ip_set_bitmap.h
+header-test- += linux/netfilter/ipset/ip_set_comment.h
+header-test- += linux/netfilter/ipset/ip_set_counter.h
+header-test- += linux/netfilter/ipset/ip_set_getport.h
+header-test- += linux/netfilter/ipset/ip_set_hash.h
+header-test- += linux/netfilter/ipset/ip_set_list.h
+header-test- += linux/netfilter/ipset/ip_set_skbinfo.h
+header-test- += linux/netfilter/ipset/ip_set_timeout.h
+header-test- += linux/netfilter/nf_conntrack_amanda.h
+header-test- += linux/netfilter/nf_conntrack_ftp.h
+header-test- += linux/netfilter/nf_conntrack_h323.h
+header-test- += linux/netfilter/nf_conntrack_h323_asn1.h
+header-test- += linux/netfilter/nf_conntrack_irc.h
+header-test- += linux/netfilter/nf_conntrack_pptp.h
+header-test- += linux/netfilter/nf_conntrack_proto_gre.h
+header-test- += linux/netfilter/nf_conntrack_sip.h
+header-test- += linux/netfilter/nf_conntrack_snmp.h
+header-test- += linux/netfilter/nf_conntrack_tftp.h
+header-test- += linux/netfilter/x_tables.h
+header-test- += linux/netfilter_arp/arp_tables.h
+header-test- += linux/netfilter_bridge/ebtables.h
+header-test- += linux/netfilter_ipv4/ip4_tables.h
+header-test- += linux/netfilter_ipv4/ip_tables.h
+header-test- += linux/netfilter_ipv6/ip6_tables.h
+header-test- += linux/nfs.h
+header-test- += linux/nfs_fs_i.h
+header-test- += linux/nfs_fs_sb.h
+header-test- += linux/nfs_page.h
+header-test- += linux/nfs_xdr.h
+header-test- += linux/nfsacl.h
+header-test- += linux/nl802154.h
+header-test- += linux/ns_common.h
+header-test- += linux/nsc_gpio.h
+header-test- += linux/ntb_transport.h
+header-test- += linux/nubus.h
+header-test- += linux/nvme-fc-driver.h
+header-test- += linux/nvme-fc.h
+header-test- += linux/nvme-rdma.h
+header-test- += linux/nvram.h
+header-test- += linux/objagg.h
+header-test- += linux/of_clk.h
+header-test- += linux/of_net.h
+header-test- += linux/of_pdt.h
+header-test- += linux/olpc-ec.h
+header-test- += linux/omap-dma.h
+header-test- += linux/omap-dmaengine.h
+header-test- += linux/omap-gpmc.h
+header-test- += linux/omap-iommu.h
+header-test- += linux/omap-mailbox.h
+header-test- += linux/once.h
+header-test- += linux/osq_lock.h
+header-test- += linux/overflow.h
+header-test- += linux/page-flags-layout.h
+header-test- += linux/page-isolation.h
+header-test- += linux/page_ext.h
+header-test- += linux/page_owner.h
+header-test- += linux/parport_pc.h
+header-test- += linux/parser.h
+header-test- += linux/pci-acpi.h
+header-test- += linux/pci-dma-compat.h
+header-test- += linux/pci_hotplug.h
+header-test- += linux/pda_power.h
+header-test- += linux/perf/arm_pmu.h
+header-test- += linux/perf_regs.h
+header-test- += linux/phy/omap_control_phy.h
+header-test- += linux/phy/tegra/xusb.h
+header-test- += linux/phy/ulpi_phy.h
+header-test- += linux/phy_fixed.h
+header-test- += linux/pinctrl/pinconf-generic.h
+header-test- += linux/pinctrl/pinconf.h
+header-test- += linux/pinctrl/pinctrl.h
+header-test- += linux/pipe_fs_i.h
+header-test- += linux/pktcdvd.h
+header-test- += linux/pl320-ipc.h
+header-test- += linux/pl353-smc.h
+header-test- += linux/platform_data/ad5449.h
+header-test- += linux/platform_data/ad5755.h
+header-test- += linux/platform_data/ad7266.h
+header-test- += linux/platform_data/ad7291.h
+header-test- += linux/platform_data/ad7298.h
+header-test- += linux/platform_data/ad7303.h
+header-test- += linux/platform_data/ad7791.h
+header-test- += linux/platform_data/ad7793.h
+header-test- += linux/platform_data/ad7887.h
+header-test- += linux/platform_data/adau17x1.h
+header-test- += linux/platform_data/adp8870.h
+header-test- += linux/platform_data/ads1015.h
+header-test- += linux/platform_data/ads7828.h
+header-test- += linux/platform_data/apds990x.h
+header-test- += linux/platform_data/arm-ux500-pm.h
+header-test- += linux/platform_data/asoc-s3c.h
+header-test- += linux/platform_data/at91_adc.h
+header-test- += linux/platform_data/ata-pxa.h
+header-test- += linux/platform_data/atmel.h
+header-test- += linux/platform_data/bh1770glc.h
+header-test- += linux/platform_data/brcmfmac.h
+header-test- += linux/platform_data/clk-u300.h
+header-test- += linux/platform_data/cyttsp4.h
+header-test- += linux/platform_data/dma-coh901318.h
+header-test- += linux/platform_data/dma-imx-sdma.h
+header-test- += linux/platform_data/dma-mcf-edma.h
+header-test- += linux/platform_data/dma-s3c24xx.h
+header-test- += linux/platform_data/dmtimer-omap.h
+header-test- += linux/platform_data/dsa.h
+header-test- += linux/platform_data/edma.h
+header-test- += linux/platform_data/elm.h
+header-test- += linux/platform_data/emif_plat.h
+header-test- += linux/platform_data/fsa9480.h
+header-test- += linux/platform_data/g762.h
+header-test- += linux/platform_data/gpio-ath79.h
+header-test- += linux/platform_data/gpio-davinci.h
+header-test- += linux/platform_data/gpio-dwapb.h
+header-test- += linux/platform_data/gpio-htc-egpio.h
+header-test- += linux/platform_data/gpmc-omap.h
+header-test- += linux/platform_data/hsmmc-omap.h
+header-test- += linux/platform_data/hwmon-s3c.h
+header-test- += linux/platform_data/i2c-davinci.h
+header-test- += linux/platform_data/i2c-imx.h
+header-test- += linux/platform_data/i2c-mux-reg.h
+header-test- += linux/platform_data/i2c-ocores.h
+header-test- += linux/platform_data/i2c-xiic.h
+header-test- += linux/platform_data/intel-spi.h
+header-test- += linux/platform_data/invensense_mpu6050.h
+header-test- += linux/platform_data/irda-pxaficp.h
+header-test- += linux/platform_data/irda-sa11x0.h
+header-test- += linux/platform_data/itco_wdt.h
+header-test- += linux/platform_data/jz4740/jz4740_nand.h
+header-test- += linux/platform_data/keyboard-pxa930_rotary.h
+header-test- += linux/platform_data/keypad-omap.h
+header-test- += linux/platform_data/leds-lp55xx.h
+header-test- += linux/platform_data/leds-omap.h
+header-test- += linux/platform_data/lp855x.h
+header-test- += linux/platform_data/lp8727.h
+header-test- += linux/platform_data/max197.h
+header-test- += linux/platform_data/max3421-hcd.h
+header-test- += linux/platform_data/max732x.h
+header-test- += linux/platform_data/mcs.h
+header-test- += linux/platform_data/mdio-bcm-unimac.h
+header-test- += linux/platform_data/mdio-gpio.h
+header-test- += linux/platform_data/media/si4713.h
+header-test- += linux/platform_data/mlxreg.h
+header-test- += linux/platform_data/mmc-omap.h
+header-test- += linux/platform_data/mmc-sdhci-s3c.h
+header-test- += linux/platform_data/mmp_audio.h
+header-test- += linux/platform_data/mtd-orion_nand.h
+header-test- += linux/platform_data/mv88e6xxx.h
+header-test- += linux/platform_data/net-cw1200.h
+header-test- += linux/platform_data/omap-twl4030.h
+header-test- += linux/platform_data/omapdss.h
+header-test- += linux/platform_data/pcf857x.h
+header-test- += linux/platform_data/pixcir_i2c_ts.h
+header-test- += linux/platform_data/pwm_omap_dmtimer.h
+header-test- += linux/platform_data/pxa2xx_udc.h
+header-test- += linux/platform_data/pxa_sdhci.h
+header-test- += linux/platform_data/remoteproc-omap.h
+header-test- += linux/platform_data/sa11x0-serial.h
+header-test- += linux/platform_data/sc18is602.h
+header-test- += linux/platform_data/sdhci-pic32.h
+header-test- += linux/platform_data/serial-sccnxp.h
+header-test- += linux/platform_data/sht3x.h
+header-test- += linux/platform_data/shtc1.h
+header-test- += linux/platform_data/si5351.h
+header-test- += linux/platform_data/sky81452-backlight.h
+header-test- += linux/platform_data/spi-davinci.h
+header-test- += linux/platform_data/spi-ep93xx.h
+header-test- += linux/platform_data/spi-mt65xx.h
+header-test- += linux/platform_data/spi-nuc900.h
+header-test- += linux/platform_data/st_sensors_pdata.h
+header-test- += linux/platform_data/ti-sysc.h
+header-test- += linux/platform_data/timer-ixp4xx.h
+header-test- += linux/platform_data/touchscreen-s3c2410.h
+header-test- += linux/platform_data/tsc2007.h
+header-test- += linux/platform_data/tsl2772.h
+header-test- += linux/platform_data/uio_pruss.h
+header-test- += linux/platform_data/usb-davinci.h
+header-test- += linux/platform_data/usb-ehci-mxc.h
+header-test- += linux/platform_data/usb-ehci-orion.h
+header-test- += linux/platform_data/usb-mx2.h
+header-test- += linux/platform_data/usb-ohci-s3c2410.h
+header-test- += linux/platform_data/usb-omap.h
+header-test- += linux/platform_data/usb-s3c2410_udc.h
+header-test- += linux/platform_data/usb3503.h
+header-test- += linux/platform_data/ux500_wdt.h
+header-test- += linux/platform_data/video-clcd-versatile.h
+header-test- += linux/platform_data/video-imxfb.h
+header-test- += linux/platform_data/video-nuc900fb.h
+header-test- += linux/platform_data/video-pxafb.h
+header-test- += linux/platform_data/video_s3c.h
+header-test- += linux/platform_data/voltage-omap.h
+header-test- += linux/platform_data/x86/apple.h
+header-test- += linux/platform_data/x86/clk-pmc-atom.h
+header-test- += linux/platform_data/x86/pmc_atom.h
+header-test- += linux/platform_data/xtalk-bridge.h
+header-test- += linux/pm2301_charger.h
+header-test- += linux/pm_wakeirq.h
+header-test- += linux/pm_wakeup.h
+header-test- += linux/pmbus.h
+header-test- += linux/pmu.h
+header-test- += linux/posix_acl.h
+header-test- += linux/posix_acl_xattr.h
+header-test- += linux/power/ab8500.h
+header-test- += linux/power/bq27xxx_battery.h
+header-test- += linux/power/generic-adc-battery.h
+header-test- += linux/power/jz4740-battery.h
+header-test- += linux/power/max17042_battery.h
+header-test- += linux/power/max8903_charger.h
+header-test- += linux/ppp-comp.h
+header-test- += linux/pps-gpio.h
+header-test- += linux/pr.h
+header-test- += linux/proc_ns.h
+header-test- += linux/processor.h
+header-test- += linux/psi.h
+header-test- += linux/psp-sev.h
+header-test- += linux/pstore.h
+header-test- += linux/ptr_ring.h
+header-test- += linux/ptrace.h
+header-test- += linux/qcom-geni-se.h
+header-test- += linux/qed/eth_common.h
+header-test- += linux/qed/fcoe_common.h
+header-test- += linux/qed/iscsi_common.h
+header-test- += linux/qed/iwarp_common.h
+header-test- += linux/qed/qed_eth_if.h
+header-test- += linux/qed/qed_fcoe_if.h
+header-test- += linux/qed/rdma_common.h
+header-test- += linux/qed/storage_common.h
+header-test- += linux/qed/tcp_common.h
+header-test- += linux/qnx6_fs.h
+header-test- += linux/quicklist.h
+header-test- += linux/ramfs.h
+header-test- += linux/range.h
+header-test- += linux/rcu_node_tree.h
+header-test- += linux/rculist_bl.h
+header-test- += linux/rculist_nulls.h
+header-test- += linux/rcutiny.h
+header-test- += linux/rcutree.h
+header-test- += linux/reboot-mode.h
+header-test- += linux/regulator/fixed.h
+header-test- += linux/regulator/gpio-regulator.h
+header-test- += linux/regulator/max8973-regulator.h
+header-test- += linux/regulator/of_regulator.h
+header-test- += linux/regulator/tps51632-regulator.h
+header-test- += linux/regulator/tps62360.h
+header-test- += linux/regulator/tps6507x.h
+header-test- += linux/regulator/userspace-consumer.h
+header-test- += linux/remoteproc/st_slim_rproc.h
+header-test- += linux/reset/socfpga.h
+header-test- += linux/reset/sunxi.h
+header-test- += linux/rtc/m48t59.h
+header-test- += linux/rtc/rtc-omap.h
+header-test- += linux/rtc/sirfsoc_rtciobrg.h
+header-test- += linux/rwlock.h
+header-test- += linux/rwlock_types.h
+header-test- += linux/scc.h
+header-test- += linux/sched/deadline.h
+header-test- += linux/sched/smt.h
+header-test- += linux/sched/sysctl.h
+header-test- += linux/sched_clock.h
+header-test- += linux/scpi_protocol.h
+header-test- += linux/scx200_gpio.h
+header-test- += linux/seccomp.h
+header-test- += linux/sed-opal.h
+header-test- += linux/seg6_iptunnel.h
+header-test- += linux/selection.h
+header-test- += linux/set_memory.h
+header-test- += linux/shrinker.h
+header-test- += linux/sirfsoc_dma.h
+header-test- += linux/skb_array.h
+header-test- += linux/slab_def.h
+header-test- += linux/slub_def.h
+header-test- += linux/sm501.h
+header-test- += linux/smc91x.h
+header-test- += linux/static_key.h
+header-test- += linux/soc/actions/owl-sps.h
+header-test- += linux/soc/amlogic/meson-canvas.h
+header-test- += linux/soc/brcmstb/brcmstb.h
+header-test- += linux/soc/ixp4xx/npe.h
+header-test- += linux/soc/mediatek/infracfg.h
+header-test- += linux/soc/qcom/smd-rpm.h
+header-test- += linux/soc/qcom/smem.h
+header-test- += linux/soc/qcom/smem_state.h
+header-test- += linux/soc/qcom/wcnss_ctrl.h
+header-test- += linux/soc/renesas/rcar-rst.h
+header-test- += linux/soc/samsung/exynos-pmu.h
+header-test- += linux/soc/sunxi/sunxi_sram.h
+header-test- += linux/soc/ti/ti-msgmgr.h
+header-test- += linux/soc/ti/ti_sci_inta_msi.h
+header-test- += linux/soc/ti/ti_sci_protocol.h
+header-test- += linux/soundwire/sdw.h
+header-test- += linux/soundwire/sdw_intel.h
+header-test- += linux/soundwire/sdw_type.h
+header-test- += linux/spi/ad7877.h
+header-test- += linux/spi/ads7846.h
+header-test- += linux/spi/at86rf230.h
+header-test- += linux/spi/ds1305.h
+header-test- += linux/spi/libertas_spi.h
+header-test- += linux/spi/lms283gf05.h
+header-test- += linux/spi/max7301.h
+header-test- += linux/spi/mcp23s08.h
+header-test- += linux/spi/rspi.h
+header-test- += linux/spi/s3c24xx.h
+header-test- += linux/spi/sh_msiof.h
+header-test- += linux/spi/spi-fsl-dspi.h
+header-test- += linux/spi/spi_bitbang.h
+header-test- += linux/spi/spi_gpio.h
+header-test- += linux/spi/xilinx_spi.h
+header-test- += linux/spinlock_api_smp.h
+header-test- += linux/spinlock_api_up.h
+header-test- += linux/spinlock_types.h
+header-test- += linux/splice.h
+header-test- += linux/sram.h
+header-test- += linux/srcutiny.h
+header-test- += linux/srcutree.h
+header-test- += linux/ssb/ssb_driver_chipcommon.h
+header-test- += linux/ssb/ssb_driver_extif.h
+header-test- += linux/ssb/ssb_driver_mips.h
+header-test- += linux/ssb/ssb_driver_pci.h
+header-test- += linux/ssbi.h
+header-test- += linux/stackdepot.h
+header-test- += linux/stmp3xxx_rtc_wdt.h
+header-test- += linux/string_helpers.h
+header-test- += linux/sungem_phy.h
+header-test- += linux/sunrpc/msg_prot.h
+header-test- += linux/sunrpc/rpc_pipe_fs.h
+header-test- += linux/sunrpc/xprtmultipath.h
+header-test- += linux/sunrpc/xprtsock.h
+header-test- += linux/sunxi-rsb.h
+header-test- += linux/svga.h
+header-test- += linux/sw842.h
+header-test- += linux/swapfile.h
+header-test- += linux/swapops.h
+header-test- += linux/swiotlb.h
+header-test- += linux/sysv_fs.h
+header-test- += linux/t10-pi.h
+header-test- += linux/task_io_accounting.h
+header-test- += linux/tick.h
+header-test- += linux/timb_dma.h
+header-test- += linux/timekeeping.h
+header-test- += linux/timekeeping32.h
+header-test- += linux/ts-nbus.h
+header-test- += linux/tsacct_kern.h
+header-test- += linux/tty_flip.h
+header-test- += linux/tty_ldisc.h
+header-test- += linux/ucb1400.h
+header-test- += linux/usb/association.h
+header-test- += linux/usb/cdc-wdm.h
+header-test- += linux/usb/cdc_ncm.h
+header-test- += linux/usb/ezusb.h
+header-test- += linux/usb/gadget_configfs.h
+header-test- += linux/usb/gpio_vbus.h
+header-test- += linux/usb/hcd.h
+header-test- += linux/usb/iowarrior.h
+header-test- += linux/usb/irda.h
+header-test- += linux/usb/isp116x.h
+header-test- += linux/usb/isp1362.h
+header-test- += linux/usb/musb.h
+header-test- += linux/usb/net2280.h
+header-test- += linux/usb/ohci_pdriver.h
+header-test- += linux/usb/otg-fsm.h
+header-test- += linux/usb/pd_ado.h
+header-test- += linux/usb/r8a66597.h
+header-test- += linux/usb/rndis_host.h
+header-test- += linux/usb/serial.h
+header-test- += linux/usb/sl811.h
+header-test- += linux/usb/storage.h
+header-test- += linux/usb/uas.h
+header-test- += linux/usb/usb338x.h
+header-test- += linux/usb/usbnet.h
+header-test- += linux/usb/wusb-wa.h
+header-test- += linux/usb/xhci-dbgp.h
+header-test- += linux/usb_usual.h
+header-test- += linux/user-return-notifier.h
+header-test- += linux/userfaultfd_k.h
+header-test- += linux/verification.h
+header-test- += linux/vgaarb.h
+header-test- += linux/via_core.h
+header-test- += linux/via_i2c.h
+header-test- += linux/virtio_byteorder.h
+header-test- += linux/virtio_ring.h
+header-test- += linux/visorbus.h
+header-test- += linux/vme.h
+header-test- += linux/vmstat.h
+header-test- += linux/vmw_vmci_api.h
+header-test- += linux/vmw_vmci_defs.h
+header-test- += linux/vringh.h
+header-test- += linux/vt_buffer.h
+header-test- += linux/zorro.h
+header-test- += linux/zpool.h
+header-test- += math-emu/double.h
+header-test- += math-emu/op-common.h
+header-test- += math-emu/quad.h
+header-test- += math-emu/single.h
+header-test- += math-emu/soft-fp.h
+header-test- += media/davinci/dm355_ccdc.h
+header-test- += media/davinci/dm644x_ccdc.h
+header-test- += media/davinci/isif.h
+header-test- += media/davinci/vpbe_osd.h
+header-test- += media/davinci/vpbe_types.h
+header-test- += media/davinci/vpif_types.h
+header-test- += media/demux.h
+header-test- += media/drv-intf/soc_mediabus.h
+header-test- += media/dvb_net.h
+header-test- += media/fwht-ctrls.h
+header-test- += media/i2c/ad9389b.h
+header-test- += media/i2c/adv7343.h
+header-test- += media/i2c/adv7511.h
+header-test- += media/i2c/adv7842.h
+header-test- += media/i2c/m5mols.h
+header-test- += media/i2c/mt9m032.h
+header-test- += media/i2c/mt9t112.h
+header-test- += media/i2c/mt9v032.h
+header-test- += media/i2c/ov2659.h
+header-test- += media/i2c/ov7670.h
+header-test- += media/i2c/rj54n1cb0c.h
+header-test- += media/i2c/saa6588.h
+header-test- += media/i2c/saa7115.h
+header-test- += media/i2c/sr030pc30.h
+header-test- += media/i2c/tc358743.h
+header-test- += media/i2c/tda1997x.h
+header-test- += media/i2c/ths7303.h
+header-test- += media/i2c/tvaudio.h
+header-test- += media/i2c/tvp514x.h
+header-test- += media/i2c/tvp7002.h
+header-test- += media/i2c/wm8775.h
+header-test- += media/imx.h
+header-test- += media/media-dev-allocator.h
+header-test- += media/mpeg2-ctrls.h
+header-test- += media/rcar-fcp.h
+header-test- += media/tuner-types.h
+header-test- += media/tveeprom.h
+header-test- += media/v4l2-flash-led-class.h
+header-test- += misc/altera.h
+header-test- += misc/cxl-base.h
+header-test- += misc/cxllib.h
+header-test- += net/9p/9p.h
+header-test- += net/9p/client.h
+header-test- += net/9p/transport.h
+header-test- += net/af_vsock.h
+header-test- += net/ax88796.h
+header-test- += net/bluetooth/hci.h
+header-test- += net/bluetooth/hci_core.h
+header-test- += net/bluetooth/hci_mon.h
+header-test- += net/bluetooth/hci_sock.h
+header-test- += net/bluetooth/l2cap.h
+header-test- += net/bluetooth/mgmt.h
+header-test- += net/bluetooth/rfcomm.h
+header-test- += net/bluetooth/sco.h
+header-test- += net/bond_options.h
+header-test- += net/caif/cfsrvl.h
+header-test- += net/codel_impl.h
+header-test- += net/codel_qdisc.h
+header-test- += net/compat.h
+header-test- += net/datalink.h
+header-test- += net/dcbevent.h
+header-test- += net/dcbnl.h
+header-test- += net/dn_dev.h
+header-test- += net/dn_fib.h
+header-test- += net/dn_neigh.h
+header-test- += net/dn_nsp.h
+header-test- += net/dn_route.h
+header-test- += net/erspan.h
+header-test- += net/esp.h
+header-test- += net/ethoc.h
+header-test- += net/firewire.h
+header-test- += net/flow_offload.h
+header-test- += net/fq.h
+header-test- += net/fq_impl.h
+header-test- += net/garp.h
+header-test- += net/gtp.h
+header-test- += net/gue.h
+header-test- += net/hwbm.h
+header-test- += net/ila.h
+header-test- += net/inet6_connection_sock.h
+header-test- += net/inet_common.h
+header-test- += net/inet_frag.h
+header-test- += net/ip6_route.h
+header-test- += net/ip_vs.h
+header-test- += net/ipcomp.h
+header-test- += net/ipconfig.h
+header-test- += net/iucv/af_iucv.h
+header-test- += net/iucv/iucv.h
+header-test- += net/lapb.h
+header-test- += net/llc_c_ac.h
+header-test- += net/llc_c_st.h
+header-test- += net/llc_s_ac.h
+header-test- += net/llc_s_ev.h
+header-test- += net/llc_s_st.h
+header-test- += net/mpls_iptunnel.h
+header-test- += net/mrp.h
+header-test- += net/ncsi.h
+header-test- += net/netevent.h
+header-test- += net/netfilter/br_netfilter.h
+header-test- += net/netfilter/ipv4/nf_dup_ipv4.h
+header-test- += net/netfilter/ipv6/nf_defrag_ipv6.h
+header-test- += net/netfilter/ipv6/nf_dup_ipv6.h
+header-test- += net/netfilter/nf_conntrack.h
+header-test- += net/netfilter/nf_conntrack_acct.h
+header-test- += net/netfilter/nf_conntrack_bridge.h
+header-test- += net/netfilter/nf_conntrack_core.h
+header-test- += net/netfilter/nf_conntrack_count.h
+header-test- += net/netfilter/nf_conntrack_ecache.h
+header-test- += net/netfilter/nf_conntrack_expect.h
+header-test- += net/netfilter/nf_conntrack_extend.h
+header-test- += net/netfilter/nf_conntrack_helper.h
+header-test- += net/netfilter/nf_conntrack_l4proto.h
+header-test- += net/netfilter/nf_conntrack_labels.h
+header-test- += net/netfilter/nf_conntrack_seqadj.h
+header-test- += net/netfilter/nf_conntrack_synproxy.h
+header-test- += net/netfilter/nf_conntrack_timeout.h
+header-test- += net/netfilter/nf_conntrack_timestamp.h
+header-test- += net/netfilter/nf_conntrack_tuple.h
+header-test- += net/netfilter/nf_dup_netdev.h
+header-test- += net/netfilter/nf_flow_table.h
+header-test- += net/netfilter/nf_nat.h
+header-test- += net/netfilter/nf_nat_helper.h
+header-test- += net/netfilter/nf_nat_masquerade.h
+header-test- += net/netfilter/nf_nat_redirect.h
+header-test- += net/netfilter/nf_queue.h
+header-test- += net/netfilter/nf_reject.h
+header-test- += net/netfilter/nf_synproxy.h
+header-test- += net/netfilter/nf_tables.h
+header-test- += net/netfilter/nf_tables_core.h
+header-test- += net/netfilter/nf_tables_ipv4.h
+header-test- += net/netfilter/nf_tables_ipv6.h
+header-test- += net/netfilter/nft_fib.h
+header-test- += net/netfilter/nft_meta.h
+header-test- += net/netfilter/nft_reject.h
+header-test- += net/netns/can.h
+header-test- += net/netns/generic.h
+header-test- += net/netns/ieee802154_6lowpan.h
+header-test- += net/netns/ipv4.h
+header-test- += net/netns/ipv6.h
+header-test- += net/netns/mpls.h
+header-test- += net/netns/nftables.h
+header-test- += net/netns/sctp.h
+header-test- += net/netrom.h
+header-test- += net/p8022.h
+header-test- += net/phonet/pep.h
+header-test- += net/phonet/phonet.h
+header-test- += net/phonet/pn_dev.h
+header-test- += net/pptp.h
+header-test- += net/psample.h
+header-test- += net/psnap.h
+header-test- += net/regulatory.h
+header-test- += net/rose.h
+header-test- += net/sctp/auth.h
+header-test- += net/sctp/stream_interleave.h
+header-test- += net/sctp/stream_sched.h
+header-test- += net/sctp/tsnmap.h
+header-test- += net/sctp/ulpevent.h
+header-test- += net/sctp/ulpqueue.h
+header-test- += net/secure_seq.h
+header-test- += net/smc.h
+header-test- += net/stp.h
+header-test- += net/transp_v6.h
+header-test- += net/tun_proto.h
+header-test- += net/udplite.h
+header-test- += net/xdp.h
+header-test- += net/xdp_priv.h
+header-test- += pcmcia/cistpl.h
+header-test- += pcmcia/ds.h
+header-test- += rdma/ib.h
+header-test- += rdma/iw_portmap.h
+header-test- += rdma/opa_port_info.h
+header-test- += rdma/rdma_counter.h
+header-test- += rdma/rdmavt_cq.h
+header-test- += rdma/restrack.h
+header-test- += rdma/signature.h
+header-test- += rdma/tid_rdma_defs.h
+header-test- += scsi/fc/fc_encaps.h
+header-test- += scsi/fc/fc_fc2.h
+header-test- += scsi/fc/fc_fcoe.h
+header-test- += scsi/fc/fc_fip.h
+header-test- += scsi/fc_encode.h
+header-test- += scsi/fc_frame.h
+header-test- += scsi/iser.h
+header-test- += scsi/libfc.h
+header-test- += scsi/libfcoe.h
+header-test- += scsi/libsas.h
+header-test- += scsi/sas_ata.h
+header-test- += scsi/scsi_cmnd.h
+header-test- += scsi/scsi_dbg.h
+header-test- += scsi/scsi_device.h
+header-test- += scsi/scsi_dh.h
+header-test- += scsi/scsi_eh.h
+header-test- += scsi/scsi_host.h
+header-test- += scsi/scsi_ioctl.h
+header-test- += scsi/scsi_request.h
+header-test- += scsi/scsi_tcq.h
+header-test- += scsi/scsi_transport.h
+header-test- += scsi/scsi_transport_fc.h
+header-test- += scsi/scsi_transport_sas.h
+header-test- += scsi/scsi_transport_spi.h
+header-test- += scsi/scsi_transport_srp.h
+header-test- += scsi/scsicam.h
+header-test- += scsi/sg.h
+header-test- += soc/arc/aux.h
+header-test- += soc/arc/mcip.h
+header-test- += soc/arc/timers.h
+header-test- += soc/brcmstb/common.h
+header-test- += soc/fsl/bman.h
+header-test- += soc/fsl/qe/qe.h
+header-test- += soc/fsl/qe/qe_ic.h
+header-test- += soc/fsl/qe/qe_tdm.h
+header-test- += soc/fsl/qe/ucc.h
+header-test- += soc/fsl/qe/ucc_fast.h
+header-test- += soc/fsl/qe/ucc_slow.h
+header-test- += soc/fsl/qman.h
+header-test- += soc/nps/common.h
+header-test-$(CONFIG_ARC) += soc/nps/mtm.h
+header-test- += soc/qcom/cmd-db.h
+header-test- += soc/qcom/rpmh.h
+header-test- += soc/qcom/tcs.h
+header-test- += soc/tegra/ahb.h
+header-test- += soc/tegra/bpmp-abi.h
+header-test- += soc/tegra/common.h
+header-test- += soc/tegra/flowctrl.h
+header-test- += soc/tegra/fuse.h
+header-test- += soc/tegra/mc.h
+header-test- += sound/ac97/compat.h
+header-test- += sound/aci.h
+header-test- += sound/ad1843.h
+header-test- += sound/adau1373.h
+header-test- += sound/ak4113.h
+header-test- += sound/ak4114.h
+header-test- += sound/ak4117.h
+header-test- += sound/cs35l33.h
+header-test- += sound/cs35l34.h
+header-test- += sound/cs35l35.h
+header-test- += sound/cs35l36.h
+header-test- += sound/cs4271.h
+header-test- += sound/cs42l52.h
+header-test- += sound/cs8427.h
+header-test- += sound/da7218.h
+header-test- += sound/da7219-aad.h
+header-test- += sound/da7219.h
+header-test- += sound/da9055.h
+header-test- += sound/emu8000.h
+header-test- += sound/emux_synth.h
+header-test- += sound/hda_component.h
+header-test- += sound/hda_hwdep.h
+header-test- += sound/hda_i915.h
+header-test- += sound/hwdep.h
+header-test- += sound/i2c.h
+header-test- += sound/l3.h
+header-test- += sound/max98088.h
+header-test- += sound/max98095.h
+header-test- += sound/mixer_oss.h
+header-test- += sound/omap-hdmi-audio.h
+header-test- += sound/pcm_drm_eld.h
+header-test- += sound/pcm_iec958.h
+header-test- += sound/pcm_oss.h
+header-test- += sound/pxa2xx-lib.h
+header-test- += sound/rt286.h
+header-test- += sound/rt298.h
+header-test- += sound/rt5645.h
+header-test- += sound/rt5659.h
+header-test- += sound/rt5660.h
+header-test- += sound/rt5665.h
+header-test- += sound/rt5670.h
+header-test- += sound/s3c24xx_uda134x.h
+header-test- += sound/seq_device.h
+header-test- += sound/seq_kernel.h
+header-test- += sound/seq_midi_emul.h
+header-test- += sound/seq_oss.h
+header-test- += sound/soc-acpi-intel-match.h
+header-test- += sound/soc-dai.h
+header-test- += sound/soc-dapm.h
+header-test- += sound/soc-dpcm.h
+header-test- += sound/sof/control.h
+header-test- += sound/sof/dai-intel.h
+header-test- += sound/sof/dai.h
+header-test- += sound/sof/header.h
+header-test- += sound/sof/info.h
+header-test- += sound/sof/pm.h
+header-test- += sound/sof/stream.h
+header-test- += sound/sof/topology.h
+header-test- += sound/sof/trace.h
+header-test- += sound/sof/xtensa.h
+header-test- += sound/spear_spdif.h
+header-test- += sound/sta32x.h
+header-test- += sound/sta350.h
+header-test- += sound/tea6330t.h
+header-test- += sound/tlv320aic32x4.h
+header-test- += sound/tlv320dac33-plat.h
+header-test- += sound/uda134x.h
+header-test- += sound/wavefront.h
+header-test- += sound/wm8903.h
+header-test- += sound/wm8904.h
+header-test- += sound/wm8960.h
+header-test- += sound/wm8962.h
+header-test- += sound/wm8993.h
+header-test- += sound/wm8996.h
+header-test- += sound/wm9081.h
+header-test- += sound/wm9090.h
+header-test- += target/iscsi/iscsi_target_stat.h
+header-test- += trace/bpf_probe.h
+header-test- += trace/events/9p.h
+header-test- += trace/events/afs.h
+header-test- += trace/events/asoc.h
+header-test- += trace/events/bcache.h
+header-test- += trace/events/block.h
+header-test- += trace/events/cachefiles.h
+header-test- += trace/events/cgroup.h
+header-test- += trace/events/clk.h
+header-test- += trace/events/cma.h
+header-test- += trace/events/ext4.h
+header-test- += trace/events/f2fs.h
+header-test- += trace/events/fs_dax.h
+header-test- += trace/events/fscache.h
+header-test- += trace/events/fsi.h
+header-test- += trace/events/fsi_master_ast_cf.h
+header-test- += trace/events/fsi_master_gpio.h
+header-test- += trace/events/huge_memory.h
+header-test- += trace/events/ib_mad.h
+header-test- += trace/events/ib_umad.h
+header-test- += trace/events/iscsi.h
+header-test- += trace/events/jbd2.h
+header-test- += trace/events/kvm.h
+header-test- += trace/events/kyber.h
+header-test- += trace/events/libata.h
+header-test- += trace/events/mce.h
+header-test- += trace/events/mdio.h
+header-test- += trace/events/migrate.h
+header-test- += trace/events/mmflags.h
+header-test- += trace/events/nbd.h
+header-test- += trace/events/nilfs2.h
+header-test- += trace/events/pwc.h
+header-test- += trace/events/rdma.h
+header-test- += trace/events/rpcgss.h
+header-test- += trace/events/rpcrdma.h
+header-test- += trace/events/rxrpc.h
+header-test- += trace/events/scsi.h
+header-test- += trace/events/siox.h
+header-test- += trace/events/spi.h
+header-test- += trace/events/swiotlb.h
+header-test- += trace/events/syscalls.h
+header-test- += trace/events/target.h
+header-test- += trace/events/thermal_power_allocator.h
+header-test- += trace/events/timer.h
+header-test- += trace/events/wbt.h
+header-test- += trace/events/xen.h
+header-test- += trace/perf.h
+header-test- += trace/trace_events.h
+header-test- += uapi/drm/vmwgfx_drm.h
+header-test- += uapi/linux/a.out.h
+header-test- += uapi/linux/coda.h
+header-test- += uapi/linux/coda_psdev.h
+header-test- += uapi/linux/errqueue.h
+header-test- += uapi/linux/eventpoll.h
+header-test- += uapi/linux/hdlc/ioctl.h
+header-test- += uapi/linux/input.h
+header-test- += uapi/linux/kvm.h
+header-test- += uapi/linux/kvm_para.h
+header-test- += uapi/linux/lightnvm.h
+header-test- += uapi/linux/mic_common.h
+header-test- += uapi/linux/mman.h
+header-test- += uapi/linux/netfilter/ipset/ip_set_bitmap.h
+header-test- += uapi/linux/netfilter/ipset/ip_set_hash.h
+header-test- += uapi/linux/netfilter/ipset/ip_set_list.h
+header-test- += uapi/linux/netfilter/nf_synproxy.h
+header-test- += uapi/linux/netfilter/xt_policy.h
+header-test- += uapi/linux/netfilter/xt_set.h
+header-test- += uapi/linux/netfilter_arp/arp_tables.h
+header-test- += uapi/linux/netfilter_arp/arpt_mangle.h
+header-test- += uapi/linux/netfilter_ipv4/ip_tables.h
+header-test- += uapi/linux/netfilter_ipv4/ipt_LOG.h
+header-test- += uapi/linux/netfilter_ipv6/ip6_tables.h
+header-test- += uapi/linux/netfilter_ipv6/ip6t_LOG.h
+header-test- += uapi/linux/nilfs2_ondisk.h
+header-test- += uapi/linux/patchkey.h
+header-test- += uapi/linux/ptrace.h
+header-test- += uapi/linux/scc.h
+header-test- += uapi/linux/seg6_iptunnel.h
+header-test- += uapi/linux/smc_diag.h
+header-test- += uapi/linux/timex.h
+header-test- += uapi/linux/videodev2.h
+header-test- += uapi/scsi/scsi_bsg_fc.h
+header-test- += uapi/sound/asound.h
+header-test- += uapi/sound/sof/eq.h
+header-test- += uapi/sound/sof/fw.h
+header-test- += uapi/sound/sof/header.h
+header-test- += uapi/sound/sof/manifest.h
+header-test- += uapi/sound/sof/trace.h
+header-test- += uapi/xen/evtchn.h
+header-test- += uapi/xen/gntdev.h
+header-test- += uapi/xen/privcmd.h
+header-test- += vdso/vsyscall.h
+header-test- += video/broadsheetfb.h
+header-test- += video/cvisionppc.h
+header-test- += video/gbe.h
+header-test- += video/kyro.h
+header-test- += video/maxinefb.h
+header-test- += video/metronomefb.h
+header-test- += video/neomagic.h
+header-test- += video/of_display_timing.h
+header-test- += video/omapvrfb.h
+header-test- += video/s1d13xxxfb.h
+header-test- += video/sstfb.h
+header-test- += video/tgafb.h
+header-test- += video/udlfb.h
+header-test- += video/uvesafb.h
+header-test- += video/vga.h
+header-test- += video/w100fb.h
+header-test- += xen/acpi.h
+header-test- += xen/arm/hypercall.h
+header-test- += xen/arm/page-coherent.h
+header-test- += xen/arm/page.h
+header-test- += xen/balloon.h
+header-test- += xen/events.h
+header-test- += xen/features.h
+header-test- += xen/grant_table.h
+header-test- += xen/hvm.h
+header-test- += xen/interface/callback.h
+header-test- += xen/interface/event_channel.h
+header-test- += xen/interface/grant_table.h
+header-test- += xen/interface/hvm/dm_op.h
+header-test- += xen/interface/hvm/hvm_op.h
+header-test- += xen/interface/hvm/hvm_vcpu.h
+header-test- += xen/interface/hvm/params.h
+header-test- += xen/interface/hvm/start_info.h
+header-test- += xen/interface/io/9pfs.h
+header-test- += xen/interface/io/blkif.h
+header-test- += xen/interface/io/console.h
+header-test- += xen/interface/io/displif.h
+header-test- += xen/interface/io/fbif.h
+header-test- += xen/interface/io/kbdif.h
+header-test- += xen/interface/io/netif.h
+header-test- += xen/interface/io/pciif.h
+header-test- += xen/interface/io/protocols.h
+header-test- += xen/interface/io/pvcalls.h
+header-test- += xen/interface/io/ring.h
+header-test- += xen/interface/io/sndif.h
+header-test- += xen/interface/io/tpmif.h
+header-test- += xen/interface/io/vscsiif.h
+header-test- += xen/interface/io/xs_wire.h
+header-test- += xen/interface/memory.h
+header-test- += xen/interface/nmi.h
+header-test- += xen/interface/physdev.h
+header-test- += xen/interface/platform.h
+header-test- += xen/interface/sched.h
+header-test- += xen/interface/vcpu.h
+header-test- += xen/interface/version.h
+header-test- += xen/interface/xen-mca.h
+header-test- += xen/interface/xen.h
+header-test- += xen/interface/xenpmu.h
+header-test- += xen/mem-reservation.h
+header-test- += xen/page.h
+header-test- += xen/platform_pci.h
+header-test- += xen/swiotlb-xen.h
+header-test- += xen/xen-front-pgdir-shbuf.h
+header-test- += xen/xen-ops.h
+header-test- += xen/xen.h
+header-test- += xen/xenbus.h
+
+# Do not include directly
+header-test- += linux/compiler-clang.h
+header-test- += linux/compiler-gcc.h
+header-test- += linux/patchkey.h
+header-test- += linux/rwlock_api_smp.h
+header-test- += linux/spinlock_types_up.h
+header-test- += linux/spinlock_up.h
+header-test- += linux/wimax/debug.h
+header-test- += rdma/uverbs_named_ioctl.h
+
+# asm-generic/*.h is used by asm/*.h, and should not be included directly
+header-test- += asm-generic/% uapi/asm-generic/%
+
+# Timestamp files touched by Kconfig
+header-test- += config/%
+
+# Timestamp files touched by scripts/adjust_autoksyms.sh
+header-test- += ksym/%
+
+# You could compile-test these, but maybe not so useful...
+header-test- += dt-bindings/%
+
+# Do not test generated headers. Stale headers are often left over when you
+# traverse the git history without cleaning.
+header-test- += generated/%
+
+# The rest are compile-tested
+header-test-pattern-y += */*.h */*/*.h */*/*/*.h */*/*/*/*.h
diff --git a/include/uapi/linux/Kbuild b/include/uapi/Kbuild
index 34711c5d6968..61ee6e59c930 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/Kbuild
@@ -1,14 +1,14 @@
# SPDX-License-Identifier: GPL-2.0
ifeq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/a.out.h),)
-no-export-headers += a.out.h
+no-export-headers += linux/a.out.h
endif
ifeq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/kvm.h),)
-no-export-headers += kvm.h
+no-export-headers += linux/kvm.h
endif
ifeq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/kvm_para.h),)
ifeq ($(wildcard $(objtree)/arch/$(SRCARCH)/include/generated/uapi/asm/kvm_para.h),)
-no-export-headers += kvm_para.h
+no-export-headers += linux/kvm_para.h
endif
endif
diff --git a/init/Kconfig b/init/Kconfig
index d3ad48272924..9697c6b5303c 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -24,6 +24,9 @@ config CLANG_VERSION
int
default $(shell,$(srctree)/scripts/clang-version.sh $(CC))
+config CC_CAN_LINK
+ def_bool $(success,$(srctree)/scripts/cc-can-link.sh $(CC))
+
config CC_HAS_ASM_GOTO
def_bool $(success,$(srctree)/scripts/gcc-goto.sh $(CC))
@@ -96,6 +99,36 @@ config COMPILE_TEST
here. If you are a user/distributor, say N here to exclude useless
drivers to be distributed.
+config HEADER_TEST
+ bool "Compile test headers that should be standalone compilable"
+ help
+ Compile test headers listed in header-test-y target to ensure they are
+ self-contained, i.e. compilable as standalone units.
+
+ If you are a developer or tester and want to ensure the requested
+ headers are self-contained, say Y here. Otherwise, choose N.
+
+config KERNEL_HEADER_TEST
+ bool "Compile test kernel headers"
+ depends on HEADER_TEST
+ help
+ Headers in include/ are used to build external moduls.
+ Compile test them to ensure they are self-contained, i.e.
+ compilable as standalone units.
+
+ If you are a developer or tester and want to ensure the headers
+ in include/ are self-contained, say Y here. Otherwise, choose N.
+
+config UAPI_HEADER_TEST
+ bool "Compile test UAPI headers"
+ depends on HEADER_TEST && HEADERS_INSTALL && CC_CAN_LINK
+ help
+ Compile test headers exported to user-space to ensure they are
+ self-contained, i.e. compilable as standalone units.
+
+ If you are a developer or tester and want to ensure the exported
+ headers are self-contained, say Y here. Otherwise, choose N.
+
config LOCALVERSION
string "Local version - append to kernel release"
help
diff --git a/kernel/gen_kheaders.sh b/kernel/gen_kheaders.sh
index 9a34e1d9bd7f..9ff449888d9c 100755
--- a/kernel/gen_kheaders.sh
+++ b/kernel/gen_kheaders.sh
@@ -4,24 +4,12 @@
# This script generates an archive consisting of kernel headers
# for CONFIG_IKHEADERS.
set -e
-spath="$(dirname "$(readlink -f "$0")")"
-kroot="$spath/.."
+sfile="$(readlink -f "$0")"
outdir="$(pwd)"
tarfile=$1
cpio_dir=$outdir/$tarfile.tmp
-# Script filename relative to the kernel source root
-# We add it to the archive because it is small and any changes
-# to this script will also cause a rebuild of the archive.
-sfile="$(realpath --relative-to $kroot "$(readlink -f "$0")")"
-
-src_file_list="
-include/
-arch/$SRCARCH/include/
-$sfile
-"
-
-obj_file_list="
+dir_list="
include/
arch/$SRCARCH/include/
"
@@ -33,33 +21,29 @@ arch/$SRCARCH/include/
# Uncomment it for debugging.
# if [ ! -f /tmp/iter ]; then iter=1; echo 1 > /tmp/iter;
# else iter=$(($(cat /tmp/iter) + 1)); echo $iter > /tmp/iter; fi
-# find $src_file_list -type f | xargs ls -lR > /tmp/src-ls-$iter
-# find $obj_file_list -type f | xargs ls -lR > /tmp/obj-ls-$iter
+# find $src_file_list -name "*.h" | xargs ls -l > /tmp/src-ls-$iter
+# find $obj_file_list -name "*.h" | xargs ls -l > /tmp/obj-ls-$iter
# include/generated/compile.h is ignored because it is touched even when none
# of the source files changed. This causes pointless regeneration, so let us
# ignore them for md5 calculation.
-pushd $kroot > /dev/null
-src_files_md5="$(find $src_file_list -type f |
+pushd $srctree > /dev/null
+src_files_md5="$(find $dir_list -name "*.h" |
grep -v "include/generated/compile.h" |
grep -v "include/generated/autoconf.h" |
- grep -v "include/config/auto.conf" |
- grep -v "include/config/auto.conf.cmd" |
- grep -v "include/config/tristate.conf" |
- xargs ls -lR | md5sum | cut -d ' ' -f1)"
+ xargs ls -l | md5sum | cut -d ' ' -f1)"
popd > /dev/null
-obj_files_md5="$(find $obj_file_list -type f |
+obj_files_md5="$(find $dir_list -name "*.h" |
grep -v "include/generated/compile.h" |
grep -v "include/generated/autoconf.h" |
- grep -v "include/config/auto.conf" |
- grep -v "include/config/auto.conf.cmd" |
- grep -v "include/config/tristate.conf" |
- xargs ls -lR | md5sum | cut -d ' ' -f1)"
-
+ xargs ls -l | md5sum | cut -d ' ' -f1)"
+# Any changes to this script will also cause a rebuild of the archive.
+this_file_md5="$(ls -l $sfile | md5sum | cut -d ' ' -f1)"
if [ -f $tarfile ]; then tarfile_md5="$(md5sum $tarfile | cut -d ' ' -f1)"; fi
if [ -f kernel/kheaders.md5 ] &&
[ "$(cat kernel/kheaders.md5|head -1)" == "$src_files_md5" ] &&
[ "$(cat kernel/kheaders.md5|head -2|tail -1)" == "$obj_files_md5" ] &&
+ [ "$(cat kernel/kheaders.md5|head -3|tail -1)" == "$this_file_md5" ] &&
[ "$(cat kernel/kheaders.md5|tail -1)" == "$tarfile_md5" ]; then
exit
fi
@@ -71,16 +55,16 @@ fi
rm -rf $cpio_dir
mkdir $cpio_dir
-pushd $kroot > /dev/null
-for f in $src_file_list;
- do find "$f" ! -name "*.cmd" ! -name ".*";
+pushd $srctree > /dev/null
+for f in $dir_list;
+ do find "$f" -name "*.h";
done | cpio --quiet -pd $cpio_dir
popd > /dev/null
# The second CPIO can complain if files already exist which can
# happen with out of tree builds. Just silence CPIO for now.
-for f in $obj_file_list;
- do find "$f" ! -name "*.cmd" ! -name ".*";
+for f in $dir_list;
+ do find "$f" -name "*.h";
done | cpio --quiet -pd $cpio_dir >/dev/null 2>&1
# Remove comments except SDPX lines
@@ -91,6 +75,7 @@ tar -Jcf $tarfile -C $cpio_dir/ . > /dev/null
echo "$src_files_md5" > kernel/kheaders.md5
echo "$obj_files_md5" >> kernel/kheaders.md5
+echo "$this_file_md5" >> kernel/kheaders.md5
echo "$(md5sum $tarfile | cut -d ' ' -f1)" >> kernel/kheaders.md5
rm -rf $cpio_dir
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index d4c8c9323aa4..4ac4ca21a30a 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -305,19 +305,26 @@ config DEBUG_FS
If unsure, say N.
-config HEADERS_CHECK
- bool "Run 'make headers_check' when building vmlinux"
+config HEADERS_INSTALL
+ bool "Install uapi headers to usr/include"
depends on !UML
help
- This option will extract the user-visible kernel headers whenever
- building the kernel, and will run basic sanity checks on them to
- ensure that exported files do not attempt to include files which
- were not exported, etc.
+ This option will install uapi headers (headers exported to user-space)
+ into the usr/include directory for use during the kernel build.
+ This is unneeded for building the kernel itself, but needed for some
+ user-space program samples. It is also needed by some features such
+ as uapi header sanity checks.
+
+config HEADERS_CHECK
+ bool "Run sanity checks on uapi headers when building 'all'"
+ depends on HEADERS_INSTALL
+ help
+ This option will run basic sanity checks on uapi headers when
+ building the 'all' target, for example, ensure that they do not
+ attempt to include files which were not exported, etc.
If you're making modifications to header files which are
- relevant for userspace, say 'Y', and check the headers
- exported to $(INSTALL_HDR_PATH) (usually 'usr/include' in
- your build tree), to make sure they're suitable.
+ relevant for userspace, say 'Y'.
config OPTIMIZE_INLINING
bool "Allow compiler to uninline functions marked 'inline'"
diff --git a/lib/raid6/Makefile b/lib/raid6/Makefile
index e723eacf7868..42695bc8d451 100644
--- a/lib/raid6/Makefile
+++ b/lib/raid6/Makefile
@@ -12,9 +12,6 @@ raid6_pq-$(CONFIG_S390) += s390vx8.o recov_s390xc.o
hostprogs-y += mktables
-quiet_cmd_unroll = UNROLL $@
- cmd_unroll = $(AWK) -f$(srctree)/$(src)/unroll.awk -vN=$(UNROLL) < $< > $@
-
ifeq ($(CONFIG_ALTIVEC),y)
altivec_flags := -maltivec $(call cc-option,-mabi=altivec)
@@ -26,7 +23,6 @@ CFLAGS_REMOVE_altivec1.o += -msoft-float
CFLAGS_REMOVE_altivec2.o += -msoft-float
CFLAGS_REMOVE_altivec4.o += -msoft-float
CFLAGS_REMOVE_altivec8.o += -msoft-float
-CFLAGS_REMOVE_altivec8.o += -msoft-float
CFLAGS_REMOVE_vpermxor1.o += -msoft-float
CFLAGS_REMOVE_vpermxor2.o += -msoft-float
CFLAGS_REMOVE_vpermxor4.o += -msoft-float
@@ -51,111 +47,39 @@ CFLAGS_REMOVE_neon8.o += -mgeneral-regs-only
endif
endif
-targets += int1.c
-$(obj)/int1.c: UNROLL := 1
-$(obj)/int1.c: $(src)/int.uc $(src)/unroll.awk FORCE
- $(call if_changed,unroll)
-
-targets += int2.c
-$(obj)/int2.c: UNROLL := 2
-$(obj)/int2.c: $(src)/int.uc $(src)/unroll.awk FORCE
- $(call if_changed,unroll)
-
-targets += int4.c
-$(obj)/int4.c: UNROLL := 4
-$(obj)/int4.c: $(src)/int.uc $(src)/unroll.awk FORCE
- $(call if_changed,unroll)
-
-targets += int8.c
-$(obj)/int8.c: UNROLL := 8
-$(obj)/int8.c: $(src)/int.uc $(src)/unroll.awk FORCE
- $(call if_changed,unroll)
-
-targets += int16.c
-$(obj)/int16.c: UNROLL := 16
-$(obj)/int16.c: $(src)/int.uc $(src)/unroll.awk FORCE
- $(call if_changed,unroll)
+quiet_cmd_unroll = UNROLL $@
+ cmd_unroll = $(AWK) -f$(srctree)/$(src)/unroll.awk -vN=$* < $< > $@
-targets += int32.c
-$(obj)/int32.c: UNROLL := 32
-$(obj)/int32.c: $(src)/int.uc $(src)/unroll.awk FORCE
+targets += int1.c int2.c int4.c int8.c int16.c int32.c
+$(obj)/int%.c: $(src)/int.uc $(src)/unroll.awk FORCE
$(call if_changed,unroll)
CFLAGS_altivec1.o += $(altivec_flags)
-targets += altivec1.c
-$(obj)/altivec1.c: UNROLL := 1
-$(obj)/altivec1.c: $(src)/altivec.uc $(src)/unroll.awk FORCE
- $(call if_changed,unroll)
-
CFLAGS_altivec2.o += $(altivec_flags)
-targets += altivec2.c
-$(obj)/altivec2.c: UNROLL := 2
-$(obj)/altivec2.c: $(src)/altivec.uc $(src)/unroll.awk FORCE
- $(call if_changed,unroll)
-
CFLAGS_altivec4.o += $(altivec_flags)
-targets += altivec4.c
-$(obj)/altivec4.c: UNROLL := 4
-$(obj)/altivec4.c: $(src)/altivec.uc $(src)/unroll.awk FORCE
- $(call if_changed,unroll)
-
CFLAGS_altivec8.o += $(altivec_flags)
-targets += altivec8.c
-$(obj)/altivec8.c: UNROLL := 8
-$(obj)/altivec8.c: $(src)/altivec.uc $(src)/unroll.awk FORCE
+targets += altivec1.c altivec2.c altivec4.c altivec8.c
+$(obj)/altivec%.c: $(src)/altivec.uc $(src)/unroll.awk FORCE
$(call if_changed,unroll)
CFLAGS_vpermxor1.o += $(altivec_flags)
-targets += vpermxor1.c
-$(obj)/vpermxor1.c: UNROLL := 1
-$(obj)/vpermxor1.c: $(src)/vpermxor.uc $(src)/unroll.awk FORCE
- $(call if_changed,unroll)
-
CFLAGS_vpermxor2.o += $(altivec_flags)
-targets += vpermxor2.c
-$(obj)/vpermxor2.c: UNROLL := 2
-$(obj)/vpermxor2.c: $(src)/vpermxor.uc $(src)/unroll.awk FORCE
- $(call if_changed,unroll)
-
CFLAGS_vpermxor4.o += $(altivec_flags)
-targets += vpermxor4.c
-$(obj)/vpermxor4.c: UNROLL := 4
-$(obj)/vpermxor4.c: $(src)/vpermxor.uc $(src)/unroll.awk FORCE
- $(call if_changed,unroll)
-
CFLAGS_vpermxor8.o += $(altivec_flags)
-targets += vpermxor8.c
-$(obj)/vpermxor8.c: UNROLL := 8
-$(obj)/vpermxor8.c: $(src)/vpermxor.uc $(src)/unroll.awk FORCE
+targets += vpermxor1.o vpermxor2.o vpermxor4.o vpermxor8.o
+$(obj)/vpermxor%.c: $(src)/vpermxor.uc $(src)/unroll.awk FORCE
$(call if_changed,unroll)
CFLAGS_neon1.o += $(NEON_FLAGS)
-targets += neon1.c
-$(obj)/neon1.c: UNROLL := 1
-$(obj)/neon1.c: $(src)/neon.uc $(src)/unroll.awk FORCE
- $(call if_changed,unroll)
-
CFLAGS_neon2.o += $(NEON_FLAGS)
-targets += neon2.c
-$(obj)/neon2.c: UNROLL := 2
-$(obj)/neon2.c: $(src)/neon.uc $(src)/unroll.awk FORCE
- $(call if_changed,unroll)
-
CFLAGS_neon4.o += $(NEON_FLAGS)
-targets += neon4.c
-$(obj)/neon4.c: UNROLL := 4
-$(obj)/neon4.c: $(src)/neon.uc $(src)/unroll.awk FORCE
- $(call if_changed,unroll)
-
CFLAGS_neon8.o += $(NEON_FLAGS)
-targets += neon8.c
-$(obj)/neon8.c: UNROLL := 8
-$(obj)/neon8.c: $(src)/neon.uc $(src)/unroll.awk FORCE
+targets += neon1.c neon2.c neon4.c neon8.c
+$(obj)/neon%.c: $(src)/neon.uc $(src)/unroll.awk FORCE
$(call if_changed,unroll)
targets += s390vx8.c
-$(obj)/s390vx8.c: UNROLL := 8
-$(obj)/s390vx8.c: $(src)/s390vx.uc $(src)/unroll.awk FORCE
+$(obj)/s390vx%.c: $(src)/s390vx.uc $(src)/unroll.awk FORCE
$(call if_changed,unroll)
quiet_cmd_mktable = TABLE $@
diff --git a/net/bpfilter/Kconfig b/net/bpfilter/Kconfig
index 91f9d878165e..fed9290e3b41 100644
--- a/net/bpfilter/Kconfig
+++ b/net/bpfilter/Kconfig
@@ -9,7 +9,7 @@ menuconfig BPFILTER
if BPFILTER
config BPFILTER_UMH
tristate "bpfilter kernel module with user mode helper"
- depends on $(success,$(srctree)/scripts/cc-can-link.sh $(CC))
+ depends on CC_CAN_LINK
default m
help
This builds bpfilter kernel module with embedded user mode helper
diff --git a/samples/Kconfig b/samples/Kconfig
index d63cc8a3e0df..71b5e833dd9e 100644
--- a/samples/Kconfig
+++ b/samples/Kconfig
@@ -1,7 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
menuconfig SAMPLES
bool "Sample kernel code"
- depends on !UML
help
You can build and test sample kernel code here.
@@ -95,16 +94,24 @@ config SAMPLE_CONFIGFS
config SAMPLE_CONNECTOR
tristate "Build connector sample -- loadable modules only"
- depends on CONNECTOR && m
+ depends on CONNECTOR && HEADERS_INSTALL && m
help
When enabled, this builds both a sample kernel module for
the connector interface and a user space tool to communicate
with it.
See also Documentation/connector/connector.txt
+config SAMPLE_HIDRAW
+ bool "hidraw sample"
+ depends on HEADERS_INSTALL
+
+config SAMPLE_PIDFD
+ bool "pidfd sample"
+ depends on HEADERS_INSTALL
+
config SAMPLE_SECCOMP
bool "Build seccomp sample code"
- depends on SECCOMP_FILTER
+ depends on SECCOMP_FILTER && HEADERS_INSTALL
help
Build samples of seccomp filters using various methods of
BPF filter construction.
@@ -156,6 +163,7 @@ config SAMPLE_ANDROID_BINDERFS
config SAMPLE_VFS
bool "Build example programs that use new VFS system calls"
+ depends on HEADERS_INSTALL
help
Build example userspace programs that use new VFS system calls such
as mount API and statx(). Note that this is restricted to the x86
diff --git a/samples/Makefile b/samples/Makefile
index debf8925f06f..7d6e4ca28d69 100644
--- a/samples/Makefile
+++ b/samples/Makefile
@@ -4,14 +4,14 @@
obj-$(CONFIG_SAMPLE_ANDROID_BINDERFS) += binderfs/
obj-$(CONFIG_SAMPLE_CONFIGFS) += configfs/
obj-$(CONFIG_SAMPLE_CONNECTOR) += connector/
-subdir-y += hidraw
+subdir-$(CONFIG_SAMPLE_HIDRAW) += hidraw
obj-$(CONFIG_SAMPLE_HW_BREAKPOINT) += hw_breakpoint/
obj-$(CONFIG_SAMPLE_KDB) += kdb/
obj-$(CONFIG_SAMPLE_KFIFO) += kfifo/
obj-$(CONFIG_SAMPLE_KOBJECT) += kobject/
obj-$(CONFIG_SAMPLE_KPROBES) += kprobes/
obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch/
-subdir-y += pidfd
+subdir-$(CONFIG_SAMPLE_PIDFD) += pidfd
obj-$(CONFIG_SAMPLE_QMI_CLIENT) += qmi/
obj-$(CONFIG_SAMPLE_RPMSG_CLIENT) += rpmsg/
subdir-$(CONFIG_SAMPLE_SECCOMP) += seccomp
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index ee58cde8ee3b..73e80b917f12 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -79,8 +79,8 @@ endef
# would try to directly execute the shell builtin 'command'. This workaround
# should be kept for a long time since this issue was fixed only after the
# GNU Make 4.2.1 release.
-cc-cross-prefix = $(firstword $(foreach c, $(filter-out -%, $(1)), \
- $(if $(shell command -v $(c)gcc 2>/dev/null), $(c))))
+cc-cross-prefix = $(firstword $(foreach c, $(1), \
+ $(if $(shell command -v -- $(c)gcc 2>/dev/null), $(c))))
# output directory for tests below
TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/)
@@ -187,12 +187,6 @@ dtbinst := -f $(srctree)/scripts/Makefile.dtbinst obj
# $(Q)$(MAKE) $(clean)=dir
clean := -f $(srctree)/scripts/Makefile.clean obj
-###
-# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.headersinst obj=
-# Usage:
-# $(Q)$(MAKE) $(hdr-inst)=dir
-hdr-inst := -f $(srctree)/scripts/Makefile.headersinst obj
-
# echo command.
# Short version is used, if $(quiet) equals `quiet_', otherwise full one.
echo-cmd = $(if $($(quiet)cmd_$(1)),\
@@ -213,12 +207,12 @@ objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o)))
# See Documentation/kbuild/makefiles.rst for more info
ifneq ($(KBUILD_NOCMDDEP),1)
-# Check if both arguments are the same including their order. Result is empty
+# Check if both commands are the same including their order. Result is empty
# string if equal. User may override this check using make KBUILD_NOCMDDEP=1
-arg-check = $(filter-out $(subst $(space),$(space_escape),$(strip $(cmd_$@))), \
+cmd-check = $(filter-out $(subst $(space),$(space_escape),$(strip $(cmd_$@))), \
$(subst $(space),$(space_escape),$(strip $(cmd_$1))))
else
-arg-check = $(if $(strip $(cmd_$@)),,1)
+cmd-check = $(if $(strip $(cmd_$@)),,1)
endif
# Replace >$< with >$$< to preserve $ when reloading the .cmd file
@@ -231,15 +225,15 @@ make-cmd = $(call escsq,$(subst $(pound),$$(pound),$(subst $$,$$$$,$(cmd_$(1))))
# Find any prerequisites that is newer than target or that does not exist.
# PHONY targets skipped in both cases.
-any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^)
+any-prereq = $(filter-out $(PHONY),$?)$(filter-out $(PHONY) $(wildcard $^),$^)
# Execute command if command has changed or prerequisite(s) are updated.
-if_changed = $(if $(strip $(any-prereq) $(arg-check)), \
+if_changed = $(if $(any-prereq)$(cmd-check), \
$(cmd); \
printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:)
# Execute the command and also postprocess generated .d dependencies file.
-if_changed_dep = $(if $(strip $(any-prereq) $(arg-check)),$(cmd_and_fixdep),@:)
+if_changed_dep = $(if $(any-prereq)$(cmd-check),$(cmd_and_fixdep),@:)
cmd_and_fixdep = \
$(cmd); \
@@ -249,7 +243,7 @@ cmd_and_fixdep = \
# Usage: $(call if_changed_rule,foo)
# Will check if $(cmd_foo) or any of the prerequisites changed,
# and if so will execute $(rule_foo).
-if_changed_rule = $(if $(strip $(any-prereq) $(arg-check)),$(rule_$(1)),@:)
+if_changed_rule = $(if $(any-prereq)$(cmd-check),$(rule_$(1)),@:)
###
# why - tell why a target got built
@@ -274,8 +268,8 @@ ifeq ($(KBUILD_VERBOSE),2)
why = \
$(if $(filter $@, $(PHONY)),- due to target is PHONY, \
$(if $(wildcard $@), \
- $(if $(strip $(any-prereq)),- due to: $(any-prereq), \
- $(if $(arg-check), \
+ $(if $(any-prereq),- due to: $(any-prereq), \
+ $(if $(cmd-check), \
$(if $(cmd_$@),- due to command line change, \
$(if $(filter $@, $(targets)), \
- due to missing .cmd file, \
diff --git a/scripts/Makefile b/scripts/Makefile
index 9d442ee050bd..16bcb8087899 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -31,11 +31,6 @@ always := $(hostprogs-y) $(hostprogs-m)
# The following hostprogs-y programs are only build on demand
hostprogs-y += unifdef
-# These targets are used internally to avoid "is up to date" messages
-PHONY += build_unifdef
-build_unifdef: $(obj)/unifdef
- @:
-
subdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins
subdir-$(CONFIG_MODVERSIONS) += genksyms
subdir-$(CONFIG_SECURITY_SELINUX) += selinux
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index ae9cf740633e..be38198d98b2 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -294,6 +294,15 @@ quiet_cmd_cc_lst_c = MKLST $@
$(obj)/%.lst: $(src)/%.c FORCE
$(call if_changed_dep,cc_lst_c)
+# header test (header-test-y target)
+# ---------------------------------------------------------------------------
+
+quiet_cmd_cc_s_h = CC $@
+ cmd_cc_s_h = $(CC) $(c_flags) -S -o $@ -x c /dev/null -include $<
+
+$(obj)/%.h.s: $(src)/%.h FORCE
+ $(call if_changed_dep,cc_s_h)
+
# Compile assembler sources (.S)
# ---------------------------------------------------------------------------
@@ -504,7 +513,7 @@ existing-targets := $(wildcard $(sort $(targets)))
-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
-ifneq ($(srctree),.)
+ifdef building_out_of_srctree
# Create directories for object files if they do not exist
obj-dirs := $(sort $(obj) $(patsubst %/,%, $(dir $(targets))))
# If targets exist, their directories apparently exist. Skip mkdir.
diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 3ab8d1a303cd..a74ce2e3c33e 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -34,7 +34,6 @@ warning-1 += $(call cc-option, -Wstringop-truncation)
warning-1 += -Wno-missing-field-initializers
warning-1 += -Wno-sign-compare
-warning-2 := -Waggregate-return
warning-2 += -Wcast-align
warning-2 += -Wdisabled-optimization
warning-2 += -Wnested-externs
@@ -68,10 +67,8 @@ else
ifdef CONFIG_CC_IS_CLANG
KBUILD_CFLAGS += -Wno-initializer-overrides
-KBUILD_CFLAGS += -Wno-unused-value
KBUILD_CFLAGS += -Wno-format
KBUILD_CFLAGS += -Wno-sign-compare
KBUILD_CFLAGS += -Wno-format-zero-length
-KBUILD_CFLAGS += -Wno-uninitialized
endif
endif
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 3d1ebaabd1b6..1b405a7ed14f 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -14,109 +14,89 @@ __headers:
include scripts/Kbuild.include
-srcdir := $(srctree)/$(obj)
+src := $(srctree)/$(obj)
+gen := $(objtree)/$(subst include/,include/generated/,$(obj))
+dst := usr/include
-# When make is run under a fakechroot environment, the function
-# $(wildcard $(srcdir)/*/.) doesn't only return directories, but also regular
-# files. So, we are using a combination of sort/dir/wildcard which works
-# with fakechroot.
-subdirs := $(patsubst $(srcdir)/%/,%,\
- $(filter-out $(srcdir)/,\
- $(sort $(dir $(wildcard $(srcdir)/*/)))))
+-include $(src)/Kbuild
-# Recursion
-__headers: $(subdirs)
+# $(filter %/, ...) is a workaround for GNU Make <= 4.2.1, where
+# $(wildcard $(src)/*/) contains not only directories but also regular files.
+src-subdirs := $(patsubst $(src)/%/,%,$(filter %/, $(wildcard $(src)/*/)))
+gen-subdirs := $(patsubst $(gen)/%/,%,$(filter %/, $(wildcard $(gen)/*/)))
+all-subdirs := $(sort $(src-subdirs) $(gen-subdirs))
-PHONY += $(subdirs)
-$(subdirs):
- $(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(dst)/$@
+src-headers := $(if $(src-subdirs), $(shell cd $(src) && find $(src-subdirs) -name '*.h'))
+src-headers := $(filter-out $(no-export-headers), $(src-headers))
+gen-headers := $(if $(gen-subdirs), $(shell cd $(gen) && find $(gen-subdirs) -name '*.h'))
+gen-headers := $(filter-out $(no-export-headers), $(gen-headers))
-# Skip header install/check for include/uapi and arch/$(SRCARCH)/include/uapi.
-# We have only sub-directories there.
-skip-inst := $(if $(filter %/uapi,$(obj)),1)
+# If the same header is exported from source and generated directories,
+# the former takes precedence, but this should be warned.
+duplicated := $(filter $(gen-headers), $(src-headers))
+$(if $(duplicated), $(warning duplicated header export: $(duplicated)))
-ifeq ($(skip-inst),)
+gen-headers := $(filter-out $(duplicated), $(gen-headers))
-# Kbuild file is optional
-kbuild-file := $(srctree)/$(obj)/Kbuild
--include $(kbuild-file)
+# Add dst path prefix
+all-subdirs := $(addprefix $(dst)/, $(all-subdirs))
+src-headers := $(addprefix $(dst)/, $(src-headers))
+gen-headers := $(addprefix $(dst)/, $(gen-headers))
+all-headers := $(src-headers) $(gen-headers)
-installdir := $(INSTALL_HDR_PATH)/$(dst)
-gendir := $(objtree)/$(subst include/,include/generated/,$(obj))
-header-files := $(notdir $(wildcard $(srcdir)/*.h))
-header-files := $(filter-out $(no-export-headers), $(header-files))
-genhdr-files := $(notdir $(wildcard $(gendir)/*.h))
-genhdr-files := $(filter-out $(header-files), $(genhdr-files))
+# Work out what needs to be removed
+old-subdirs := $(wildcard $(all-subdirs))
+old-headers := $(if $(old-subdirs),$(shell find $(old-subdirs) -name '*.h'))
+unwanted := $(filter-out $(all-headers), $(old-headers))
-# files used to track state of install/check
-install-file := $(installdir)/.install
-check-file := $(installdir)/.check
+# Create directories
+existing-dirs := $(sort $(dir $(old-headers)))
+wanted-dirs := $(sort $(dir $(all-headers)))
+new-dirs := $(filter-out $(existing-dirs), $(wanted-dirs))
+$(if $(new-dirs), $(shell mkdir -p $(new-dirs)))
-# all headers files for this dir
-all-files := $(header-files) $(genhdr-files)
-output-files := $(addprefix $(installdir)/, $(all-files))
+# Rules
-# Work out what needs to be removed
-oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h))
-unwanted := $(filter-out $(all-files),$(oldheaders))
+ifndef HDRCHECK
-# Prefix unwanted with full paths to $(INSTALL_HDR_PATH)
-unwanted-file := $(addprefix $(installdir)/, $(unwanted))
+quiet_cmd_install = HDRINST $@
+ cmd_install = $(CONFIG_SHELL) $(srctree)/scripts/headers_install.sh $< $@
-printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@))
+$(src-headers): $(dst)/%.h: $(src)/%.h $(srctree)/scripts/headers_install.sh FORCE
+ $(call if_changed,install)
-quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
- file$(if $(word 2, $(all-files)),s))
- cmd_install = \
- $(CONFIG_SHELL) $< $(installdir) $(srcdir) $(header-files); \
- $(CONFIG_SHELL) $< $(installdir) $(gendir) $(genhdr-files); \
- touch $@
+$(gen-headers): $(dst)/%.h: $(gen)/%.h $(srctree)/scripts/headers_install.sh FORCE
+ $(call if_changed,install)
quiet_cmd_remove = REMOVE $(unwanted)
- cmd_remove = rm -f $(unwanted-file)
-
-quiet_cmd_check = CHECK $(printdir) ($(words $(all-files)) files)
-# Headers list can be pretty long, xargs helps to avoid
-# the "Argument list too long" error.
- cmd_check = for f in $(all-files); do \
- echo "$(installdir)/$${f}"; done \
- | xargs \
- $(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH); \
- touch $@
+ cmd_remove = rm -f $(unwanted)
-ifndef HDRCHECK
-# Rules for installing headers
-__headers: $(install-file)
+__headers: $(all-headers)
+ifneq ($(unwanted),)
+ $(call cmd,remove)
+endif
@:
-targets += $(install-file)
-$(install-file): scripts/headers_install.sh \
- $(addprefix $(srcdir)/,$(header-files)) \
- $(addprefix $(gendir)/,$(genhdr-files)) FORCE
- $(if $(unwanted),$(call cmd,remove),)
- $(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@)))
- $(call if_changed,install)
+existing-headers := $(filter $(old-headers), $(all-headers))
+
+-include $(foreach f,$(existing-headers),$(dir $(f)).$(notdir $(f)).cmd)
else
-__headers: $(check-file)
- @:
-targets += $(check-file)
-$(check-file): scripts/headers_check.pl $(output-files) FORCE
- $(call if_changed,check)
+quiet_cmd_check = HDRCHK $<
+ cmd_check = $(PERL) $(srctree)/scripts/headers_check.pl $(dst) $(SRCARCH) $<; touch $@
-endif
+check-files := $(addsuffix .chk, $(all-headers))
-cmd_files := $(wildcard \
- $(foreach f,$(sort $(targets)),$(dir $(f)).$(notdir $(f)).cmd))
+$(check-files): $(dst)/%.chk : $(dst)/% $(srctree)/scripts/headers_check.pl
+ $(call cmd,check)
-ifneq ($(cmd_files),)
- include $(cmd_files)
-endif
+__headers: $(check-files)
+ @:
-endif # skip-inst
+endif
PHONY += FORCE
-FORCE: ;
+FORCE:
.PHONY: $(PHONY)
diff --git a/scripts/Makefile.host b/scripts/Makefile.host
index a316d368b697..2208ebbd8c4c 100644
--- a/scripts/Makefile.host
+++ b/scripts/Makefile.host
@@ -69,7 +69,7 @@ _hostcxx_flags = $(KBUILD_HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \
# $(objtree)/$(obj) for including generated headers from checkin source files
ifeq ($(KBUILD_EXTMOD),)
-ifneq ($(srctree),.)
+ifdef building_out_of_srctree
_hostc_flags += -I $(objtree)/$(obj)
_hostcxx_flags += -I $(objtree)/$(obj)
endif
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index f1f38c8cdc74..6cb3aa5cbc79 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -66,6 +66,20 @@ extra-y += $(patsubst %.dtb,%.dt.yaml, $(dtb-y))
extra-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtb,%.dt.yaml, $(dtb-))
endif
+# Test self-contained headers
+
+# Wildcard searches in $(srctree)/$(src)/, but not in $(objtree)/$(obj)/.
+# Stale generated headers are often left over, so pattern matching should
+# be avoided. Please notice $(srctree)/$(src)/ and $(objtree)/$(obj) point
+# to the same location for in-tree building. So, header-test-pattern-y should
+# be used with care.
+header-test-y += $(filter-out $(header-test-), \
+ $(patsubst $(srctree)/$(src)/%, %, \
+ $(wildcard $(addprefix $(srctree)/$(src)/, \
+ $(header-test-pattern-y)))))
+
+extra-$(CONFIG_HEADER_TEST) += $(addsuffix .s, $(header-test-y))
+
# Add subdir path
extra-y := $(addprefix $(obj)/,$(extra-y))
@@ -140,7 +154,7 @@ endif
# $(srctree)/$(src) for including checkin headers from generated source files
# $(objtree)/$(obj) for including generated headers from checkin source files
ifeq ($(KBUILD_EXTMOD),)
-ifneq ($(srctree),.)
+ifdef building_out_of_srctree
_c_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj)
_a_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj)
_cpp_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj)
@@ -331,19 +345,19 @@ printf "%08x\n" $$dec_size | \
)
quiet_cmd_bzip2 = BZIP2 $@
- cmd_bzip2 = { cat $(real-prereqs) | bzip2 -9 && $(size_append); } > $@
+ cmd_bzip2 = { cat $(real-prereqs) | bzip2 -9; $(size_append); } > $@
# Lzma
# ---------------------------------------------------------------------------
quiet_cmd_lzma = LZMA $@
- cmd_lzma = { cat $(real-prereqs) | lzma -9 && $(size_append); } > $@
+ cmd_lzma = { cat $(real-prereqs) | lzma -9; $(size_append); } > $@
quiet_cmd_lzo = LZO $@
- cmd_lzo = { cat $(real-prereqs) | lzop -9 && $(size_append); } > $@
+ cmd_lzo = { cat $(real-prereqs) | lzop -9; $(size_append); } > $@
quiet_cmd_lz4 = LZ4 $@
- cmd_lz4 = { cat $(real-prereqs) | lz4c -l -c1 stdin stdout && \
+ cmd_lz4 = { cat $(real-prereqs) | lz4c -l -c1 stdin stdout; \
$(size_append); } > $@
# U-Boot mkimage
@@ -386,7 +400,7 @@ quiet_cmd_uimage = UIMAGE $@
# big dictionary would increase the memory usage too much in the multi-call
# decompression mode. A BCJ filter isn't used either.
quiet_cmd_xzkern = XZKERN $@
- cmd_xzkern = { cat $(real-prereqs) | sh $(srctree)/scripts/xz_wrap.sh && \
+ cmd_xzkern = { cat $(real-prereqs) | sh $(srctree)/scripts/xz_wrap.sh; \
$(size_append); } > $@
quiet_cmd_xzmisc = XZMISC $@
diff --git a/scripts/Makefile.modbuiltin b/scripts/Makefile.modbuiltin
index ea90a90b41a0..50a9990760f3 100644
--- a/scripts/Makefile.modbuiltin
+++ b/scripts/Makefile.modbuiltin
@@ -15,7 +15,7 @@ include include/config/tristate.conf
include scripts/Kbuild.include
-ifneq ($(srctree),.)
+ifdef building_out_of_srctree
# Create output directory if not already present
_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
endif
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index facbd603adf6..9ba47b0a47b9 100644
--- a/scripts/basic/fixdep.c
+++ b/scripts/basic/fixdep.c
@@ -99,6 +99,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
+#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
@@ -110,13 +111,43 @@ static void usage(void)
}
/*
+ * In the intended usage of this program, the stdout is redirected to .*.cmd
+ * files. The return value of printf() and putchar() must be checked to catch
+ * any error, e.g. "No space left on device".
+ */
+static void xprintf(const char *format, ...)
+{
+ va_list ap;
+ int ret;
+
+ va_start(ap, format);
+ ret = vprintf(format, ap);
+ if (ret < 0) {
+ perror("fixdep");
+ exit(1);
+ }
+ va_end(ap);
+}
+
+static void xputchar(int c)
+{
+ int ret;
+
+ ret = putchar(c);
+ if (ret == EOF) {
+ perror("fixdep");
+ exit(1);
+ }
+}
+
+/*
* Print out a dependency path from a symbol name
*/
static void print_dep(const char *m, int slen, const char *dir)
{
int c, prev_c = '/', i;
- printf(" $(wildcard %s/", dir);
+ xprintf(" $(wildcard %s/", dir);
for (i = 0; i < slen; i++) {
c = m[i];
if (c == '_')
@@ -124,10 +155,10 @@ static void print_dep(const char *m, int slen, const char *dir)
else
c = tolower(c);
if (c != '/' || prev_c != '/')
- putchar(c);
+ xputchar(c);
prev_c = c;
}
- printf(".h) \\\n");
+ xprintf(".h) \\\n");
}
struct item {
@@ -324,13 +355,13 @@ static void parse_dep_file(char *m, const char *target)
*/
if (!saw_any_target) {
saw_any_target = 1;
- printf("source_%s := %s\n\n",
- target, m);
- printf("deps_%s := \\\n", target);
+ xprintf("source_%s := %s\n\n",
+ target, m);
+ xprintf("deps_%s := \\\n", target);
}
is_first_dep = 0;
} else {
- printf(" %s \\\n", m);
+ xprintf(" %s \\\n", m);
}
buf = read_file(m);
@@ -353,8 +384,8 @@ static void parse_dep_file(char *m, const char *target)
exit(1);
}
- printf("\n%s: $(deps_%s)\n\n", target, target);
- printf("$(deps_%s):\n", target);
+ xprintf("\n%s: $(deps_%s)\n\n", target, target);
+ xprintf("$(deps_%s):\n", target);
}
int main(int argc, char *argv[])
@@ -369,7 +400,7 @@ int main(int argc, char *argv[])
target = argv[2];
cmdline = argv[3];
- printf("cmd_%s := %s\n\n", target, cmdline);
+ xprintf("cmd_%s := %s\n\n", target, cmdline);
buf = read_file(depfile);
parse_dep_file(buf, target);
diff --git a/scripts/coccinelle/api/kstrdup.cocci b/scripts/coccinelle/api/kstrdup.cocci
index 888bf43df07e..19f2645e6076 100644
--- a/scripts/coccinelle/api/kstrdup.cocci
+++ b/scripts/coccinelle/api/kstrdup.cocci
@@ -77,7 +77,7 @@ p1 << r1.p1;
p2 << r1.p2;
@@
-cocci.print_main("WARNING opportunity for kstrdep",p1)
+cocci.print_main("WARNING opportunity for kstrdup",p1)
cocci.print_secs("strcpy",p2)
@script:python depends on org@
@@ -85,7 +85,7 @@ p1 << r2.p1;
p2 << r2.p2;
@@
-cocci.print_main("WARNING opportunity for kstrdep",p1)
+cocci.print_main("WARNING opportunity for kstrdup",p1)
cocci.print_secs("memcpy",p2)
@script:python depends on report@
@@ -93,7 +93,7 @@ p1 << r1.p1;
p2 << r1.p2;
@@
-msg = "WARNING opportunity for kstrdep (strcpy on line %s)" % (p2[0].line)
+msg = "WARNING opportunity for kstrdup (strcpy on line %s)" % (p2[0].line)
coccilib.report.print_report(p1[0], msg)
@script:python depends on report@
@@ -101,5 +101,5 @@ p1 << r2.p1;
p2 << r2.p2;
@@
-msg = "WARNING opportunity for kstrdep (memcpy on line %s)" % (p2[0].line)
+msg = "WARNING opportunity for kstrdup (memcpy on line %s)" % (p2[0].line)
coccilib.report.print_report(p1[0], msg)
diff --git a/scripts/coccinelle/api/stream_open.cocci b/scripts/coccinelle/api/stream_open.cocci
index 350145da7669..12ce18fa6b74 100644
--- a/scripts/coccinelle/api/stream_open.cocci
+++ b/scripts/coccinelle/api/stream_open.cocci
@@ -35,11 +35,11 @@ type loff_t;
// a function that blocks
@ blocks @
identifier block_f;
-identifier wait_event =~ "^wait_event_.*";
+identifier wait =~ "^wait_.*";
@@
block_f(...) {
... when exists
- wait_event(...)
+ wait(...)
... when exists
}
@@ -49,12 +49,12 @@ identifier wait_event =~ "^wait_event_.*";
// XXX currently reader_blocks supports only direct and 1-level indirect cases.
@ reader_blocks_direct @
identifier stream_reader.readstream;
-identifier wait_event =~ "^wait_event_.*";
+identifier wait =~ "^wait_.*";
@@
readstream(...)
{
... when exists
- wait_event(...)
+ wait(...)
... when exists
}
diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
index c9f071b0a0ab..120921366e84 100644
--- a/scripts/coccinelle/free/put_device.cocci
+++ b/scripts/coccinelle/free/put_device.cocci
@@ -24,7 +24,7 @@ if (id == NULL || ...) { ... return ...; }
when != of_dev_put(id)
when != if (id) { ... put_device(&id->dev) ... }
when != e1 = (T)id
- when != e1 = &id->dev
+ when != e1 = (T)(&id->dev)
when != e1 = get_device(&id->dev)
when != e1 = (T1)platform_get_drvdata(id)
(
@@ -42,11 +42,10 @@ p1 << search.p1;
p2 << search.p2;
@@
-coccilib.report.print_report(p2[0], "ERROR: missing put_device; "
- + "call of_find_device_by_node on line "
- + p1[0].line
- + ", but without a corresponding object release "
- + "within this function.")
+coccilib.report.print_report(p2[0],
+ "ERROR: missing put_device; call of_find_device_by_node on line "
+ + p1[0].line
+ + ", but without a corresponding object release within this function.")
@script:python depends on org@
p1 << search.p1;
diff --git a/scripts/gdb/linux/Makefile b/scripts/gdb/linux/Makefile
index 9fd3d8ed731a..124755087510 100644
--- a/scripts/gdb/linux/Makefile
+++ b/scripts/gdb/linux/Makefile
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
-ifneq ($(srctree),.)
+ifdef building_out_of_srctree
symlinks := $(patsubst $(srctree)/$(src)/%,%,$(wildcard $(srctree)/$(src)/*.py))
diff --git a/scripts/genksyms/keywords.c b/scripts/genksyms/keywords.c
index e93336baaaed..c586d32dd2c3 100644
--- a/scripts/genksyms/keywords.c
+++ b/scripts/genksyms/keywords.c
@@ -25,6 +25,10 @@ static struct resword {
{ "__volatile__", VOLATILE_KEYW },
{ "__builtin_va_list", VA_LIST_KEYW },
+ { "__int128", BUILTIN_INT_KEYW },
+ { "__int128_t", BUILTIN_INT_KEYW },
+ { "__uint128_t", BUILTIN_INT_KEYW },
+
// According to rth, c99 defines "_Bool", __restrict", __restrict__", "restrict". KAO
{ "_Bool", BOOL_KEYW },
{ "_restrict", RESTRICT_KEYW },
diff --git a/scripts/genksyms/parse.y b/scripts/genksyms/parse.y
index 00a6d7e54971..1ebcf52cd0f9 100644
--- a/scripts/genksyms/parse.y
+++ b/scripts/genksyms/parse.y
@@ -76,6 +76,7 @@ static void record_compound(struct string_list **keyw,
%token ATTRIBUTE_KEYW
%token AUTO_KEYW
%token BOOL_KEYW
+%token BUILTIN_INT_KEYW
%token CHAR_KEYW
%token CONST_KEYW
%token DOUBLE_KEYW
@@ -263,6 +264,7 @@ simple_type_specifier:
| VOID_KEYW
| BOOL_KEYW
| VA_LIST_KEYW
+ | BUILTIN_INT_KEYW
| TYPE { (*$1)->tag = SYM_TYPEDEF; $$ = $1; }
;
diff --git a/scripts/headers.sh b/scripts/headers.sh
deleted file mode 100755
index e0f883eb39a2..000000000000
--- a/scripts/headers.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0
-# Run headers_$1 command for all suitable architectures
-
-# Stop on error
-set -e
-
-do_command()
-{
- if [ -f ${srctree}/arch/$2/include/asm/Kbuild ]; then
- make ARCH=$2 KBUILD_HEADERS=$1 headers_$1
- else
- printf "Ignoring arch: %s\n" ${arch}
- fi
-}
-
-archs=${HDR_ARCH_LIST:-$(ls ${srctree}/arch)}
-
-for arch in ${archs}; do
- case ${arch} in
- um) # no userspace export
- ;;
- *)
- if [ -d ${srctree}/arch/${arch} ]; then
- do_command $1 ${arch}
- fi
- ;;
- esac
-done
diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh
index 593f8879c641..47f6f3ea0771 100755
--- a/scripts/headers_install.sh
+++ b/scripts/headers_install.sh
@@ -1,47 +1,39 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
-if [ $# -lt 2 ]
+if [ $# -ne 2 ]
then
- echo "Usage: headers_install.sh OUTDIR SRCDIR [FILES...]"
+ echo "Usage: headers_install.sh INFILE OUTFILE"
echo
echo "Prepares kernel header files for use by user space, by removing"
echo "all compiler.h definitions and #includes, removing any"
echo "#ifdef __KERNEL__ sections, and putting __underscores__ around"
echo "asm/inline/volatile keywords."
echo
- echo "OUTDIR: directory to write each userspace header FILE to."
- echo "SRCDIR: source directory where files are picked."
- echo "FILES: list of header files to operate on."
+ echo "INFILE: header file to operate on"
+ echo "OUTFILE: output file which the processed header is writen to"
exit 1
fi
# Grab arguments
+INFILE=$1
+OUTFILE=$2
+TMPFILE=$OUTFILE.tmp
-OUTDIR="$1"
-shift
-SRCDIR="$1"
-shift
+trap 'rm -f $OUTFILE $TMPFILE' EXIT
-# Iterate through files listed on command line
+sed -E -e '
+ s/([[:space:](])(__user|__force|__iomem)[[:space:]]/\1/g
+ s/__attribute_const__([[:space:]]|$)/\1/g
+ s@^#include <linux/compiler(|_types).h>@@
+ s/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g
+ s/(^|[[:space:](])(inline|asm|volatile)([[:space:](]|$)/\1__\2__\3/g
+ s@#(ifndef|define|endif[[:space:]]*/[*])[[:space:]]*_UAPI@#\1 @
+' $INFILE > $TMPFILE || exit 1
-FILE=
-trap 'rm -f "$OUTDIR/$FILE" "$OUTDIR/$FILE.sed"' EXIT
-for i in "$@"
-do
- FILE="$(basename "$i")"
- sed -E \
- -e 's/([[:space:](])(__user|__force|__iomem)[[:space:]]/\1/g' \
- -e 's/__attribute_const__([[:space:]]|$)/\1/g' \
- -e 's@^#include <linux/compiler(|_types).h>@@' \
- -e 's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g' \
- -e 's/(^|[[:space:](])(inline|asm|volatile)([[:space:](]|$)/\1__\2__\3/g' \
- -e 's@#(ifndef|define|endif[[:space:]]*/[*])[[:space:]]*_UAPI@#\1 @' \
- "$SRCDIR/$i" > "$OUTDIR/$FILE.sed" || exit 1
- scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ "$OUTDIR/$FILE.sed" \
- > "$OUTDIR/$FILE"
- [ $? -gt 1 ] && exit 1
- rm -f "$OUTDIR/$FILE.sed"
-done
+scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ $TMPFILE > $OUTFILE
+[ $? -gt 1 ] && exit 1
+
+rm -f $TMPFILE
trap - EXIT
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index e17837f1d3f2..ae6504d07fd6 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -150,6 +150,9 @@ static int read_symbol(FILE *in, struct sym_entry *s)
/* exclude debugging symbols */
else if (stype == 'N' || stype == 'n')
return -1;
+ /* exclude s390 kasan local symbols */
+ else if (!strncmp(sym, ".LASANPC", 8))
+ return -1;
/* include the type field in the symbol name, so that it gets
* compressed together */
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index b03dd56a4782..e8ca6dc97e96 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -130,7 +130,7 @@ if is_enabled CONFIG_MODULES; then
fi
if [ "$ARCH" != "um" ]; then
- $MAKE -f $srctree/Makefile headers_check
+ $MAKE -f $srctree/Makefile headers
$MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr"
fi
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index 009147d4718e..2d29df4a0a53 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -31,7 +31,7 @@ PROVIDES="$PROVIDES kernel-$KERNELRELEASE"
__KERNELRELEASE=$(echo $KERNELRELEASE | sed -e "s/-/_/g")
EXCLUDES="$RCS_TAR_IGNORE --exclude=.tmp_versions --exclude=*vmlinux* \
--exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation \
---exclude=.config.old --exclude=.missing-syscalls.d"
+--exclude=.config.old --exclude=.missing-syscalls.d --exclude=*.s"
# We can label the here-doc lines for conditional output to the spec file
#
diff --git a/scripts/tags.sh b/scripts/tags.sh
index d46be47633af..4e18ae5282a6 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -6,7 +6,7 @@
# mode may be any of: tags, TAGS, cscope
#
# Uses the following environment variables:
-# ARCH, SUBARCH, SRCARCH, srctree, src, obj
+# SUBARCH, SRCARCH, srctree
if [ "$KBUILD_VERBOSE" = "1" ]; then
set -x
@@ -17,8 +17,7 @@ ignore="$(echo "$RCS_FIND_IGNORE" | sed 's|\\||g' )"
# tags and cscope files should also ignore MODVERSION *.mod.c files
ignore="$ignore ( -name *.mod.c ) -prune -o"
-# Do not use full path if we do not use O=.. builds
-# Use make O=. {tags|cscope}
+# Use make KBUILD_ABS_SRCTREE=1 {tags|cscope}
# to force full paths for a non-O= build
if [ "${srctree}" = "." -o -z "${srctree}" ]; then
tree=
@@ -36,21 +35,19 @@ elif [ "${ALLSOURCE_ARCHS}" = "all" ]; then
ALLSOURCE_ARCHS=$(find ${tree}arch/ -mindepth 1 -maxdepth 1 -type d -printf '%f ')
fi
-# find sources in arch/$ARCH
+# find sources in arch/$1
find_arch_sources()
{
for i in $archincludedir; do
prune="$prune -wholename $i -prune -o"
done
- find ${tree}arch/$1 $ignore $subarchprune $prune -name "$2" \
- -not -type l -print;
+ find ${tree}arch/$1 $ignore $prune -name "$2" -not -type l -print;
}
# find sources in arch/$1/include
find_arch_include_sources()
{
- include=$(find ${tree}arch/$1/ $subarchprune \
- -name include -type d -print);
+ include=$(find ${tree}arch/$1/ -name include -type d -print);
if [ -n "$include" ]; then
archincludedir="$archincludedir $include"
find $include $ignore -name "$2" -not -type l -print;
@@ -306,36 +303,6 @@ if [ "${ARCH}" = "um" ]; then
else
archinclude=${SUBARCH}
fi
-elif [ "${SRCARCH}" = "arm" -a "${SUBARCH}" != "" ]; then
- subarchdir=$(find ${tree}arch/$SRCARCH/ -name "mach-*" -type d -o \
- -name "plat-*" -type d);
- mach_suffix=$SUBARCH
- plat_suffix=$SUBARCH
-
- # Special cases when $plat_suffix != $mach_suffix
- case $mach_suffix in
- "omap1" | "omap2")
- plat_suffix="omap"
- ;;
- esac
-
- if [ ! -d ${tree}arch/$SRCARCH/mach-$mach_suffix ]; then
- echo "Warning: arch/arm/mach-$mach_suffix/ not found." >&2
- echo " Fix your \$SUBARCH appropriately" >&2
- fi
-
- for i in $subarchdir; do
- case "$i" in
- *"mach-"${mach_suffix})
- ;;
- *"plat-"${plat_suffix})
- ;;
- *)
- subarchprune="$subarchprune \
- -wholename $i -prune -o"
- ;;
- esac
- done
fi
remove_structs=
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 9781ca79794a..25b43a8c2b15 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -74,7 +74,7 @@ endif
# Append kselftest to KBUILD_OUTPUT to avoid cluttering
# KBUILD_OUTPUT with selftest objects and headers installed
# by selftests Makefile or lib.mk.
-ifneq ($(KBUILD_SRC),)
+ifdef building_out_of_srctree
override LDFLAGS =
endif
diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 077337195783..1c8a1963d03f 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -70,7 +70,7 @@ define RUN_TESTS
endef
run_tests: all
-ifneq ($(KBUILD_SRC),)
+ifdef building_out_of_srctree
@if [ "X$(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES)" != "X" ]; then
@rsync -aq $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(OUTPUT)
fi
@@ -125,7 +125,7 @@ clean:
# When make O= with kselftest target from main level
# the following aren't defined.
#
-ifneq ($(KBUILD_SRC),)
+ifdef building_out_of_srctree
LINK.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)
COMPILE.S = $(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
LINK.S = $(CC) $(ASFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)
diff --git a/usr/.gitignore b/usr/.gitignore
index 8e48117a3f3d..be5eae1df7eb 100644
--- a/usr/.gitignore
+++ b/usr/.gitignore
@@ -7,4 +7,3 @@ initramfs_data.cpio.gz
initramfs_data.cpio.bz2
initramfs_data.cpio.lzma
initramfs_list
-include
diff --git a/usr/Makefile b/usr/Makefile
index 4a70ae43c9cb..6a89eb019275 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -56,3 +56,5 @@ $(deps_initramfs): klibcdirs
$(obj)/$(datafile_y): $(obj)/gen_init_cpio $(deps_initramfs) klibcdirs
$(Q)$(initramfs) -l $(ramfs-input) > $(obj)/$(datafile_d_y)
$(call if_changed,initfs)
+
+subdir-$(CONFIG_UAPI_HEADER_TEST) += include
diff --git a/usr/include/.gitignore b/usr/include/.gitignore
new file mode 100644
index 000000000000..a0991ff4402b
--- /dev/null
+++ b/usr/include/.gitignore
@@ -0,0 +1,3 @@
+*
+!.gitignore
+!Makefile
diff --git a/usr/include/Makefile b/usr/include/Makefile
new file mode 100644
index 000000000000..cd8daa20d487
--- /dev/null
+++ b/usr/include/Makefile
@@ -0,0 +1,132 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+# Unlike the kernel space, exported headers are written in standard C.
+# - Forbid C++ style comments
+# - Use '__inline__', '__asm__' instead of 'inline', 'asm'
+#
+# -std=c90 (equivalent to -ansi) catches the violation of those.
+# We cannot go as far as adding -Wpedantic since it emits too many warnings.
+UAPI_CFLAGS := -std=c90 -Wall -Werror=implicit-function-declaration
+
+override c_flags = $(UAPI_CFLAGS) -Wp,-MD,$(depfile) -I$(objtree)/usr/include
+
+# The following are excluded for now because they fail to build.
+#
+# Do not add a new header to the blacklist without legitimate reason.
+# Please consider to fix the header first.
+#
+# Sorted alphabetically.
+header-test- += asm/ipcbuf.h
+header-test- += asm/msgbuf.h
+header-test- += asm/sembuf.h
+header-test- += asm/shmbuf.h
+header-test- += asm/signal.h
+header-test- += asm/ucontext.h
+header-test- += drm/vmwgfx_drm.h
+header-test- += linux/am437x-vpfe.h
+header-test- += linux/android/binder.h
+header-test- += linux/android/binderfs.h
+header-test-$(CONFIG_CPU_BIG_ENDIAN) += linux/byteorder/big_endian.h
+header-test-$(CONFIG_CPU_LITTLE_ENDIAN) += linux/byteorder/little_endian.h
+header-test- += linux/coda.h
+header-test- += linux/coda_psdev.h
+header-test- += linux/dvb/audio.h
+header-test- += linux/dvb/osd.h
+header-test- += linux/elfcore.h
+header-test- += linux/errqueue.h
+header-test- += linux/fsmap.h
+header-test- += linux/hdlc/ioctl.h
+header-test- += linux/ivtv.h
+header-test- += linux/jffs2.h
+header-test- += linux/kexec.h
+header-test- += linux/matroxfb.h
+header-test- += linux/netfilter_bridge/ebtables.h
+header-test- += linux/netfilter_ipv4/ipt_LOG.h
+header-test- += linux/netfilter_ipv6/ip6t_LOG.h
+header-test- += linux/nfc.h
+header-test- += linux/nilfs2_ondisk.h
+header-test- += linux/omap3isp.h
+header-test- += linux/omapfb.h
+header-test- += linux/patchkey.h
+header-test- += linux/phonet.h
+header-test- += linux/reiserfs_xattr.h
+header-test- += linux/scc.h
+header-test- += linux/sctp.h
+header-test- += linux/signal.h
+header-test- += linux/sysctl.h
+header-test- += linux/usb/audio.h
+header-test- += linux/v4l2-mediabus.h
+header-test- += linux/v4l2-subdev.h
+header-test- += linux/videodev2.h
+header-test- += linux/vm_sockets.h
+header-test- += misc/ocxl.h
+header-test- += mtd/mtd-abi.h
+header-test- += mtd/mtd-user.h
+header-test- += scsi/scsi_bsg_fc.h
+header-test- += scsi/scsi_netlink.h
+header-test- += scsi/scsi_netlink_fc.h
+header-test- += sound/asequencer.h
+header-test- += sound/asoc.h
+header-test- += sound/asound.h
+header-test- += sound/compress_offload.h
+header-test- += sound/emu10k1.h
+header-test- += sound/sfnt_info.h
+header-test- += sound/sof/eq.h
+header-test- += sound/sof/fw.h
+header-test- += sound/sof/header.h
+header-test- += sound/sof/manifest.h
+header-test- += sound/sof/trace.h
+header-test- += xen/evtchn.h
+header-test- += xen/gntdev.h
+header-test- += xen/privcmd.h
+
+# More headers are broken in some architectures
+
+ifeq ($(SRCARCH),arc)
+header-test- += linux/bpf_perf_event.h
+endif
+
+ifeq ($(SRCARCH),ia64)
+header-test- += asm/setup.h
+header-test- += asm/sigcontext.h
+header-test- += asm/perfmon.h
+header-test- += asm/perfmon_default_smpl.h
+header-test- += linux/if_bonding.h
+endif
+
+ifeq ($(SRCARCH),mips)
+header-test- += asm/stat.h
+endif
+
+ifeq ($(SRCARCH),powerpc)
+header-test- += asm/stat.h
+header-test- += linux/bpf_perf_event.h
+endif
+
+ifeq ($(SRCARCH),riscv)
+header-test- += linux/bpf_perf_event.h
+endif
+
+ifeq ($(SRCARCH),s390)
+header-test- += asm/runtime_instr.h
+header-test- += asm/zcrypt.h
+endif
+
+ifeq ($(SRCARCH),sparc)
+header-test- += asm/stat.h
+header-test- += asm/uctx.h
+header-test- += asm/fbio.h
+header-test- += asm/openpromio.h
+endif
+
+# asm-generic/*.h is used by asm/*.h, and should not be included directly
+header-test- += asm-generic/%
+
+# The rest are compile-tested
+header-test-y += $(filter-out $(header-test-), \
+ $(patsubst $(obj)/%,%, $(wildcard \
+ $(addprefix $(obj)/, *.h */*.h */*/*.h */*/*/*.h))))
+
+# For GNU Make <= 4.2.1, $(wildcard $(obj)/*/) matches to not only directories
+# but also regular files. Use $(filter %/, ...) just in case.
+clean-dirs += $(patsubst $(obj)/%/,%,$(filter %/, $(wildcard $(obj)/*/)))