hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/Makefile
....@@ -1,7 +1,7 @@
11 # SPDX-License-Identifier: GPL-2.0
22 VERSION = 5
33 PATCHLEVEL = 10
4
-SUBLEVEL = 160
4
+SUBLEVEL = 198
55 EXTRAVERSION =
66 NAME = Dare mighty things
77
....@@ -93,9 +93,16 @@
9393
9494 # If the user is running make -s (silent mode), suppress echoing of
9595 # commands
96
+# make-4.0 (and later) keep single letter options in the 1st word of MAKEFLAGS.
9697
97
-ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),)
98
- quiet=silent_
98
+ifeq ($(filter 3.%,$(MAKE_VERSION)),)
99
+silence:=$(findstring s,$(firstword -$(MAKEFLAGS)))
100
+else
101
+silence:=$(findstring s,$(filter-out --%,$(MAKEFLAGS)))
102
+endif
103
+
104
+ifeq ($(silence),s)
105
+quiet=silent_
99106 endif
100107
101108 export quiet Q KBUILD_VERBOSE
....@@ -597,8 +604,10 @@
597604 ifneq ($(GCC_TOOLCHAIN),)
598605 CLANG_FLAGS += --gcc-toolchain=$(GCC_TOOLCHAIN)
599606 endif
600
-ifneq ($(LLVM_IAS),1)
601
-CLANG_FLAGS += -no-integrated-as
607
+ifeq ($(LLVM_IAS),1)
608
+CLANG_FLAGS += -fintegrated-as
609
+else
610
+CLANG_FLAGS += -fno-integrated-as
602611 endif
603612 CLANG_FLAGS += -Werror=unknown-warning-option
604613 KBUILD_CFLAGS += $(CLANG_FLAGS)
....@@ -828,6 +837,10 @@
828837 KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
829838
830839 KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
840
+
841
+# These result in bogus false positives
842
+KBUILD_CFLAGS += $(call cc-disable-warning, dangling-pointer)
843
+
831844 ifdef CONFIG_FRAME_POINTER
832845 KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
833846 else
....@@ -871,7 +884,7 @@
871884 DEBUG_CFLAGS += -g
872885 endif
873886
874
-ifeq ($(LLVM_IAS),1)
887
+ifdef CONFIG_AS_IS_LLVM
875888 KBUILD_AFLAGS += -g
876889 else
877890 KBUILD_AFLAGS += -Wa,-gdwarf-2
....@@ -1519,9 +1532,7 @@
15191532
15201533 PHONY += modules
15211534 # if KBUILD_BUILTIN && !KBUILD_MIXED_TREE, depend on vmlinux
1522
-modules: $(if $(KBUILD_BUILTIN), $(if $(KBUILD_MIXED_TREE),,vmlinux))
1523
-modules: modules_check modules_prepare
1524
- $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1535
+modules: $(if $(KBUILD_BUILTIN), $(if $(KBUILD_MIXED_TREE),,vmlinux)) modules_check modules_prepare
15251536
15261537 PHONY += modules_check
15271538 modules_check: modules.order
....@@ -1539,12 +1550,9 @@
15391550 modules_prepare: prepare
15401551 $(Q)$(MAKE) $(build)=scripts scripts/module.lds
15411552
1542
-# Target to install modules
1543
-PHONY += modules_install
1544
-modules_install: _modinst_ _modinst_post
1545
-
1546
-PHONY += _modinst_
1547
-_modinst_:
1553
+modules_install: __modinst_pre
1554
+PHONY += __modinst_pre
1555
+__modinst_pre:
15481556 @rm -rf $(MODLIB)/kernel
15491557 @rm -f $(MODLIB)/source
15501558 @mkdir -p $(MODLIB)/kernel
....@@ -1556,34 +1564,12 @@
15561564 @sed 's:^:kernel/:' modules.order > $(MODLIB)/modules.order
15571565 @cp -f $(mixed-build-prefix)modules.builtin $(MODLIB)/
15581566 @cp -f $(or $(mixed-build-prefix),$(objtree)/)modules.builtin.modinfo $(MODLIB)/
1559
- $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
1560
-
1561
-# This depmod is only for convenience to give the initial
1562
-# boot a modules.dep even before / is mounted read-write. However the
1563
-# boot script depmod is the master version.
1564
-PHONY += _modinst_post
1565
-_modinst_post: _modinst_
1566
- $(call cmd,depmod)
15671567
15681568 ifeq ($(CONFIG_MODULE_SIG), y)
15691569 PHONY += modules_sign
15701570 modules_sign:
15711571 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modsign
15721572 endif
1573
-
1574
-else # CONFIG_MODULES
1575
-
1576
-# Modules not configured
1577
-# ---------------------------------------------------------------------------
1578
-
1579
-PHONY += modules modules_install
1580
-modules modules_install:
1581
- @echo >&2
1582
- @echo >&2 "The present kernel configuration has modules disabled."
1583
- @echo >&2 "Type 'make config' and enable loadable module support."
1584
- @echo >&2 "Then build a kernel with module support enabled."
1585
- @echo >&2
1586
- @exit 1
15871573
15881574 endif # CONFIG_MODULES
15891575
....@@ -1832,25 +1818,8 @@
18321818 KBUILD_MODULES := 1
18331819
18341820 build-dirs := $(KBUILD_EXTMOD)
1835
-PHONY += modules
1836
-modules: $(MODORDER)
1837
- $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1838
-
18391821 $(MODORDER): descend
18401822 @:
1841
-
1842
-PHONY += modules_install
1843
-modules_install: _emodinst_ _emodinst_post
1844
-
1845
-install-dir := $(if $(INSTALL_MOD_DIR),$(INSTALL_MOD_DIR),extra)
1846
-PHONY += _emodinst_
1847
-_emodinst_:
1848
- $(Q)mkdir -p $(MODLIB)/$(install-dir)
1849
- $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
1850
-
1851
-PHONY += _emodinst_post
1852
-_emodinst_post: _emodinst_
1853
- $(call cmd,depmod)
18541823
18551824 compile_commands.json: $(extmod-prefix)compile_commands.json
18561825 PHONY += compile_commands.json
....@@ -1876,6 +1845,41 @@
18761845
18771846 endif # KBUILD_EXTMOD
18781847
1848
+# ---------------------------------------------------------------------------
1849
+# Modules
1850
+
1851
+PHONY += modules modules_install
1852
+
1853
+ifdef CONFIG_MODULES
1854
+
1855
+modules: $(MODORDER)
1856
+ $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1857
+
1858
+quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
1859
+ cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
1860
+ $(KERNELRELEASE) $(mixed-build-prefix)
1861
+
1862
+modules_install:
1863
+ $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
1864
+ $(call cmd,depmod)
1865
+
1866
+else # CONFIG_MODULES
1867
+
1868
+# Modules not configured
1869
+# ---------------------------------------------------------------------------
1870
+
1871
+modules modules_install:
1872
+ @echo >&2 '***'
1873
+ @echo >&2 '*** The present kernel configuration has modules disabled.'
1874
+ @echo >&2 '*** To use the module feature, please run "make menuconfig" etc.'
1875
+ @echo >&2 '*** to enable CONFIG_MODULES.'
1876
+ @echo >&2 '***'
1877
+ @exit 1
1878
+
1879
+KBUILD_MODULES :=
1880
+
1881
+endif # CONFIG_MODULES
1882
+
18791883 # Single targets
18801884 # ---------------------------------------------------------------------------
18811885 # To build individual files in subdirectories, you can do like this:
....@@ -1899,18 +1903,12 @@
18991903 $(single-no-ko): descend
19001904 @:
19011905
1902
-ifeq ($(KBUILD_EXTMOD),)
1903
-# For the single build of in-tree modules, use a temporary file to avoid
1904
-# the situation of modules_install installing an invalid modules.order.
1905
-MODORDER := .modules.tmp
1906
-endif
1907
-
1906
+# Remove MODORDER when done because it is not the real one.
19081907 PHONY += single_modpost
19091908 single_modpost: $(single-no-ko) modules_prepare
19101909 $(Q){ $(foreach m, $(single-ko), echo $(extmod-prefix)$m;) } > $(MODORDER)
19111910 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1912
-
1913
-KBUILD_MODULES := 1
1911
+ $(Q)rm -f $(MODORDER)
19141912
19151913 export KBUILD_SINGLE_TARGETS := $(addprefix $(extmod-prefix), $(single-no-ko))
19161914
....@@ -1918,10 +1916,6 @@
19181916 build-dirs := $(foreach d, $(build-dirs), \
19191917 $(if $(filter $(d)/%, $(KBUILD_SINGLE_TARGETS)), $(d)))
19201918
1921
-endif
1922
-
1923
-ifndef CONFIG_MODULES
1924
-KBUILD_MODULES :=
19251919 endif
19261920
19271921 # Handle descending into subdirectories listed in $(build-dirs)
....@@ -2064,11 +2058,6 @@
20642058
20652059 quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)))
20662060 cmd_rmfiles = rm -rf $(rm-files)
2067
-
2068
-# Run depmod only if we have System.map and depmod is executable
2069
-quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
2070
- cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
2071
- $(KERNELRELEASE) $(mixed-build-prefix)
20722061
20732062 # read saved command lines for existing targets
20742063 existing-targets := $(wildcard $(sort $(targets)))