diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 76 |
1 files changed, 58 insertions, 18 deletions
@@ -1,8 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 7 -PATCHLEVEL = 0 +PATCHLEVEL = 1 SUBLEVEL = 0 -EXTRAVERSION = -rc2 +EXTRAVERSION = -rc1 NAME = Baby Opossum Posse # *DOCUMENTATION* @@ -476,6 +476,7 @@ KBUILD_USERLDFLAGS := $(USERLDFLAGS) export rust_common_flags := --edition=2021 \ -Zbinary_dep_depinfo=y \ -Astable_features \ + -Aunused_features \ -Dnon_ascii_idents \ -Dunsafe_op_in_unsafe_fn \ -Wmissing_docs \ @@ -486,6 +487,7 @@ export rust_common_flags := --edition=2021 \ -Wclippy::as_underscore \ -Wclippy::cast_lossless \ -Wclippy::ignored_unit_patterns \ + -Aclippy::incompatible_msrv \ -Wclippy::mut_mut \ -Wclippy::needless_bitwise_bool \ -Aclippy::needless_lifetimes \ @@ -494,6 +496,7 @@ export rust_common_flags := --edition=2021 \ -Wclippy::ptr_cast_constness \ -Wclippy::ref_as_ptr \ -Wclippy::undocumented_unsafe_blocks \ + -Aclippy::uninlined_format_args \ -Wclippy::unnecessary_safety_comment \ -Wclippy::unnecessary_safety_doc \ -Wrustdoc::missing_crate_level_docs \ @@ -504,7 +507,7 @@ KBUILD_HOSTCFLAGS := $(KBUILD_USERHOSTCFLAGS) $(HOST_LFS_CFLAGS) \ KBUILD_HOSTCXXFLAGS := -Wall -O2 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS) \ -I $(srctree)/scripts/include KBUILD_HOSTRUSTFLAGS := $(rust_common_flags) -O -Cstrip=debuginfo \ - -Zallow-features= $(HOSTRUSTFLAGS) + -Zallow-features= KBUILD_HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS) KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) $(HOSTLDLIBS) KBUILD_PROCMACROLDFLAGS := $(or $(PROCMACROLDFLAGS),$(KBUILD_HOSTLDFLAGS)) @@ -515,6 +518,7 @@ ifneq ($(LLVM),) CC = $(LLVM_PREFIX)clang$(LLVM_SUFFIX) LD = $(LLVM_PREFIX)ld.lld$(LLVM_SUFFIX) AR = $(LLVM_PREFIX)llvm-ar$(LLVM_SUFFIX) +LLVM_LINK = $(LLVM_PREFIX)llvm-link$(LLVM_SUFFIX) NM = $(LLVM_PREFIX)llvm-nm$(LLVM_SUFFIX) OBJCOPY = $(LLVM_PREFIX)llvm-objcopy$(LLVM_SUFFIX) OBJDUMP = $(LLVM_PREFIX)llvm-objdump$(LLVM_SUFFIX) @@ -587,7 +591,6 @@ LINUXINCLUDE := \ KBUILD_AFLAGS := -D__ASSEMBLY__ -fno-PIE KBUILD_CFLAGS := -KBUILD_CFLAGS += -std=gnu11 KBUILD_CFLAGS += -fshort-wchar KBUILD_CFLAGS += -funsigned-char KBUILD_CFLAGS += -fno-common @@ -628,7 +631,7 @@ export RUSTC_BOOTSTRAP := 1 export CLIPPY_CONF_DIR := $(srctree) export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC HOSTPKG_CONFIG -export RUSTC RUSTDOC RUSTFMT RUSTC_OR_CLIPPY_QUIET RUSTC_OR_CLIPPY BINDGEN +export RUSTC RUSTDOC RUSTFMT RUSTC_OR_CLIPPY_QUIET RUSTC_OR_CLIPPY BINDGEN LLVM_LINK export HOSTRUSTC KBUILD_HOSTRUSTFLAGS export CPP AR NM STRIP OBJCOPY OBJDUMP READELF PAHOLE RESOLVE_BTFIDS LEX YACC AWK INSTALLKERNEL export PERL PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX @@ -654,6 +657,8 @@ export RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o \ # Basic helpers built in scripts/basic/ PHONY += scripts_basic +scripts_basic: KBUILD_HOSTCFLAGS := $(KBUILD_HOSTCFLAGS) +scripts_basic: KBUILD_HOSTLDFLAGS := $(KBUILD_HOSTLDFLAGS) scripts_basic: $(Q)$(MAKE) $(build)=scripts/basic @@ -676,14 +681,19 @@ print_env_for_makefile = \ echo "export KBUILD_OUTPUT = $(CURDIR)" endif -quiet_cmd_makefile = GEN Makefile - cmd_makefile = { \ +filechk_makefile = { \ echo "\# Automatically generated by $(abs_srctree)/Makefile: don't edit"; \ $(print_env_for_makefile); \ echo "include $(abs_srctree)/Makefile"; \ - } > Makefile + } -outputmakefile: +$(objtree)/Makefile: FORCE + $(call filechk,makefile) + +# Prevent $(srcroot)/Makefile from inhibiting the rule to run. +PHONY += $(objtree)/Makefile + +outputmakefile: $(objtree)/Makefile ifeq ($(KBUILD_EXTMOD),) @if [ -f $(srctree)/.config -o \ -d $(srctree)/include/config -o \ @@ -704,7 +714,6 @@ else fi endif $(Q)ln -fsn $(srcroot) source - $(call cmd,makefile) $(Q)test -e .gitignore || \ { echo "# this is build directory, ignore it"; echo "*"; } > .gitignore endif @@ -790,6 +799,18 @@ ifdef need-config include $(objtree)/include/config/auto.conf endif +CC_FLAGS_DIALECT := -std=gnu11 +# Allow including a tagged struct or union anonymously in another struct/union. +CC_FLAGS_DIALECT += $(CONFIG_CC_MS_EXTENSIONS) +# Clang enables warnings about GNU and Microsoft extensions by default, disable +# them because this is expected with the above options. +ifdef CONFIG_CC_IS_CLANG +CC_FLAGS_DIALECT += -Wno-gnu +CC_FLAGS_DIALECT += -Wno-microsoft-anon-tag +endif +export CC_FLAGS_DIALECT +KBUILD_CFLAGS += $(CC_FLAGS_DIALECT) + ifeq ($(KBUILD_EXTMOD),) # Objects we will link into vmlinux / subdirs we need to visit core-y := @@ -833,6 +854,20 @@ endif # CONFIG_TRACEPOINTS export WARN_ON_UNUSED_TRACEPOINTS +# Per-version Rust flags. These are like `rust_common_flags`, but may +# depend on the Rust compiler version (e.g. using `rustc-min-version`). +# +# `-Aclippy::precedence`: the lint was extended in Rust 1.85.0 to +# include bitmasking and shift operations. However, because it generated +# many hits, in Rust 1.86.0 it was split into a new `precedence_bits` +# lint which is not enabled by default. +rust_common_flags_per_version := \ + $(if $(call rustc-min-version,108600),,-Aclippy::precedence) + +rust_common_flags += $(rust_common_flags_per_version) +KBUILD_HOSTRUSTFLAGS += $(rust_common_flags_per_version) $(HOSTRUSTFLAGS) +KBUILD_RUSTFLAGS += $(rust_common_flags_per_version) + include $(srctree)/arch/$(SRCARCH)/Makefile ifdef need-config @@ -972,6 +1007,10 @@ KBUILD_CFLAGS += $(call cc-option, -fno-stack-clash-protection) # Get details on warnings generated due to GCC value tracking. KBUILD_CFLAGS += $(call cc-option, -fdiagnostics-show-context=2) +# Show inlining notes for __attribute__((warning/error)) call chains. +# GCC supports this unconditionally while Clang 23+ provides a flag. +KBUILD_CFLAGS += $(call cc-option, -fdiagnostics-show-inlining-chain) + # Clear used registers at func exit (to reduce data lifetime and ROP gadgets). ifdef CONFIG_ZERO_CALL_USED_REGS KBUILD_CFLAGS += -fzero-call-used-regs=used-gpr @@ -1034,6 +1073,7 @@ endif ifdef CONFIG_LTO_CLANG ifdef CONFIG_LTO_CLANG_THIN CC_FLAGS_LTO := -flto=thin -fsplit-lto-unit +KBUILD_LDFLAGS += $(call ld-option,--lto-whole-program-visibility -mllvm -always-rename-promoted-locals=false) else CC_FLAGS_LTO := -flto endif @@ -1093,9 +1133,6 @@ NOSTDINC_FLAGS += -nostdinc # perform bounds checking. KBUILD_CFLAGS += $(call cc-option, -fstrict-flex-arrays=3) -# Allow including a tagged struct or union anonymously in another struct/union. -KBUILD_CFLAGS += -fms-extensions - # disable invalid "can't wrap" optimizations for signed / pointers KBUILD_CFLAGS += -fno-strict-overflow @@ -1113,6 +1150,9 @@ KBUILD_CFLAGS += -fno-builtin-wcslen # change __FILE__ to the relative path to the source directory ifdef building_out_of_srctree KBUILD_CPPFLAGS += -fmacro-prefix-map=$(srcroot)/= +ifeq ($(call rustc-option-yn, --remap-path-scope=macro),y) +KBUILD_RUSTFLAGS += --remap-path-prefix=$(srcroot)/= --remap-path-scope=macro +endif endif # include additional Makefiles when needed @@ -1497,13 +1537,13 @@ ifneq ($(wildcard $(resolve_btfids_O)),) $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(resolve_btfids_O) clean endif -PHONY += objtool_clean +PHONY += objtool_clean objtool_mrproper objtool_O = $(abspath $(objtree))/tools/objtool -objtool_clean: +objtool_clean objtool_mrproper: ifneq ($(wildcard $(objtool_O)),) - $(Q)$(MAKE) -sC $(abs_srctree)/tools/objtool O=$(objtool_O) srctree=$(abs_srctree) clean + $(Q)$(MAKE) -sC $(abs_srctree)/tools/objtool O=$(objtool_O) srctree=$(abs_srctree) $(patsubst objtool_%,%,$@) endif tools/: FORCE @@ -1650,7 +1690,7 @@ CLEAN_FILES += vmlinux.symvers modules-only.symvers \ modules.builtin.ranges vmlinux.o.map vmlinux.unstripped \ compile_commands.json rust/test \ rust-project.json .vmlinux.objs .vmlinux.export.c \ - .builtin-dtbs-list .builtin-dtb.S + .builtin-dtbs-list .builtin-dtbs.S # Directories & files removed with 'make mrproper' MRPROPER_FILES += include/config include/generated \ @@ -1686,7 +1726,7 @@ PHONY += $(mrproper-dirs) mrproper $(mrproper-dirs): $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@) -mrproper: clean $(mrproper-dirs) +mrproper: clean objtool_mrproper $(mrproper-dirs) $(call cmd,rmfiles) @find . $(RCS_FIND_IGNORE) \ \( -name '*.rmeta' \) \ |
