Skip to content

Commit d7b0827

Browse files
committed
Merge tag 'kbuild-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild updates from Masahiro Yamada: - add modpost warn exported symbols marked as 'static' because 'static' and EXPORT_SYMBOL is an odd combination - break the build early if gold linker is used - optimize the Bison rule to produce .c and .h files by a single pattern rule - handle PREEMPT_RT in the module vermagic and UTS_VERSION - warn CONFIG options leaked to the user-space except existing ones - make single targets work properly - rebuild modules when module linker scripts are updated - split the module final link stage into scripts/Makefile.modfinal - fix the missed error code in merge_config.sh - improve the error message displayed on the attempt of the O= build in unclean source tree - remove 'clean-dirs' syntax - disable -Wimplicit-fallthrough warning for Clang - add CONFIG_CC_OPTIMIZE_FOR_SIZE_O3 for ARC - remove ARCH_{CPP,A,C}FLAGS variables - add $(BASH) to run bash scripts - change *CFLAGS_<basetarget>.o to take the relative path to $(obj) instead of the basename - stop suppressing Clang's -Wunused-function warnings when W=1 - fix linux/export.h to avoid genksyms calculating CRC of trimmed exported symbols - misc cleanups * tag 'kbuild-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (63 commits) genksyms: convert to SPDX License Identifier for lex.l and parse.y modpost: use __section in the output to *.mod.c modpost: use MODULE_INFO() for __module_depends export.h, genksyms: do not make genksyms calculate CRC of trimmed symbols export.h: remove defined(__KERNEL__), which is no longer needed kbuild: allow Clang to find unused static inline functions for W=1 build kbuild: rename KBUILD_ENABLE_EXTRA_GCC_CHECKS to KBUILD_EXTRA_WARN kbuild: refactor scripts/Makefile.extrawarn merge_config.sh: ignore unwanted grep errors kbuild: change *FLAGS_<basetarget>.o to take the path relative to $(obj) modpost: add NOFAIL to strndup modpost: add guid_t type definition kbuild: add $(BASH) to run scripts with bash-extension kbuild: remove ARCH_{CPP,A,C}FLAGS kbuild,arc: add CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3 for ARC kbuild: Do not enable -Wimplicit-fallthrough for clang for now kbuild: clean up subdir-ymn calculation in Makefile.clean kbuild: remove unneeded '+' marker from cmd_clean kbuild: remove clean-dirs syntax kbuild: check clean srctree even earlier ...
2 parents 574cc45 + 77564a4 commit d7b0827

96 files changed

Lines changed: 763 additions & 686 deletions

Some content is hidden

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

‎.gitignore‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
*.mod.c
3535
*.o
3636
*.o.*
37-
*.order
3837
*.patch
3938
*.s
4039
*.so
@@ -46,6 +45,7 @@
4645
*.xz
4746
Module.symvers
4847
modules.builtin
48+
modules.order
4949

5050
#
5151
# Top-level generic files

‎Documentation/kbuild/kbuild.rst‎

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,15 @@ The output directory can also be specified using "O=...".
105105

106106
Setting "O=..." takes precedence over KBUILD_OUTPUT.
107107

108+
KBUILD_EXTRA_WARN
109+
-----------------
110+
Specify the extra build checks. The same value can be assigned by passing
111+
W=... from the command line.
112+
113+
See `make help` for the list of the supported values.
114+
115+
Setting "W=..." takes precedence over KBUILD_EXTRA_WARN.
116+
108117
KBUILD_DEBARCH
109118
--------------
110119
For the deb-pkg target, allows overriding the normal heuristics deployed by
@@ -241,11 +250,6 @@ To get all available archs you can also specify all. E.g.::
241250

242251
$ make ALLSOURCE_ARCHS=all tags
243252

244-
KBUILD_ENABLE_EXTRA_GCC_CHECKS
245-
------------------------------
246-
If enabled over the make command line with "W=1", it turns on additional
247-
gcc -W... options for more extensive build-time checking.
248-
249253
KBUILD_BUILD_TIMESTAMP
250254
----------------------
251255
Setting this to a date string overrides the timestamp used in the
@@ -258,17 +262,3 @@ KBUILD_BUILD_USER, KBUILD_BUILD_HOST
258262
These two variables allow to override the user@host string displayed during
259263
boot and in /proc/version. The default value is the output of the commands
260264
whoami and host, respectively.
261-
262-
KBUILD_LDS
263-
----------
264-
The linker script with full path. Assigned by the top-level Makefile.
265-
266-
KBUILD_VMLINUX_OBJS
267-
-------------------
268-
All object files for vmlinux. They are linked to vmlinux in the same
269-
order as listed in KBUILD_VMLINUX_OBJS.
270-
271-
KBUILD_VMLINUX_LIBS
272-
-------------------
273-
All .a "lib" files for vmlinux. KBUILD_VMLINUX_OBJS and KBUILD_VMLINUX_LIBS
274-
together specify all the object files used to link vmlinux.

‎Documentation/kbuild/makefiles.rst‎

Lines changed: 25 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -471,21 +471,6 @@ more details, with real examples.
471471
The second argument is optional, and if supplied will be used
472472
if first argument is not supported.
473473

474-
cc-ldoption
475-
cc-ldoption is used to check if $(CC) when used to link object files
476-
supports the given option. An optional second option may be
477-
specified if first option are not supported.
478-
479-
Example::
480-
481-
#arch/x86/kernel/Makefile
482-
vsyscall-flags += $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
483-
484-
In the above example, vsyscall-flags will be assigned the option
485-
-Wl$(comma)--hash-style=sysv if it is supported by $(CC).
486-
The second argument is optional, and if supplied will be used
487-
if first argument is not supported.
488-
489474
as-instr
490475
as-instr checks if the assembler reports a specific instruction
491476
and then outputs either option1 or option2
@@ -765,7 +750,8 @@ Files matching the patterns "*.[oas]", "*.ko", plus some additional files
765750
generated by kbuild are deleted all over the kernel src tree when
766751
"make clean" is executed.
767752

768-
Additional files can be specified in kbuild makefiles by use of $(clean-files).
753+
Additional files or directories can be specified in kbuild makefiles by use of
754+
$(clean-files).
769755

770756
Example::
771757

@@ -776,23 +762,8 @@ When executing "make clean", the file "crc32table.h" will be deleted.
776762
Kbuild will assume files to be in the same relative directory as the
777763
Makefile, except if prefixed with $(objtree).
778764

779-
To delete a directory hierarchy use:
780-
781-
Example::
782-
783-
#scripts/package/Makefile
784-
clean-dirs := $(objtree)/debian/
785-
786-
This will delete the directory debian in the toplevel directory, including all
787-
subdirectories.
788-
789-
To exclude certain files from make clean, use the $(no-clean-files) variable.
790-
This is only a special case used in the top level Kbuild file:
791-
792-
Example::
793-
794-
#Kbuild
795-
no-clean-files := $(bounds-file) $(offsets-file)
765+
To exclude certain files or directories from make clean, use the
766+
$(no-clean-files) variable.
796767

797768
Usually kbuild descends down in subdirectories due to "obj-* := dir/",
798769
but in the architecture makefiles where the kbuild infrastructure
@@ -988,13 +959,25 @@ When kbuild executes, the following steps are followed (roughly):
988959
$(KBUILD_ARFLAGS) set by the top level Makefile to "D" (deterministic
989960
mode) if this option is supported by $(AR).
990961

991-
ARCH_CPPFLAGS, ARCH_AFLAGS, ARCH_CFLAGS Overrides the kbuild defaults
962+
KBUILD_LDS
963+
964+
The linker script with full path. Assigned by the top-level Makefile.
965+
966+
KBUILD_LDS_MODULE
967+
968+
The module linker script with full path. Assigned by the top-level
969+
Makefile and additionally by the arch Makefile.
970+
971+
KBUILD_VMLINUX_OBJS
972+
973+
All object files for vmlinux. They are linked to vmlinux in the same
974+
order as listed in KBUILD_VMLINUX_OBJS.
992975

993-
These variables are appended to the KBUILD_CPPFLAGS,
994-
KBUILD_AFLAGS, and KBUILD_CFLAGS, respectively, after the
995-
top-level Makefile has set any other flags. This provides a
996-
means for an architecture to override the defaults.
976+
KBUILD_VMLINUX_LIBS
997977

978+
All .a "lib" files for vmlinux. KBUILD_VMLINUX_OBJS and
979+
KBUILD_VMLINUX_LIBS together specify all the object files used to
980+
link vmlinux.
998981

999982
6.2 Add prerequisites to archheaders
1000983
------------------------------------
@@ -1139,19 +1122,19 @@ When kbuild executes, the following steps are followed (roughly):
11391122

11401123
header-test-y
11411124

1142-
header-test-y specifies headers (*.h) in the current directory that
1125+
header-test-y specifies headers (`*.h`) in the current directory that
11431126
should be compile tested to ensure they are self-contained,
11441127
i.e. compilable as standalone units. If CONFIG_HEADER_TEST is enabled,
11451128
this builds them as part of extra-y.
11461129

11471130
header-test-pattern-y
11481131

11491132
This works as a weaker version of header-test-y, and accepts wildcard
1150-
patterns. The typical usage is:
1133+
patterns. The typical usage is::
11511134

1152-
header-test-pattern-y += *.h
1135+
header-test-pattern-y += *.h
11531136

1154-
This specifies all the files that matches to '*.h' in the current
1137+
This specifies all the files that matches to `*.h` in the current
11551138
directory, but the files in 'header-test-' are excluded.
11561139

11571140
6.7 Commands useful for building a boot image

‎Kbuild‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ $(bounds-file): kernel/bounds.s FORCE
1818

1919
timeconst-file := include/generated/timeconst.h
2020

21-
targets += $(timeconst-file)
22-
2321
filechk_gentimeconst = echo $(CONFIG_HZ) | bc -q $<
2422

2523
$(timeconst-file): kernel/time/timeconst.bc FORCE
@@ -42,7 +40,6 @@ $(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE
4240
# Check for missing system calls
4341

4442
always += missing-syscalls
45-
targets += missing-syscalls
4643

4744
quiet_cmd_syscalls = CALL $<
4845
cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags)
@@ -54,13 +51,9 @@ missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE
5451
# Check atomic headers are up-to-date
5552

5653
always += old-atomics
57-
targets += old-atomics
5854

5955
quiet_cmd_atomics = CALL $<
6056
cmd_atomics = $(CONFIG_SHELL) $<
6157

6258
old-atomics: scripts/atomic/check-atomics.sh FORCE
6359
$(call cmd,atomics)
64-
65-
# Keep these three files during make clean
66-
no-clean-files := $(bounds-file) $(offsets-file) $(timeconst-file)

0 commit comments

Comments
 (0)