Skip to content

Commit 8afc66e

Browse files
committedOct 10, 2022
Merge tag 'kbuild-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild updates from Masahiro Yamada: - Remove potentially incomplete targets when Kbuid is interrupted by SIGINT etc in case GNU Make may miss to do that when stderr is piped to another program. - Rewrite the single target build so it works more correctly. - Fix rpm-pkg builds with V=1. - List top-level subdirectories in ./Kbuild. - Ignore auto-generated __kstrtab_* and __kstrtabns_* symbols in kallsyms. - Avoid two different modules in lib/zstd/ having shared code, which potentially causes building the common code as build-in and modular back-and-forth. - Unify two modpost invocations to optimize the build process. - Remove head-y syntax in favor of linker scripts for placing particular sections in the head of vmlinux. - Bump the minimal GNU Make version to 3.82. - Clean up misc Makefiles and scripts. * tag 'kbuild-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (41 commits) docs: bump minimal GNU Make version to 3.82 ia64: simplify esi object addition in Makefile Revert "kbuild: Check if linker supports the -X option" kbuild: rebuild .vmlinux.export.o when its prerequisite is updated kbuild: move modules.builtin(.modinfo) rules to Makefile.vmlinux_o zstd: Fixing mixed module-builtin objects kallsyms: ignore __kstrtab_* and __kstrtabns_* symbols kallsyms: take the input file instead of reading stdin kallsyms: drop duplicated ignore patterns from kallsyms.c kbuild: reuse mksysmap output for kallsyms mksysmap: update comment about __crc_* kbuild: remove head-y syntax kbuild: use obj-y instead extra-y for objects placed at the head kbuild: hide error checker logs for V=1 builds kbuild: re-run modpost when it is updated kbuild: unify two modpost invocations kbuild: move vmlinux.o rule to the top Makefile kbuild: move .vmlinux.objs rule to Makefile.modpost kbuild: list sub-directories in ./Kbuild Makefile.compiler: replace cc-ifversion with compiler-specific macros ...
2 parents 4de65c5 + 0715fdb commit 8afc66e

Some content is hidden

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

87 files changed

+729
-763
lines changed
 

‎Documentation/kbuild/makefiles.rst

+23-33
Original file line numberDiff line numberDiff line change
@@ -341,30 +341,14 @@ more details, with real examples.
341341

342342
Examples are:
343343

344-
1) head objects
345-
346-
Some objects must be placed at the head of vmlinux. They are
347-
directly linked to vmlinux without going through built-in.a
348-
A typical use-case is an object that contains the entry point.
349-
350-
arch/$(SRCARCH)/Makefile should specify such objects as head-y.
351-
352-
Discussion:
353-
Given that we can control the section order in the linker script,
354-
why do we need head-y?
355-
356-
2) vmlinux linker script
344+
1) vmlinux linker script
357345

358346
The linker script for vmlinux is located at
359347
arch/$(SRCARCH)/kernel/vmlinux.lds
360348

361349
Example::
362350

363351
# arch/x86/kernel/Makefile
364-
extra-y := head_$(BITS).o
365-
extra-y += head$(BITS).o
366-
extra-y += ebda.o
367-
extra-y += platform-quirks.o
368352
extra-y += vmlinux.lds
369353

370354
$(extra-y) should only contain targets needed for vmlinux.
@@ -683,22 +667,27 @@ more details, with real examples.
683667
In the above example, -Wno-unused-but-set-variable will be added to
684668
KBUILD_CFLAGS only if gcc really accepts it.
685669

686-
cc-ifversion
687-
cc-ifversion tests the version of $(CC) and equals the fourth parameter
688-
if version expression is true, or the fifth (if given) if the version
689-
expression is false.
670+
gcc-min-version
671+
gcc-min-version tests if the value of $(CONFIG_GCC_VERSION) is greater than
672+
or equal to the provided value and evaluates to y if so.
673+
674+
Example::
675+
676+
cflags-$(call gcc-min-version, 70100) := -foo
677+
678+
In this example, cflags-y will be assigned the value -foo if $(CC) is gcc and
679+
$(CONFIG_GCC_VERSION) is >= 7.1.
680+
681+
clang-min-version
682+
clang-min-version tests if the value of $(CONFIG_CLANG_VERSION) is greater
683+
than or equal to the provided value and evaluates to y if so.
690684

691685
Example::
692686

693-
#fs/reiserfs/Makefile
694-
ccflags-y := $(call cc-ifversion, -lt, 0402, -O1)
687+
cflags-$(call clang-min-version, 110000) := -foo
695688

696-
In this example, ccflags-y will be assigned the value -O1 if the
697-
$(CC) version is less than 4.2.
698-
cc-ifversion takes all the shell operators:
699-
-eq, -ne, -lt, -le, -gt, and -ge
700-
The third parameter may be a text as in this example, but it may also
701-
be an expanded variable or a macro.
689+
In this example, cflags-y will be assigned the value -foo if $(CC) is clang
690+
and $(CONFIG_CLANG_VERSION) is >= 11.0.0.
702691

703692
cc-cross-prefix
704693
cc-cross-prefix is used to check if there exists a $(CC) in path with
@@ -1099,8 +1088,7 @@ When kbuild executes, the following steps are followed (roughly):
10991088
- The values of the above variables are expanded in arch/$(SRCARCH)/Makefile.
11001089
5) All object files are then linked and the resulting file vmlinux is
11011090
located at the root of the obj tree.
1102-
The very first objects linked are listed in head-y, assigned by
1103-
arch/$(SRCARCH)/Makefile.
1091+
The very first objects linked are listed in scripts/head-object-list.txt.
11041092
6) Finally, the architecture-specific part does any required post processing
11051093
and builds the final bootimage.
11061094
- This includes building boot records
@@ -1272,6 +1260,9 @@ When kbuild executes, the following steps are followed (roughly):
12721260
All object files for vmlinux. They are linked to vmlinux in the same
12731261
order as listed in KBUILD_VMLINUX_OBJS.
12741262

1263+
The objects listed in scripts/head-object-list.txt are exceptions;
1264+
they are placed before the other objects.
1265+
12751266
KBUILD_VMLINUX_LIBS
12761267

12771268
All .a "lib" files for vmlinux. KBUILD_VMLINUX_OBJS and
@@ -1315,8 +1306,7 @@ When kbuild executes, the following steps are followed (roughly):
13151306
machinery is all architecture-independent.
13161307

13171308

1318-
head-y, core-y, libs-y, drivers-y
1319-
$(head-y) lists objects to be linked first in vmlinux.
1309+
core-y, libs-y, drivers-y
13201310

13211311
$(libs-y) lists directories where a lib.a archive can be located.
13221312

‎Documentation/process/changes.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ GNU C 5.1 gcc --version
3333
Clang/LLVM (optional) 11.0.0 clang --version
3434
Rust (optional) 1.62.0 rustc --version
3535
bindgen (optional) 0.56.0 bindgen --version
36-
GNU make 3.81 make --version
36+
GNU make 3.82 make --version
3737
bash 4.2 bash --version
3838
binutils 2.23 ld -v
3939
flex 2.5.35 flex --version
@@ -108,7 +108,7 @@ It depends on ``libclang``.
108108
Make
109109
----
110110

111-
You will need GNU make 3.81 or later to build the kernel.
111+
You will need GNU make 3.82 or later to build the kernel.
112112

113113
Bash
114114
----

0 commit comments

Comments
 (0)
Please sign in to comment.