Skip to content

Commit 6fbd6cf

Browse files
committed
Merge tag 'kbuild-v5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild updates from Masahiro Yamada: - Fix false-positive build warnings for ARCH=ia64 builds - Optimize dictionary size for module compression with xz - Check the compiler and linker versions in Kconfig - Fix misuse of extra-y - Support DWARF v5 debug info - Clamp SUBLEVEL to 255 because stable releases 4.4.x and 4.9.x exceeded the limit - Add generic syscall{tbl,hdr}.sh for cleanups across arches - Minor cleanups of genksyms - Minor cleanups of Kconfig * tag 'kbuild-v5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (38 commits) initramfs: Remove redundant dependency of RD_ZSTD on BLK_DEV_INITRD kbuild: remove deprecated 'always' and 'hostprogs-y/m' kbuild: parse C= and M= before changing the working directory kbuild: reuse this-makefile to define abs_srctree kconfig: unify rule of config, menuconfig, nconfig, gconfig, xconfig kconfig: omit --oldaskconfig option for 'make config' kconfig: fix 'invalid option' for help option kconfig: remove dead code in conf_askvalue() kconfig: clean up nested if-conditionals in check_conf() kconfig: Remove duplicate call to sym_get_string_value() Makefile: Remove # characters from compiler string Makefile: reuse CC_VERSION_TEXT kbuild: check the minimum linker version in Kconfig kbuild: remove ld-version macro scripts: add generic syscallhdr.sh scripts: add generic syscalltbl.sh arch: syscalls: remove $(srctree)/ prefix from syscall tables arch: syscalls: add missing FORCE and fix 'targets' to make if_changed work gen_compile_commands: prune some directories kbuild: simplify access to the kernel's version ...
2 parents 6f9972b + 481083e commit 6fbd6cf

File tree

65 files changed

+698
-498
lines changed

Some content is hidden

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

65 files changed

+698
-498
lines changed

Documentation/devicetree/bindings/Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ $(obj)/processed-schema.json: $(DT_SCHEMA_FILES) check_dtschema_version FORCE
7878

7979
endif
8080

81-
extra-$(CHECK_DT_BINDING) += processed-schema-examples.json
82-
extra-$(CHECK_DTBS) += processed-schema.json
83-
extra-$(CHECK_DT_BINDING) += $(patsubst $(src)/%.yaml,%.example.dts, $(DT_SCHEMA_FILES))
84-
extra-$(CHECK_DT_BINDING) += $(patsubst $(src)/%.yaml,%.example.dt.yaml, $(DT_SCHEMA_FILES))
81+
always-$(CHECK_DT_BINDING) += processed-schema-examples.json
82+
always-$(CHECK_DTBS) += processed-schema.json
83+
always-$(CHECK_DT_BINDING) += $(patsubst $(src)/%.yaml,%.example.dts, $(DT_SCHEMA_FILES))
84+
always-$(CHECK_DT_BINDING) += $(patsubst $(src)/%.yaml,%.example.dt.yaml, $(DT_SCHEMA_FILES))
8585

8686
# Hack: avoid 'Argument list too long' error for 'make clean'. Remove most of
8787
# build artifacts here before they are processed by scripts/Makefile.clean

Documentation/kbuild/makefiles.rst

+1-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This document describes the Linux kernel Makefiles.
1212
--- 3.1 Goal definitions
1313
--- 3.2 Built-in object goals - obj-y
1414
--- 3.3 Loadable module goals - obj-m
15-
--- 3.4 Objects which export symbols
15+
--- 3.4 <deleted>
1616
--- 3.5 Library file goals - lib-y
1717
--- 3.6 Descending down in directories
1818
--- 3.7 Non-builtin vmlinux targets - extra-y
@@ -247,12 +247,6 @@ more details, with real examples.
247247
kbuild will build an ext2.o file for you out of the individual
248248
parts and then link this into built-in.a, as you would expect.
249249

250-
3.4 Objects which export symbols
251-
--------------------------------
252-
253-
No special notation is required in the makefiles for
254-
modules exporting symbols.
255-
256250
3.5 Library file goals - lib-y
257251
------------------------------
258252

MAINTAINERS

-2
Original file line numberDiff line numberDiff line change
@@ -4319,8 +4319,6 @@ C: irc://chat.freenode.net/clangbuiltlinux
43194319
F: Documentation/kbuild/llvm.rst
43204320
F: include/linux/compiler-clang.h
43214321
F: scripts/clang-tools/
4322-
F: scripts/clang-version.sh
4323-
F: scripts/lld-version.sh
43244322
K: \b(?i:clang|llvm)\b
43254323

43264324
CLEANCACHE API

Makefile

+57-48
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,36 @@ endif
100100

101101
export quiet Q KBUILD_VERBOSE
102102

103+
# Call a source code checker (by default, "sparse") as part of the
104+
# C compilation.
105+
#
106+
# Use 'make C=1' to enable checking of only re-compiled files.
107+
# Use 'make C=2' to enable checking of *all* source files, regardless
108+
# of whether they are re-compiled or not.
109+
#
110+
# See the file "Documentation/dev-tools/sparse.rst" for more details,
111+
# including where to get the "sparse" utility.
112+
113+
ifeq ("$(origin C)", "command line")
114+
KBUILD_CHECKSRC = $(C)
115+
endif
116+
ifndef KBUILD_CHECKSRC
117+
KBUILD_CHECKSRC = 0
118+
endif
119+
120+
export KBUILD_CHECKSRC
121+
122+
# Use make M=dir or set the environment variable KBUILD_EXTMOD to specify the
123+
# directory of external module to build. Setting M= takes precedence.
124+
ifeq ("$(origin M)", "command line")
125+
KBUILD_EXTMOD := $(M)
126+
endif
127+
128+
$(if $(word 2, $(KBUILD_EXTMOD)), \
129+
$(error building multiple external modules is not supported))
130+
131+
export KBUILD_EXTMOD
132+
103133
# Kbuild will save output files in the current working directory.
104134
# This does not need to match to the root of the kernel source tree.
105135
#
@@ -145,7 +175,8 @@ else
145175
need-sub-make := 1
146176
endif
147177

148-
abs_srctree := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
178+
this-makefile := $(lastword $(MAKEFILE_LIST))
179+
abs_srctree := $(realpath $(dir $(this-makefile)))
149180

150181
ifneq ($(words $(subst :, ,$(abs_srctree))), 1)
151182
$(error source directory cannot contain spaces or colons)
@@ -160,8 +191,6 @@ MAKEFLAGS += --include-dir=$(abs_srctree)
160191
need-sub-make := 1
161192
endif
162193

163-
this-makefile := $(lastword $(MAKEFILE_LIST))
164-
165194
ifneq ($(filter 3.%,$(MAKE_VERSION)),)
166195
# 'MAKEFLAGS += -rR' does not immediately become effective for GNU Make 3.x
167196
# We need to invoke sub-make to avoid implicit rules in the top Makefile.
@@ -195,36 +224,6 @@ ifeq ($(need-sub-make),)
195224
# so that IDEs/editors are able to understand relative filenames.
196225
MAKEFLAGS += --no-print-directory
197226

198-
# Call a source code checker (by default, "sparse") as part of the
199-
# C compilation.
200-
#
201-
# Use 'make C=1' to enable checking of only re-compiled files.
202-
# Use 'make C=2' to enable checking of *all* source files, regardless
203-
# of whether they are re-compiled or not.
204-
#
205-
# See the file "Documentation/dev-tools/sparse.rst" for more details,
206-
# including where to get the "sparse" utility.
207-
208-
ifeq ("$(origin C)", "command line")
209-
KBUILD_CHECKSRC = $(C)
210-
endif
211-
ifndef KBUILD_CHECKSRC
212-
KBUILD_CHECKSRC = 0
213-
endif
214-
215-
# Use make M=dir or set the environment variable KBUILD_EXTMOD to specify the
216-
# directory of external module to build. Setting M= takes precedence.
217-
ifeq ("$(origin M)", "command line")
218-
KBUILD_EXTMOD := $(M)
219-
endif
220-
221-
$(if $(word 2, $(KBUILD_EXTMOD)), \
222-
$(error building multiple external modules is not supported))
223-
224-
export KBUILD_CHECKSRC KBUILD_EXTMOD
225-
226-
extmod-prefix = $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/)
227-
228227
ifeq ($(abs_srctree),$(abs_objtree))
229228
# building in the source tree
230229
srctree := .
@@ -257,7 +256,6 @@ export building_out_of_srctree srctree objtree VPATH
257256
# of make so .config is not included in this case either (for *config).
258257

259258
version_h := include/generated/uapi/linux/version.h
260-
old_version_h := include/linux/version.h
261259

262260
clean-targets := %clean mrproper cleandocs
263261
no-dot-config-targets := $(clean-targets) \
@@ -558,7 +556,13 @@ ifdef building_out_of_srctree
558556
{ echo "# this is build directory, ignore it"; echo "*"; } > .gitignore
559557
endif
560558

561-
ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),)
559+
# The expansion should be delayed until arch/$(SRCARCH)/Makefile is included.
560+
# Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile.
561+
# CC_VERSION_TEXT is referenced from Kconfig (so it needs export),
562+
# and from include/config/auto.conf.cmd to detect the compiler upgrade.
563+
CC_VERSION_TEXT = $(shell $(CC) --version 2>/dev/null | head -n 1 | sed 's/\#//g')
564+
565+
ifneq ($(findstring clang,$(CC_VERSION_TEXT)),)
562566
ifneq ($(CROSS_COMPILE),)
563567
CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%))
564568
GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
@@ -577,12 +581,6 @@ KBUILD_AFLAGS += $(CLANG_FLAGS)
577581
export CLANG_FLAGS
578582
endif
579583

580-
# The expansion should be delayed until arch/$(SRCARCH)/Makefile is included.
581-
# Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile.
582-
# CC_VERSION_TEXT is referenced from Kconfig (so it needs export),
583-
# and from include/config/auto.conf.cmd to detect the compiler upgrade.
584-
CC_VERSION_TEXT = $(shell $(CC) --version 2>/dev/null | head -n 1)
585-
586584
ifdef config-build
587585
# ===========================================================================
588586
# *config targets only - make sure prerequisites are updated, and descend
@@ -832,8 +830,10 @@ ifneq ($(LLVM_IAS),1)
832830
KBUILD_AFLAGS += -Wa,-gdwarf-2
833831
endif
834832

835-
ifdef CONFIG_DEBUG_INFO_DWARF4
836-
DEBUG_CFLAGS += -gdwarf-4
833+
ifndef CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
834+
dwarf-version-$(CONFIG_DEBUG_INFO_DWARF4) := 4
835+
dwarf-version-$(CONFIG_DEBUG_INFO_DWARF5) := 5
836+
DEBUG_CFLAGS += -gdwarf-$(dwarf-version-y)
837837
endif
838838

839839
ifdef CONFIG_DEBUG_INFO_REDUCED
@@ -1072,7 +1072,7 @@ ifdef CONFIG_MODULE_COMPRESS
10721072
mod_compress_cmd = $(KGZIP) -n -f
10731073
endif # CONFIG_MODULE_COMPRESS_GZIP
10741074
ifdef CONFIG_MODULE_COMPRESS_XZ
1075-
mod_compress_cmd = $(XZ) -f
1075+
mod_compress_cmd = $(XZ) --lzma2=dict=2MiB -f
10761076
endif # CONFIG_MODULE_COMPRESS_XZ
10771077
endif # CONFIG_MODULE_COMPRESS
10781078
export mod_compress_cmd
@@ -1123,6 +1123,7 @@ endif # CONFIG_BPF
11231123

11241124
PHONY += prepare0
11251125

1126+
extmod-prefix = $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/)
11261127
export MODORDER := $(extmod-prefix)modules.order
11271128
export MODULES_NSDEPS := $(extmod-prefix)modules.nsdeps
11281129

@@ -1280,14 +1281,22 @@ define filechk_utsrelease.h
12801281
endef
12811282

12821283
define filechk_version.h
1283-
echo \#define LINUX_VERSION_CODE $(shell \
1284-
expr $(VERSION) \* 65536 + 0$(PATCHLEVEL) \* 256 + 0$(SUBLEVEL)); \
1285-
echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'
1284+
if [ $(SUBLEVEL) -gt 255 ]; then \
1285+
echo \#define LINUX_VERSION_CODE $(shell \
1286+
expr $(VERSION) \* 65536 + 0$(PATCHLEVEL) \* 256 + 255); \
1287+
else \
1288+
echo \#define LINUX_VERSION_CODE $(shell \
1289+
expr $(VERSION) \* 65536 + 0$(PATCHLEVEL) \* 256 + $(SUBLEVEL)); \
1290+
fi; \
1291+
echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + \
1292+
((c) > 255 ? 255 : (c)))'; \
1293+
echo \#define LINUX_VERSION_MAJOR $(VERSION); \
1294+
echo \#define LINUX_VERSION_PATCHLEVEL $(PATCHLEVEL); \
1295+
echo \#define LINUX_VERSION_SUBLEVEL $(SUBLEVEL)
12861296
endef
12871297

12881298
$(version_h): FORCE
12891299
$(call filechk,version.h)
1290-
$(Q)rm -f $(old_version_h)
12911300

12921301
include/generated/utsrelease.h: include/config/kernel.release FORCE
12931302
$(call filechk,utsrelease.h)

arch/alpha/kernel/syscalls/Makefile

+7-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ uapi := arch/$(SRCARCH)/include/generated/uapi/asm
55
_dummy := $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)') \
66
$(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)')
77

8-
syscall := $(srctree)/$(src)/syscall.tbl
8+
syscall := $(src)/syscall.tbl
99
syshdr := $(srctree)/$(src)/syscallhdr.sh
1010
systbl := $(srctree)/$(src)/syscalltbl.sh
1111

@@ -21,18 +21,19 @@ quiet_cmd_systbl = SYSTBL $@
2121
'$(systbl_abi_$(basetarget))' \
2222
'$(systbl_offset_$(basetarget))'
2323

24-
$(uapi)/unistd_32.h: $(syscall) $(syshdr)
24+
$(uapi)/unistd_32.h: $(syscall) $(syshdr) FORCE
2525
$(call if_changed,syshdr)
2626

27-
$(kapi)/syscall_table.h: $(syscall) $(systbl)
27+
$(kapi)/syscall_table.h: $(syscall) $(systbl) FORCE
2828
$(call if_changed,systbl)
2929

3030
uapisyshdr-y += unistd_32.h
3131
kapisyshdr-y += syscall_table.h
3232

33-
targets += $(uapisyshdr-y) $(kapisyshdr-y)
33+
uapisyshdr-y := $(addprefix $(uapi)/, $(uapisyshdr-y))
34+
kapisyshdr-y := $(addprefix $(kapi)/, $(kapisyshdr-y))
35+
targets += $(addprefix ../../../../, $(uapisyshdr-y) $(kapisyshdr-y))
3436

3537
PHONY += all
36-
all: $(addprefix $(uapi)/,$(uapisyshdr-y))
37-
all: $(addprefix $(kapi)/,$(kapisyshdr-y))
38+
all: $(uapisyshdr-y) $(kapisyshdr-y)
3839
@:

arch/arm/tools/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ uapi := $(gen)/uapi/asm
1111
syshdr := $(srctree)/$(src)/syscallhdr.sh
1212
sysnr := $(srctree)/$(src)/syscallnr.sh
1313
systbl := $(srctree)/$(src)/syscalltbl.sh
14-
syscall := $(srctree)/$(src)/syscall.tbl
14+
syscall := $(src)/syscall.tbl
1515

1616
gen-y := $(gen)/calls-oabi.S
1717
gen-y += $(gen)/calls-eabi.S

arch/arm64/Kconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -1485,7 +1485,7 @@ config ARM64_PTR_AUTH
14851485
depends on (CC_HAS_SIGN_RETURN_ADDRESS || CC_HAS_BRANCH_PROT_PAC_RET) && AS_HAS_PAC
14861486
# Modern compilers insert a .note.gnu.property section note for PAC
14871487
# which is only understood by binutils starting with version 2.33.1.
1488-
depends on LD_IS_LLD || LD_VERSION >= 233010000 || (CC_IS_GCC && GCC_VERSION < 90100)
1488+
depends on LD_IS_LLD || LD_VERSION >= 23301 || (CC_IS_GCC && GCC_VERSION < 90100)
14891489
depends on !CC_IS_CLANG || AS_HAS_CFI_NEGATE_RA_STATE
14901490
depends on (!FUNCTION_GRAPH_TRACER || DYNAMIC_FTRACE_WITH_REGS)
14911491
help

arch/ia64/Makefile

-6
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,3 @@ define archhelp
8585
echo ' install - Install compressed kernel image'
8686
echo '* unwcheck - Check vmlinux for invalid unwind info'
8787
endef
88-
89-
archprepare: make_nr_irqs_h
90-
PHONY += make_nr_irqs_h
91-
92-
make_nr_irqs_h:
93-
$(Q)$(MAKE) $(build)=arch/ia64/kernel include/generated/nr-irqs.h

arch/ia64/include/asm/irq.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414

1515
#include <linux/types.h>
1616
#include <linux/cpumask.h>
17-
#include <generated/nr-irqs.h>
17+
#include <asm/native/irq.h>
18+
19+
#define NR_IRQS IA64_NATIVE_NR_IRQS
1820

1921
static __inline__ int
2022
irq_canonicalize (int irq)

arch/ia64/include/asm/mca.h

+4-7
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,10 @@
1414

1515
#if !defined(__ASSEMBLY__)
1616

17-
#include <linux/interrupt.h>
17+
#include <linux/percpu.h>
18+
#include <linux/threads.h>
1819
#include <linux/types.h>
19-
20-
#include <asm/param.h>
21-
#include <asm/sal.h>
22-
#include <asm/processor.h>
23-
#include <asm/mca_asm.h>
20+
#include <asm/ptrace.h>
2421

2522
#define IA64_MCA_RENDEZ_TIMEOUT (20 * 1000) /* value in milliseconds - 20 seconds */
2623

@@ -83,7 +80,7 @@ struct ia64_sal_os_state {
8380
/* common */
8481
unsigned long sal_ra; /* Return address in SAL, physical */
8582
unsigned long sal_gp; /* GP of the SAL - physical */
86-
pal_min_state_area_t *pal_min_state; /* from R17. physical in asm, virtual in C */
83+
struct pal_min_state_area *pal_min_state; /* from R17. physical in asm, virtual in C */
8784
/* Previous values of IA64_KR(CURRENT) and IA64_KR(CURRENT_STACK).
8885
* Note: if the MCA/INIT recovery code wants to resume to a new context
8986
* then it must change these values to reflect the new kernel stack.

arch/ia64/include/asm/pal.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ typedef union pal_mc_error_info_u {
750750
* for PAL.
751751
*/
752752

753-
typedef struct pal_min_state_area_s {
753+
struct pal_min_state_area {
754754
u64 pmsa_nat_bits; /* nat bits for saved GRs */
755755
u64 pmsa_gr[15]; /* GR1 - GR15 */
756756
u64 pmsa_bank0_gr[16]; /* GR16 - GR31 */
@@ -766,7 +766,7 @@ typedef struct pal_min_state_area_s {
766766
u64 pmsa_xfs; /* previous ifs */
767767
u64 pmsa_br1; /* branch register 1 */
768768
u64 pmsa_reserved[70]; /* pal_min_state_area should total to 1KB */
769-
} pal_min_state_area_t;
769+
};
770770

771771

772772
struct ia64_pal_retval {

arch/ia64/include/asm/sal.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ typedef struct sal_processor_static_info {
385385
fr : 1,
386386
reserved : 58;
387387
} valid;
388-
pal_min_state_area_t min_state_area;
388+
struct pal_min_state_area min_state_area;
389389
u64 br[8];
390390
u64 cr[128];
391391
u64 ar[128];

arch/ia64/kernel/Makefile

-5
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,3 @@ CFLAGS_traps.o += -mfixed-range=f2-f5,f16-f31
4747

4848
# The gate DSO image is built using a special linker script.
4949
include $(src)/Makefile.gate
50-
51-
include/generated/nr-irqs.h: arch/$(SRCARCH)/kernel/nr-irqs.s FORCE
52-
$(call filechk,offsets,__ASM_NR_IRQS_H__)
53-
54-
targets += nr-irqs.s

arch/ia64/kernel/asm-offsets.c

+9-9
Original file line numberDiff line numberDiff line change
@@ -245,23 +245,23 @@ void foo(void)
245245
BLANK();
246246

247247
DEFINE(IA64_PMSA_GR_OFFSET,
248-
offsetof (struct pal_min_state_area_s, pmsa_gr));
248+
offsetof(struct pal_min_state_area, pmsa_gr));
249249
DEFINE(IA64_PMSA_BANK1_GR_OFFSET,
250-
offsetof (struct pal_min_state_area_s, pmsa_bank1_gr));
250+
offsetof(struct pal_min_state_area, pmsa_bank1_gr));
251251
DEFINE(IA64_PMSA_PR_OFFSET,
252-
offsetof (struct pal_min_state_area_s, pmsa_pr));
252+
offsetof(struct pal_min_state_area, pmsa_pr));
253253
DEFINE(IA64_PMSA_BR0_OFFSET,
254-
offsetof (struct pal_min_state_area_s, pmsa_br0));
254+
offsetof(struct pal_min_state_area, pmsa_br0));
255255
DEFINE(IA64_PMSA_RSC_OFFSET,
256-
offsetof (struct pal_min_state_area_s, pmsa_rsc));
256+
offsetof(struct pal_min_state_area, pmsa_rsc));
257257
DEFINE(IA64_PMSA_IIP_OFFSET,
258-
offsetof (struct pal_min_state_area_s, pmsa_iip));
258+
offsetof(struct pal_min_state_area, pmsa_iip));
259259
DEFINE(IA64_PMSA_IPSR_OFFSET,
260-
offsetof (struct pal_min_state_area_s, pmsa_ipsr));
260+
offsetof(struct pal_min_state_area, pmsa_ipsr));
261261
DEFINE(IA64_PMSA_IFS_OFFSET,
262-
offsetof (struct pal_min_state_area_s, pmsa_ifs));
262+
offsetof(struct pal_min_state_area, pmsa_ifs));
263263
DEFINE(IA64_PMSA_XIP_OFFSET,
264-
offsetof (struct pal_min_state_area_s, pmsa_xip));
264+
offsetof(struct pal_min_state_area, pmsa_xip));
265265
BLANK();
266266

267267
/* used by fsys_gettimeofday in arch/ia64/kernel/fsys.S */

0 commit comments

Comments
 (0)