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
....@@ -522,7 +529,6 @@
522529 -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE \
523530 -Werror=implicit-function-declaration -Werror=implicit-int \
524531 -Werror=return-type -Wno-format-security \
525
- -w \
526532 -std=gnu89
527533 KBUILD_CPPFLAGS := -D__KERNEL__
528534 KBUILD_AFLAGS_KERNEL :=
....@@ -598,8 +604,10 @@
598604 ifneq ($(GCC_TOOLCHAIN),)
599605 CLANG_FLAGS += --gcc-toolchain=$(GCC_TOOLCHAIN)
600606 endif
601
-ifneq ($(LLVM_IAS),1)
602
-CLANG_FLAGS += -no-integrated-as
607
+ifeq ($(LLVM_IAS),1)
608
+CLANG_FLAGS += -fintegrated-as
609
+else
610
+CLANG_FLAGS += -fno-integrated-as
603611 endif
604612 CLANG_FLAGS += -Werror=unknown-warning-option
605613 KBUILD_CFLAGS += $(CLANG_FLAGS)
....@@ -829,6 +837,10 @@
829837 KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
830838
831839 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
+
832844 ifdef CONFIG_FRAME_POINTER
833845 KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
834846 else
....@@ -872,7 +884,7 @@
872884 DEBUG_CFLAGS += -g
873885 endif
874886
875
-ifeq ($(LLVM_IAS),1)
887
+ifdef CONFIG_AS_IS_LLVM
876888 KBUILD_AFLAGS += -g
877889 else
878890 KBUILD_AFLAGS += -Wa,-gdwarf-2
....@@ -1520,9 +1532,7 @@
15201532
15211533 PHONY += modules
15221534 # if KBUILD_BUILTIN && !KBUILD_MIXED_TREE, depend on vmlinux
1523
-modules: $(if $(KBUILD_BUILTIN), $(if $(KBUILD_MIXED_TREE),,vmlinux))
1524
-modules: modules_check modules_prepare
1525
- $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1535
+modules: $(if $(KBUILD_BUILTIN), $(if $(KBUILD_MIXED_TREE),,vmlinux)) modules_check modules_prepare
15261536
15271537 PHONY += modules_check
15281538 modules_check: modules.order
....@@ -1540,12 +1550,9 @@
15401550 modules_prepare: prepare
15411551 $(Q)$(MAKE) $(build)=scripts scripts/module.lds
15421552
1543
-# Target to install modules
1544
-PHONY += modules_install
1545
-modules_install: _modinst_ _modinst_post
1546
-
1547
-PHONY += _modinst_
1548
-_modinst_:
1553
+modules_install: __modinst_pre
1554
+PHONY += __modinst_pre
1555
+__modinst_pre:
15491556 @rm -rf $(MODLIB)/kernel
15501557 @rm -f $(MODLIB)/source
15511558 @mkdir -p $(MODLIB)/kernel
....@@ -1557,34 +1564,12 @@
15571564 @sed 's:^:kernel/:' modules.order > $(MODLIB)/modules.order
15581565 @cp -f $(mixed-build-prefix)modules.builtin $(MODLIB)/
15591566 @cp -f $(or $(mixed-build-prefix),$(objtree)/)modules.builtin.modinfo $(MODLIB)/
1560
- $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
1561
-
1562
-# This depmod is only for convenience to give the initial
1563
-# boot a modules.dep even before / is mounted read-write. However the
1564
-# boot script depmod is the master version.
1565
-PHONY += _modinst_post
1566
-_modinst_post: _modinst_
1567
- $(call cmd,depmod)
15681567
15691568 ifeq ($(CONFIG_MODULE_SIG), y)
15701569 PHONY += modules_sign
15711570 modules_sign:
15721571 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modsign
15731572 endif
1574
-
1575
-else # CONFIG_MODULES
1576
-
1577
-# Modules not configured
1578
-# ---------------------------------------------------------------------------
1579
-
1580
-PHONY += modules modules_install
1581
-modules modules_install:
1582
- @echo >&2
1583
- @echo >&2 "The present kernel configuration has modules disabled."
1584
- @echo >&2 "Type 'make config' and enable loadable module support."
1585
- @echo >&2 "Then build a kernel with module support enabled."
1586
- @echo >&2
1587
- @exit 1
15881573
15891574 endif # CONFIG_MODULES
15901575
....@@ -1833,25 +1818,8 @@
18331818 KBUILD_MODULES := 1
18341819
18351820 build-dirs := $(KBUILD_EXTMOD)
1836
-PHONY += modules
1837
-modules: $(MODORDER)
1838
- $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1839
-
18401821 $(MODORDER): descend
18411822 @:
1842
-
1843
-PHONY += modules_install
1844
-modules_install: _emodinst_ _emodinst_post
1845
-
1846
-install-dir := $(if $(INSTALL_MOD_DIR),$(INSTALL_MOD_DIR),extra)
1847
-PHONY += _emodinst_
1848
-_emodinst_:
1849
- $(Q)mkdir -p $(MODLIB)/$(install-dir)
1850
- $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
1851
-
1852
-PHONY += _emodinst_post
1853
-_emodinst_post: _emodinst_
1854
- $(call cmd,depmod)
18551823
18561824 compile_commands.json: $(extmod-prefix)compile_commands.json
18571825 PHONY += compile_commands.json
....@@ -1877,6 +1845,41 @@
18771845
18781846 endif # KBUILD_EXTMOD
18791847
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
+
18801883 # Single targets
18811884 # ---------------------------------------------------------------------------
18821885 # To build individual files in subdirectories, you can do like this:
....@@ -1900,18 +1903,12 @@
19001903 $(single-no-ko): descend
19011904 @:
19021905
1903
-ifeq ($(KBUILD_EXTMOD),)
1904
-# For the single build of in-tree modules, use a temporary file to avoid
1905
-# the situation of modules_install installing an invalid modules.order.
1906
-MODORDER := .modules.tmp
1907
-endif
1908
-
1906
+# Remove MODORDER when done because it is not the real one.
19091907 PHONY += single_modpost
19101908 single_modpost: $(single-no-ko) modules_prepare
19111909 $(Q){ $(foreach m, $(single-ko), echo $(extmod-prefix)$m;) } > $(MODORDER)
19121910 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1913
-
1914
-KBUILD_MODULES := 1
1911
+ $(Q)rm -f $(MODORDER)
19151912
19161913 export KBUILD_SINGLE_TARGETS := $(addprefix $(extmod-prefix), $(single-no-ko))
19171914
....@@ -1919,10 +1916,6 @@
19191916 build-dirs := $(foreach d, $(build-dirs), \
19201917 $(if $(filter $(d)/%, $(KBUILD_SINGLE_TARGETS)), $(d)))
19211918
1922
-endif
1923
-
1924
-ifndef CONFIG_MODULES
1925
-KBUILD_MODULES :=
19261919 endif
19271920
19281921 # Handle descending into subdirectories listed in $(build-dirs)
....@@ -2065,11 +2058,6 @@
20652058
20662059 quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)))
20672060 cmd_rmfiles = rm -rf $(rm-files)
2068
-
2069
-# Run depmod only if we have System.map and depmod is executable
2070
-quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
2071
- cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
2072
- $(KERNELRELEASE) $(mixed-build-prefix)
20732061
20742062 # read saved command lines for existing targets
20752063 existing-targets := $(wildcard $(sort $(targets)))