Skip to content

Commit ffd602e

Browse files
committed
Merge tag 'kbuild-v5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild updates from Masahiro Yamada: - do not generate unneeded top-level built-in.a - let git ignore O= directory entirely - optimize scripts/kallsyms slightly - exclude DWARF info from *.s regardless of config options - fix GCC toolchain search path for Clang to prepare ld.lld support - do not generate modules.order when CONFIG_MODULES is disabled - simplify single target rules and remove VPATH for external module build - allow to add optional flags to dpkg-buildpackage when building deb-pkg - move some compiler option tests from Makefile to Kconfig - various Makefile cleanups * tag 'kbuild-v5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (40 commits) kbuild: remove scripts/basic/% build target kbuild: use -Werror=implicit-... instead of -Werror-implicit-... kbuild: clean up scripts/gcc-version.sh kbuild: remove cc-version macro kbuild: update comment block of scripts/clang-version.sh kbuild: remove commented-out INITRD_COMPRESS kbuild: move -gsplit-dwarf, -gdwarf-4 option tests to Kconfig kbuild: [bin]deb-pkg: add DPKG_FLAGS variable kbuild: move ".config not found!" message from Kconfig to Makefile kbuild: invoke syncconfig if include/config/auto.conf.cmd is missing kbuild: simplify single target rules kbuild: remove empty rules for makefiles kbuild: make -r/-R effective in top Makefile for old Make versions kbuild: move tools_silent to a more relevant place kbuild: compute false-positive -Wmaybe-uninitialized cases in Kconfig kbuild: refactor cc-cross-prefix implementation kbuild: hardcode genksyms path and remove GENKSYMS variable scripts/gdb: refactor rules for symlink creation kbuild: create symlink to vmlinux-gdb.py in scripts_gdb target scripts/gdb: do not descend into scripts/gdb from scripts ...
2 parents 5af7f11 + 9250d20 commit ffd602e

33 files changed

+263
-363
lines changed

Documentation/devicetree/bindings/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ DT_TMP_SCHEMA := processed-schema.yaml
1515
extra-y += $(DT_TMP_SCHEMA)
1616

1717
quiet_cmd_mk_schema = SCHEMA $@
18-
cmd_mk_schema = $(DT_MK_SCHEMA) $(DT_MK_SCHEMA_FLAGS) -o $@ $(filter-out FORCE, $^)
18+
cmd_mk_schema = $(DT_MK_SCHEMA) $(DT_MK_SCHEMA_FLAGS) -o $@ $(real-prereqs)
1919

2020
DT_DOCS = $(shell \
2121
cd $(srctree)/$(src) && \

Documentation/kbuild/kbuild.txt

+5-10
Original file line numberDiff line numberDiff line change
@@ -232,17 +232,12 @@ KBUILD_LDS
232232
--------------------------------------------------
233233
The linker script with full path. Assigned by the top-level Makefile.
234234

235-
KBUILD_VMLINUX_INIT
235+
KBUILD_VMLINUX_OBJS
236236
--------------------------------------------------
237-
All object files for the init (first) part of vmlinux.
238-
Files specified with KBUILD_VMLINUX_INIT are linked first.
239-
240-
KBUILD_VMLINUX_MAIN
241-
--------------------------------------------------
242-
All object files for the main part of vmlinux.
237+
All object files for vmlinux. They are linked to vmlinux in the same
238+
order as listed in KBUILD_VMLINUX_OBJS.
243239

244240
KBUILD_VMLINUX_LIBS
245241
--------------------------------------------------
246-
All .a "lib" files for vmlinux.
247-
KBUILD_VMLINUX_INIT, KBUILD_VMLINUX_MAIN, and KBUILD_VMLINUX_LIBS together
248-
specify all the object files used to link vmlinux.
242+
All .a "lib" files for vmlinux. KBUILD_VMLINUX_OBJS and KBUILD_VMLINUX_LIBS
243+
together specify all the object files used to link vmlinux.

Documentation/kbuild/makefiles.txt

+2-24
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,8 @@ more details, with real examples.
154154

155155
Kbuild compiles all the $(obj-y) files. It then calls
156156
"$(AR) rcSTP" to merge these files into one built-in.a file.
157-
This is a thin archive without a symbol table, which makes it
158-
unsuitable as a linker input.
159-
160-
The scripts/link-vmlinux.sh script later makes an aggregate
161-
built-in.a with "${AR} rcsTP", which creates the thin archive
162-
with a symbol table and an index, making it a valid input for
163-
the final vmlinux link passes.
157+
This is a thin archive without a symbol table. It will be later
158+
linked into vmlinux by scripts/link-vmlinux.sh
164159

165160
The order of files in $(obj-y) is significant. Duplicates in
166161
the lists are allowed: the first instance will be linked into
@@ -504,23 +499,6 @@ more details, with real examples.
504499
In the above example, -Wno-unused-but-set-variable will be added to
505500
KBUILD_CFLAGS only if gcc really accepts it.
506501

507-
cc-version
508-
cc-version returns a numerical version of the $(CC) compiler version.
509-
The format is <major><minor> where both are two digits. So for example
510-
gcc 3.41 would return 0341.
511-
cc-version is useful when a specific $(CC) version is faulty in one
512-
area, for example -mregparm=3 was broken in some gcc versions
513-
even though the option was accepted by gcc.
514-
515-
Example:
516-
#arch/x86/Makefile
517-
cflags-y += $(shell \
518-
if [ $(cc-version) -ge 0300 ] ; then \
519-
echo "-mregparm=3"; fi ;)
520-
521-
In the above example, -mregparm=3 is only used for gcc version greater
522-
than or equal to gcc 3.0.
523-
524502
cc-ifversion
525503
cc-ifversion tests the version of $(CC) and equals the fourth parameter
526504
if version expression is true, or the fifth (if given) if the version

Documentation/kbuild/modules.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ executed to make module versioning work.
140140
make -C $KDIR M=$PWD bar.lst
141141
make -C $KDIR M=$PWD baz.o
142142
make -C $KDIR M=$PWD foo.ko
143-
make -C $KDIR M=$PWD /
143+
make -C $KDIR M=$PWD ./
144144

145145

146146
=== 3. Creating a Kbuild File for an External Module

Kbuild

+5-24
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
# SPDX-License-Identifier: GPL-2.0
22
#
33
# Kbuild for top-level directory of the kernel
4-
# This file takes care of the following:
5-
# 1) Generate bounds.h
6-
# 2) Generate timeconst.h
7-
# 3) Generate asm-offsets.h (may need bounds.h and timeconst.h)
8-
# 4) Check for missing system calls
9-
# 5) check atomics headers are up-to-date
10-
# 6) Generate constants.py (may need bounds.h)
114

125
#####
13-
# 1) Generate bounds.h
6+
# Generate bounds.h
147

158
bounds-file := include/generated/bounds.h
169

@@ -21,7 +14,7 @@ $(bounds-file): kernel/bounds.s FORCE
2114
$(call filechk,offsets,__LINUX_BOUNDS_H__)
2215

2316
#####
24-
# 2) Generate timeconst.h
17+
# Generate timeconst.h
2518

2619
timeconst-file := include/generated/timeconst.h
2720

@@ -33,8 +26,7 @@ $(timeconst-file): kernel/time/timeconst.bc FORCE
3326
$(call filechk,gentimeconst)
3427

3528
#####
36-
# 3) Generate asm-offsets.h
37-
#
29+
# Generate asm-offsets.h
3830

3931
offsets-file := include/generated/asm-offsets.h
4032

@@ -47,8 +39,7 @@ $(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE
4739
$(call filechk,offsets,__ASM_OFFSETS_H__)
4840

4941
#####
50-
# 4) Check for missing system calls
51-
#
42+
# Check for missing system calls
5243

5344
always += missing-syscalls
5445
targets += missing-syscalls
@@ -60,8 +51,7 @@ missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE
6051
$(call cmd,syscalls)
6152

6253
#####
63-
# 5) Check atomic headers are up-to-date
64-
#
54+
# Check atomic headers are up-to-date
6555

6656
always += old-atomics
6757
targets += old-atomics
@@ -72,14 +62,5 @@ quiet_cmd_atomics = CALL $<
7262
old-atomics: scripts/atomic/check-atomics.sh FORCE
7363
$(call cmd,atomics)
7464

75-
#####
76-
# 6) Generate constants for Python GDB integration
77-
#
78-
79-
extra-$(CONFIG_GDB_SCRIPTS) += build_constants_py
80-
81-
build_constants_py: $(timeconst-file) $(bounds-file)
82-
@$(MAKE) $(build)=scripts/gdb/linux $@
83-
8465
# Keep these three files during make clean
8566
no-clean-files := $(bounds-file) $(offsets-file) $(timeconst-file)

0 commit comments

Comments
 (0)