Skip to content

Commit

Permalink
Merge tag 'kbuild-v5.5' of git://git.kernel.org/pub/scm/linux/kernel/…
Browse files Browse the repository at this point in the history
…git/masahiroy/linux-kbuild

Pull Kbuild updates from Masahiro Yamada:

 - remove unneeded asm headers from hexagon, ia64

 - add 'dir-pkg' target, which works like 'tar-pkg' but skips archiving

 - add 'helpnewconfig' target, which shows help for new CONFIG options

 - support 'make nsdeps' for external modules

 - make rebuilds faster by deleting $(wildcard $^) checks

 - remove compile tests for kernel-space headers

 - refactor modpost to simplify modversion handling

 - make single target builds faster

 - optimize and clean up scripts/kallsyms.c

 - refactor various Makefiles and scripts

* tag 'kbuild-v5.5' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (59 commits)
  MAINTAINERS: update Kbuild/Kconfig maintainer's email address
  scripts/kallsyms: remove redundant initializers
  scripts/kallsyms: put check_symbol_range() calls close together
  scripts/kallsyms: make check_symbol_range() void function
  scripts/kallsyms: move ignored symbol types to is_ignored_symbol()
  scripts/kallsyms: move more patterns to the ignored_prefixes array
  scripts/kallsyms: skip ignored symbols very early
  scripts/kallsyms: add const qualifiers where possible
  scripts/kallsyms: make find_token() return (unsigned char *)
  scripts/kallsyms: replace prefix_underscores_count() with strspn()
  scripts/kallsyms: add sym_name() to mitigate cast ugliness
  scripts/kallsyms: remove unneeded length check for prefix matching
  scripts/kallsyms: remove redundant is_arm_mapping_symbol()
  scripts/kallsyms: set relative_base more effectively
  scripts/kallsyms: shrink table before sorting it
  scripts/kallsyms: fix definitely-lost memory leak
  scripts/kallsyms: remove unneeded #ifndef ARRAY_SIZE
  kbuild: make single target builds even faster
  modpost: respect the previous export when 'exported twice' is warned
  modpost: do not set ->preloaded for symbols from Module.symvers
  ...
  • Loading branch information
torvalds committed Dec 3, 2019
2 parents e30dbe5 + d21b7e6 commit 76bb8b0
Show file tree
Hide file tree
Showing 43 changed files with 452 additions and 1,742 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
*.lzo
*.mod
*.mod.c
*.ns_deps
*.o
*.o.*
*.patch
Expand Down Expand Up @@ -61,6 +60,7 @@ modules.order
/System.map
/Module.markers
/modules.builtin.modinfo
/modules.nsdeps

#
# RPM spec file (make rpm-pkg)
Expand Down
6 changes: 4 additions & 2 deletions Documentation/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,10 @@ dochelp:
@echo ' pdfdocs - PDF'
@echo ' epubdocs - EPUB'
@echo ' xmldocs - XML'
@echo ' linkcheckdocs - check for broken external links (will connect to external hosts)'
@echo ' refcheckdocs - check for references to non-existing files under Documentation'
@echo ' linkcheckdocs - check for broken external links'
@echo ' (will connect to external hosts)'
@echo ' refcheckdocs - check for references to non-existing files under'
@echo ' Documentation'
@echo ' cleandocs - clean all generated files'
@echo
@echo ' make SPHINXDIRS="s1 s2" [target] Generate only docs of folder s1, s2'
Expand Down
3 changes: 3 additions & 0 deletions Documentation/core-api/symbol-namespaces.rst
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,6 @@ in-tree modules::
- notice the warning of modpost telling about a missing import
- run `make nsdeps` to add the import to the correct code location

You can also run nsdeps for external module builds. A typical usage is::

$ make -C <path_to_kernel_src> M=$PWD nsdeps
1 change: 1 addition & 0 deletions Documentation/dontdiff
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ mkutf8data
modpost
modules.builtin
modules.builtin.modinfo
modules.nsdeps
modules.order
modversions.h*
nconf
Expand Down
17 changes: 0 additions & 17 deletions Documentation/kbuild/makefiles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
---------------------------------------------

Expand Down
13 changes: 5 additions & 8 deletions Documentation/kbuild/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -492,19 +492,16 @@ build.
to the symbols from the kernel to check if all external symbols
are defined. This is done in the MODPOST step. modpost obtains
the symbols by reading Module.symvers from the kernel source
tree. If a Module.symvers file is present in the directory
where the external module is being built, this file will be
read too. During the MODPOST step, a new Module.symvers file
will be written containing all exported symbols that were not
defined in the kernel.
tree. During the MODPOST step, a new Module.symvers file will be
written containing all exported symbols from that external module.

6.3 Symbols From Another External Module
----------------------------------------

Sometimes, an external module uses exported symbols from
another external module. Kbuild needs to have full knowledge of
all symbols to avoid spitting out warnings about undefined
symbols. Three solutions exist for this situation.
symbols. Two solutions exist for this situation.

NOTE: The method with a top-level kbuild file is recommended
but may be impractical in certain situations.
Expand Down Expand Up @@ -544,8 +541,8 @@ build.
all symbols defined and not part of the kernel.

Use "make" variable KBUILD_EXTRA_SYMBOLS
If it is impractical to copy Module.symvers from
another module, you can assign a space separated list
If it is impractical to add a top-level kbuild file,
you can assign a space separated list
of files to KBUILD_EXTRA_SYMBOLS in your build file.
These files will be loaded by modpost during the
initialization of its symbol tables.
Expand Down
4 changes: 2 additions & 2 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -8934,7 +8934,7 @@ F: mm/kasan/
F: scripts/Makefile.kasan

KCONFIG
M: Masahiro Yamada <[email protected]>
M: Masahiro Yamada <[email protected]>
T: git git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git kconfig
L: [email protected]
S: Maintained
Expand Down Expand Up @@ -8966,7 +8966,7 @@ S: Maintained
F: fs/autofs/

KERNEL BUILD + files below scripts/ (unless maintained elsewhere)
M: Masahiro Yamada <[email protected]>
M: Masahiro Yamada <[email protected]>
M: Michal Marek <[email protected]>
T: git git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git
L: [email protected]
Expand Down
121 changes: 59 additions & 62 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down Expand Up @@ -1011,6 +1010,7 @@ endif
PHONY += prepare0

export MODORDER := $(extmod-prefix)modules.order
export MODULES_NSDEPS := $(extmod-prefix)modules.nsdeps

ifeq ($(KBUILD_EXTMOD),)
core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/
Expand Down Expand Up @@ -1196,19 +1196,15 @@ headers: $(version_h) scripts_unifdef uapi-asm-generic archheaders archscripts
$(Q)$(MAKE) $(hdr-inst)=include/uapi
$(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi

# Deprecated. It is no-op now.
PHONY += headers_check
headers_check: headers
$(Q)$(MAKE) $(hdr-inst)=include/uapi HDRCHECK=1
$(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi HDRCHECK=1
headers_check:
@:

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
Expand Down Expand Up @@ -1360,7 +1356,7 @@ endif # CONFIG_MODULES

# Directories & files removed with 'make clean'
CLEAN_DIRS += include/ksym
CLEAN_FILES += modules.builtin.modinfo
CLEAN_FILES += modules.builtin.modinfo modules.nsdeps

# Directories & files removed with 'make mrproper'
MRPROPER_DIRS += include/config include/generated \
Expand Down Expand Up @@ -1476,7 +1472,6 @@ help:
@echo ' versioncheck - Sanity check on version.h usage'
@echo ' includecheck - Check for duplicate included header files'
@echo ' export_report - List the usages of all exported symbols'
@echo ' headers_check - Sanity check on exported headers'
@echo ' headerdep - Detect inclusion cycles in headers'
@echo ' coccicheck - Check with Coccinelle'
@echo ''
Expand Down Expand Up @@ -1515,7 +1510,7 @@ help:
@echo ''
@$(if $(boards), \
$(foreach b, $(boards), \
printf " %-24s - Build for %s\\n" $(b) $(subst _defconfig,,$(b));) \
printf " %-27s - Build for %s\\n" $(b) $(subst _defconfig,,$(b));) \
echo '')
@$(if $(board-dirs), \
$(foreach b, $(board-dirs), \
Expand All @@ -1526,7 +1521,8 @@ help:
@echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
@echo ' make V=2 [targets] 2 => give reason for rebuild of target'
@echo ' make O=dir [targets] Locate all output files in "dir", including .config'
@echo ' make C=1 [targets] Check re-compiled c source with $$CHECK (sparse by default)'
@echo ' make C=1 [targets] Check re-compiled c source with $$CHECK'
@echo ' (sparse by default)'
@echo ' make C=2 [targets] Force check of all c source with $$CHECK'
@echo ' make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections'
@echo ' make W=n [targets] Enable extra build checks, n=1,2,3 where'
Expand Down Expand Up @@ -1622,7 +1618,7 @@ _emodinst_post: _emodinst_
$(call cmd,depmod)

clean-dirs := $(KBUILD_EXTMOD)
clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers
clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers $(KBUILD_EXTMOD)/modules.nsdeps

PHONY += /
/:
Expand All @@ -1641,6 +1637,50 @@ help:
PHONY += prepare
endif # KBUILD_EXTMOD

# Single targets
# ---------------------------------------------------------------------------
# To build individual files in subdirectories, you can do like this:
#
# make foo/bar/baz.s
#
# The supported suffixes for single-target are listed in 'single-targets'
#
# To build only under specific subdirectories, you can do like this:
#
# make foo/bar/baz/

ifdef single-build

# .ko is special because modpost is needed
single-ko := $(sort $(filter %.ko, $(MAKECMDGOALS)))
single-no-ko := $(sort $(patsubst %.ko,%.mod, $(MAKECMDGOALS)))

$(single-ko): single_modpost
@:
$(single-no-ko): descend
@:

ifeq ($(KBUILD_EXTMOD),)
# For the single build of in-tree modules, use a temporary file to avoid
# the situation of modules_install installing an invalid modules.order.
MODORDER := .modules.tmp
endif

PHONY += single_modpost
single_modpost: $(single-no-ko)
$(Q){ $(foreach m, $(single-ko), echo $(extmod-prefix)$m;) } > $(MODORDER)
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost

KBUILD_MODULES := 1

export KBUILD_SINGLE_TARGETS := $(addprefix $(extmod-prefix), $(single-no-ko))

# trim unrelated directories
build-dirs := $(foreach d, $(build-dirs), \
$(if $(filter $(d)/%, $(KBUILD_SINGLE_TARGETS)), $(d)))

endif

# Handle descending into subdirectories listed in $(build-dirs)
# Preset locale variables to speed up the build process. Limit locale
# tweaks to this spot to avoid wrong language settings when running
Expand All @@ -1649,7 +1689,9 @@ endif # KBUILD_EXTMOD
PHONY += descend $(build-dirs)
descend: $(build-dirs)
$(build-dirs): prepare
$(Q)$(MAKE) $(build)=$@ single-build=$(single-build) need-builtin=1 need-modorder=1
$(Q)$(MAKE) $(build)=$@ \
single-build=$(if $(filter-out $@/, $(single-no-ko)),1) \
need-builtin=1 need-modorder=1

clean-dirs := $(addprefix _clean_, $(clean-dirs))
PHONY += $(clean-dirs) clean
Expand All @@ -1664,7 +1706,7 @@ clean: $(clean-dirs)
-o -name '*.ko.*' \
-o -name '*.dtb' -o -name '*.dtb.S' -o -name '*.dt.yaml' \
-o -name '*.dwo' -o -name '*.lst' \
-o -name '*.su' -o -name '*.mod' -o -name '*.ns_deps' \
-o -name '*.su' -o -name '*.mod' \
-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
-o -name '*.lex.c' -o -name '*.tab.[ch]' \
-o -name '*.asn1.[ch]' \
Expand All @@ -1686,10 +1728,9 @@ tags TAGS cscope gtags: FORCE
# ---------------------------------------------------------------------------

PHONY += nsdeps

nsdeps: export KBUILD_NSDEPS=1
nsdeps: modules
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost nsdeps
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/$@
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/nsdeps

# Scripts to check various things for consistency
# ---------------------------------------------------------------------------
Expand Down Expand Up @@ -1753,50 +1794,6 @@ tools/%: FORCE
$(Q)mkdir -p $(objtree)/tools
$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/ $*

# Single targets
# ---------------------------------------------------------------------------
# To build individual files in subdirectories, you can do like this:
#
# make foo/bar/baz.s
#
# The supported suffixes for single-target are listed in 'single-targets'
#
# To build only under specific subdirectories, you can do like this:
#
# make foo/bar/baz/

ifdef single-build

single-all := $(filter $(single-targets), $(MAKECMDGOALS))

# .ko is special because modpost is needed
single-ko := $(sort $(filter %.ko, $(single-all)))
single-no-ko := $(sort $(patsubst %.ko,%.mod, $(single-all)))

$(single-ko): single_modpost
@:
$(single-no-ko): descend
@:

ifeq ($(KBUILD_EXTMOD),)
# For the single build of in-tree modules, use a temporary file to avoid
# the situation of modules_install installing an invalid modules.order.
MODORDER := .modules.tmp
endif

PHONY += single_modpost
single_modpost: $(single-no-ko)
$(Q){ $(foreach m, $(single-ko), echo $(extmod-prefix)$m;) } > $(MODORDER)
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost

KBUILD_MODULES := 1

export KBUILD_SINGLE_TARGETS := $(addprefix $(extmod-prefix), $(single-no-ko))

single-build = $(if $(filter-out $@/, $(single-no-ko)),1)

endif

# FIXME Should go into a make.lib or something
# ===========================================================================

Expand Down
27 changes: 0 additions & 27 deletions arch/hexagon/include/uapi/asm/bitsperlong.h

This file was deleted.

2 changes: 0 additions & 2 deletions arch/ia64/include/uapi/asm/errno.h

This file was deleted.

2 changes: 0 additions & 2 deletions arch/ia64/include/uapi/asm/ioctl.h

This file was deleted.

7 changes: 0 additions & 7 deletions arch/ia64/include/uapi/asm/ioctls.h

This file was deleted.

1 change: 0 additions & 1 deletion drivers/gpu/drm/i915/Kconfig.debug
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions drivers/video/logo/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
*_vga16.c
*_clut224.c
*_gray256.c
pnmtologo
Loading

0 comments on commit 76bb8b0

Please sign in to comment.