kbuild: remove header compile test

There are both positive and negative options about this feature.
At first, I thought it was a good idea, but actually Linus stated a
negative opinion (https://lkml.org/lkml/2019/9/29/227). I admit it
is ugly and annoying.

The baseline I'd like to keep is the compile-test of uapi headers.
(Otherwise, kernel developers have no way to ensure the correctness
of the exported headers.)

I will maintain a small build rule in usr/include/Makefile.
Remove the other header test functionality.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
This commit is contained in:
Masahiro Yamada 2019-11-07 16:14:40 +09:00
Родитель eba19032f9
Коммит fcbb8461fd
8 изменённых файлов: 9 добавлений и 1252 удалений

Просмотреть файл

@ -1115,23 +1115,6 @@ 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
---------------------------------------------

Просмотреть файл

@ -618,7 +618,6 @@ 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/

Просмотреть файл

@ -7,7 +7,6 @@ config DRM_I915_WERROR
# We use the dependency on !COMPILE_TEST to not be enabled in
# allmodconfig or allyesconfig configurations
depends on !COMPILE_TEST
select HEADER_TEST
default n
help
Add -Werror to the build flags for (and only for) i915.ko.

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -104,29 +104,9 @@ 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
depends on 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.

Просмотреть файл

@ -283,15 +283,6 @@ quiet_cmd_cc_lst_c = MKLST $@
$(obj)/%.lst: $(src)/%.c FORCE
$(call if_changed_dep,cc_lst_c)
# header test (header-test-y, header-test-m 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)
# ---------------------------------------------------------------------------

Просмотреть файл

@ -65,20 +65,6 @@ 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) $(header-test-m))
# Add subdir path
extra-y := $(addprefix $(obj)/,$(extra-y))

Просмотреть файл

@ -95,9 +95,13 @@ 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))))
extra-y := $(patsubst %.h,%.hdrtest, $(filter-out $(header-test-), \
$(patsubst $(obj)/%,%, $(shell find $(obj) -name '*.h'))))
quiet_cmd_hdrtest = HDRTEST $<
cmd_hdrtest = $(CC) $(c_flags) -S -o /dev/null -x c /dev/null -include $<; touch $@
$(obj)/%.hdrtest: $(obj)/%.h FORCE
$(call if_changed_dep,hdrtest)
clean-files += $(filter-out Makefile, $(notdir $(wildcard $(obj)/*)))