Skip to content

Commit 76bb8b0

Browse files
committed
Merge tag 'kbuild-v5.5' of git://git.kernel.org/pub/scm/linux/kernel/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 ...
2 parents e30dbe5 + d21b7e6 commit 76bb8b0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+452
-1742
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
*.lzo
3333
*.mod
3434
*.mod.c
35-
*.ns_deps
3635
*.o
3736
*.o.*
3837
*.patch
@@ -61,6 +60,7 @@ modules.order
6160
/System.map
6261
/Module.markers
6362
/modules.builtin.modinfo
63+
/modules.nsdeps
6464

6565
#
6666
# RPM spec file (make rpm-pkg)

Documentation/Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,10 @@ dochelp:
128128
@echo ' pdfdocs - PDF'
129129
@echo ' epubdocs - EPUB'
130130
@echo ' xmldocs - XML'
131-
@echo ' linkcheckdocs - check for broken external links (will connect to external hosts)'
132-
@echo ' refcheckdocs - check for references to non-existing files under Documentation'
131+
@echo ' linkcheckdocs - check for broken external links'
132+
@echo ' (will connect to external hosts)'
133+
@echo ' refcheckdocs - check for references to non-existing files under'
134+
@echo ' Documentation'
133135
@echo ' cleandocs - clean all generated files'
134136
@echo
135137
@echo ' make SPHINXDIRS="s1 s2" [target] Generate only docs of folder s1, s2'

Documentation/core-api/symbol-namespaces.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,6 @@ in-tree modules::
152152
- notice the warning of modpost telling about a missing import
153153
- run `make nsdeps` to add the import to the correct code location
154154

155+
You can also run nsdeps for external module builds. A typical usage is::
156+
157+
$ make -C <path_to_kernel_src> M=$PWD nsdeps

Documentation/dontdiff

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ mkutf8data
179179
modpost
180180
modules.builtin
181181
modules.builtin.modinfo
182+
modules.nsdeps
182183
modules.order
183184
modversions.h*
184185
nconf

Documentation/kbuild/makefiles.rst

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,23 +1115,6 @@ When kbuild executes, the following steps are followed (roughly):
11151115
In this example, extra-y is used to list object files that
11161116
shall be built, but shall not be linked as part of built-in.a.
11171117

1118-
header-test-y
1119-
1120-
header-test-y specifies headers (`*.h`) in the current directory that
1121-
should be compile tested to ensure they are self-contained,
1122-
i.e. compilable as standalone units. If CONFIG_HEADER_TEST is enabled,
1123-
this builds them as part of extra-y.
1124-
1125-
header-test-pattern-y
1126-
1127-
This works as a weaker version of header-test-y, and accepts wildcard
1128-
patterns. The typical usage is::
1129-
1130-
header-test-pattern-y += *.h
1131-
1132-
This specifies all the files that matches to `*.h` in the current
1133-
directory, but the files in 'header-test-' are excluded.
1134-
11351118
6.7 Commands useful for building a boot image
11361119
---------------------------------------------
11371120

Documentation/kbuild/modules.rst

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -492,19 +492,16 @@ build.
492492
to the symbols from the kernel to check if all external symbols
493493
are defined. This is done in the MODPOST step. modpost obtains
494494
the symbols by reading Module.symvers from the kernel source
495-
tree. If a Module.symvers file is present in the directory
496-
where the external module is being built, this file will be
497-
read too. During the MODPOST step, a new Module.symvers file
498-
will be written containing all exported symbols that were not
499-
defined in the kernel.
495+
tree. During the MODPOST step, a new Module.symvers file will be
496+
written containing all exported symbols from that external module.
500497

501498
6.3 Symbols From Another External Module
502499
----------------------------------------
503500

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

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

546543
Use "make" variable KBUILD_EXTRA_SYMBOLS
547-
If it is impractical to copy Module.symvers from
548-
another module, you can assign a space separated list
544+
If it is impractical to add a top-level kbuild file,
545+
you can assign a space separated list
549546
of files to KBUILD_EXTRA_SYMBOLS in your build file.
550547
These files will be loaded by modpost during the
551548
initialization of its symbol tables.

MAINTAINERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8934,7 +8934,7 @@ F: mm/kasan/
89348934
F: scripts/Makefile.kasan
89358935

89368936
KCONFIG
8937-
M: Masahiro Yamada <[email protected]>
8937+
M: Masahiro Yamada <[email protected]>
89388938
T: git git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git kconfig
89398939
89408940
S: Maintained
@@ -8966,7 +8966,7 @@ S: Maintained
89668966
F: fs/autofs/
89678967

89688968
KERNEL BUILD + files below scripts/ (unless maintained elsewhere)
8969-
M: Masahiro Yamada <[email protected]>
8969+
M: Masahiro Yamada <[email protected]>
89708970
M: Michal Marek <[email protected]>
89718971
T: git git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git
89728972

Makefile

Lines changed: 59 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,6 @@ ifeq ($(KBUILD_EXTMOD),)
618618
init-y := init/
619619
drivers-y := drivers/ sound/
620620
drivers-$(CONFIG_SAMPLES) += samples/
621-
drivers-$(CONFIG_KERNEL_HEADER_TEST) += include/
622621
net-y := net/
623622
libs-y := lib/
624623
core-y := usr/
@@ -1011,6 +1010,7 @@ endif
10111010
PHONY += prepare0
10121011

10131012
export MODORDER := $(extmod-prefix)modules.order
1013+
export MODULES_NSDEPS := $(extmod-prefix)modules.nsdeps
10141014

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

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

12041204
ifdef CONFIG_HEADERS_INSTALL
12051205
prepare: headers
12061206
endif
12071207

1208-
ifdef CONFIG_HEADERS_CHECK
1209-
all: headers_check
1210-
endif
1211-
12121208
PHONY += scripts_unifdef
12131209
scripts_unifdef: scripts_basic
12141210
$(Q)$(MAKE) $(build)=scripts scripts/unifdef
@@ -1360,7 +1356,7 @@ endif # CONFIG_MODULES
13601356

13611357
# Directories & files removed with 'make clean'
13621358
CLEAN_DIRS += include/ksym
1363-
CLEAN_FILES += modules.builtin.modinfo
1359+
CLEAN_FILES += modules.builtin.modinfo modules.nsdeps
13641360

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

16241620
clean-dirs := $(KBUILD_EXTMOD)
1625-
clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers
1621+
clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers $(KBUILD_EXTMOD)/modules.nsdeps
16261622

16271623
PHONY += /
16281624
/:
@@ -1641,6 +1637,50 @@ help:
16411637
PHONY += prepare
16421638
endif # KBUILD_EXTMOD
16431639

1640+
# Single targets
1641+
# ---------------------------------------------------------------------------
1642+
# To build individual files in subdirectories, you can do like this:
1643+
#
1644+
# make foo/bar/baz.s
1645+
#
1646+
# The supported suffixes for single-target are listed in 'single-targets'
1647+
#
1648+
# To build only under specific subdirectories, you can do like this:
1649+
#
1650+
# make foo/bar/baz/
1651+
1652+
ifdef single-build
1653+
1654+
# .ko is special because modpost is needed
1655+
single-ko := $(sort $(filter %.ko, $(MAKECMDGOALS)))
1656+
single-no-ko := $(sort $(patsubst %.ko,%.mod, $(MAKECMDGOALS)))
1657+
1658+
$(single-ko): single_modpost
1659+
@:
1660+
$(single-no-ko): descend
1661+
@:
1662+
1663+
ifeq ($(KBUILD_EXTMOD),)
1664+
# For the single build of in-tree modules, use a temporary file to avoid
1665+
# the situation of modules_install installing an invalid modules.order.
1666+
MODORDER := .modules.tmp
1667+
endif
1668+
1669+
PHONY += single_modpost
1670+
single_modpost: $(single-no-ko)
1671+
$(Q){ $(foreach m, $(single-ko), echo $(extmod-prefix)$m;) } > $(MODORDER)
1672+
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1673+
1674+
KBUILD_MODULES := 1
1675+
1676+
export KBUILD_SINGLE_TARGETS := $(addprefix $(extmod-prefix), $(single-no-ko))
1677+
1678+
# trim unrelated directories
1679+
build-dirs := $(foreach d, $(build-dirs), \
1680+
$(if $(filter $(d)/%, $(KBUILD_SINGLE_TARGETS)), $(d)))
1681+
1682+
endif
1683+
16441684
# Handle descending into subdirectories listed in $(build-dirs)
16451685
# Preset locale variables to speed up the build process. Limit locale
16461686
# tweaks to this spot to avoid wrong language settings when running
@@ -1649,7 +1689,9 @@ endif # KBUILD_EXTMOD
16491689
PHONY += descend $(build-dirs)
16501690
descend: $(build-dirs)
16511691
$(build-dirs): prepare
1652-
$(Q)$(MAKE) $(build)=$@ single-build=$(single-build) need-builtin=1 need-modorder=1
1692+
$(Q)$(MAKE) $(build)=$@ \
1693+
single-build=$(if $(filter-out $@/, $(single-no-ko)),1) \
1694+
need-builtin=1 need-modorder=1
16531695

16541696
clean-dirs := $(addprefix _clean_, $(clean-dirs))
16551697
PHONY += $(clean-dirs) clean
@@ -1664,7 +1706,7 @@ clean: $(clean-dirs)
16641706
-o -name '*.ko.*' \
16651707
-o -name '*.dtb' -o -name '*.dtb.S' -o -name '*.dt.yaml' \
16661708
-o -name '*.dwo' -o -name '*.lst' \
1667-
-o -name '*.su' -o -name '*.mod' -o -name '*.ns_deps' \
1709+
-o -name '*.su' -o -name '*.mod' \
16681710
-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
16691711
-o -name '*.lex.c' -o -name '*.tab.[ch]' \
16701712
-o -name '*.asn1.[ch]' \
@@ -1686,10 +1728,9 @@ tags TAGS cscope gtags: FORCE
16861728
# ---------------------------------------------------------------------------
16871729

16881730
PHONY += nsdeps
1689-
1731+
nsdeps: export KBUILD_NSDEPS=1
16901732
nsdeps: modules
1691-
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost nsdeps
1692-
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/$@
1733+
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/nsdeps
16931734

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

1756-
# Single targets
1757-
# ---------------------------------------------------------------------------
1758-
# To build individual files in subdirectories, you can do like this:
1759-
#
1760-
# make foo/bar/baz.s
1761-
#
1762-
# The supported suffixes for single-target are listed in 'single-targets'
1763-
#
1764-
# To build only under specific subdirectories, you can do like this:
1765-
#
1766-
# make foo/bar/baz/
1767-
1768-
ifdef single-build
1769-
1770-
single-all := $(filter $(single-targets), $(MAKECMDGOALS))
1771-
1772-
# .ko is special because modpost is needed
1773-
single-ko := $(sort $(filter %.ko, $(single-all)))
1774-
single-no-ko := $(sort $(patsubst %.ko,%.mod, $(single-all)))
1775-
1776-
$(single-ko): single_modpost
1777-
@:
1778-
$(single-no-ko): descend
1779-
@:
1780-
1781-
ifeq ($(KBUILD_EXTMOD),)
1782-
# For the single build of in-tree modules, use a temporary file to avoid
1783-
# the situation of modules_install installing an invalid modules.order.
1784-
MODORDER := .modules.tmp
1785-
endif
1786-
1787-
PHONY += single_modpost
1788-
single_modpost: $(single-no-ko)
1789-
$(Q){ $(foreach m, $(single-ko), echo $(extmod-prefix)$m;) } > $(MODORDER)
1790-
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1791-
1792-
KBUILD_MODULES := 1
1793-
1794-
export KBUILD_SINGLE_TARGETS := $(addprefix $(extmod-prefix), $(single-no-ko))
1795-
1796-
single-build = $(if $(filter-out $@/, $(single-no-ko)),1)
1797-
1798-
endif
1799-
18001797
# FIXME Should go into a make.lib or something
18011798
# ===========================================================================
18021799

arch/hexagon/include/uapi/asm/bitsperlong.h

Lines changed: 0 additions & 27 deletions
This file was deleted.

arch/ia64/include/uapi/asm/errno.h

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)