Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'rust-fixes-6.12-2' of https://github.com/Rust-for-Linux/linux

Pull rust fixes from Miguel Ojeda:
"Toolchain and infrastructure:

- Fix several issues with the 'rustc-option' macro. It includes a
refactor from Masahiro of three '{cc,rust}-*' macros, which is not
a fix but avoids repeating the same commands (which would be
several lines in the case of 'rustc-option').

- Fix conditions for 'CONFIG_HAVE_CFI_ICALL_NORMALIZE_INTEGERS'. It
includes the addition of 'CONFIG_RUSTC_LLVM_VERSION', which is not
a fix but is needed for the actual fix.

And a trivial grammar fix"

* tag 'rust-fixes-6.12-2' of https://github.com/Rust-for-Linux/linux:
cfi: fix conditions for HAVE_CFI_ICALL_NORMALIZE_INTEGERS
kbuild: rust: add `CONFIG_RUSTC_LLVM_VERSION`
kbuild: fix issues with rustc-option
kbuild: refactor cc-option-yn, cc-disable-warning, rust-option-yn macros
lib/Kconfig.debug: fix grammar in RUST_BUILD_ASSERT_ALLOW

+51 -24
+12 -14
arch/Kconfig
··· 838 838 config CFI_ICALL_NORMALIZE_INTEGERS 839 839 bool "Normalize CFI tags for integers" 840 840 depends on CFI_CLANG 841 - depends on HAVE_CFI_ICALL_NORMALIZE_INTEGERS 841 + depends on HAVE_CFI_ICALL_NORMALIZE_INTEGERS_CLANG 842 842 help 843 843 This option normalizes the CFI tags for integer types so that all 844 844 integer types of the same size and signedness receive the same CFI ··· 851 851 852 852 This option is necessary for using CFI with Rust. If unsure, say N. 853 853 854 - config HAVE_CFI_ICALL_NORMALIZE_INTEGERS 855 - def_bool !GCOV_KERNEL && !KASAN 856 - depends on CFI_CLANG 854 + config HAVE_CFI_ICALL_NORMALIZE_INTEGERS_CLANG 855 + def_bool y 857 856 depends on $(cc-option,-fsanitize=kcfi -fsanitize-cfi-icall-experimental-normalize-integers) 858 - help 859 - Is CFI_ICALL_NORMALIZE_INTEGERS supported with the set of compilers 860 - currently in use? 857 + # With GCOV/KASAN we need this fix: https://github.com/llvm/llvm-project/pull/104826 858 + depends on CLANG_VERSION >= 190000 || (!GCOV_KERNEL && !KASAN_GENERIC && !KASAN_SW_TAGS) 861 859 862 - This option defaults to false if GCOV or KASAN is enabled, as there is 863 - an LLVM bug that makes normalized integers tags incompatible with 864 - KASAN and GCOV. Kconfig currently does not have the infrastructure to 865 - detect whether your rustc compiler contains the fix for this bug, so 866 - it is assumed that it doesn't. If your compiler has the fix, you can 867 - explicitly enable this option in your config file. The Kconfig logic 868 - needed to detect this will be added in a future kernel release. 860 + config HAVE_CFI_ICALL_NORMALIZE_INTEGERS_RUSTC 861 + def_bool y 862 + depends on HAVE_CFI_ICALL_NORMALIZE_INTEGERS_CLANG 863 + depends on RUSTC_VERSION >= 107900 864 + # With GCOV/KASAN we need this fix: https://github.com/rust-lang/rust/pull/129373 865 + depends on (RUSTC_LLVM_VERSION >= 190000 && RUSTC_VERSION >= 108200) || \ 866 + (!GCOV_KERNEL && !KASAN_GENERIC && !KASAN_SW_TAGS) 869 867 870 868 config CFI_PERMISSIVE 871 869 bool "Use CFI in permissive mode"
+6 -2
init/Kconfig
··· 62 62 63 63 config RUSTC_VERSION 64 64 int 65 - default $(shell,$(srctree)/scripts/rustc-version.sh $(RUSTC)) 65 + default $(rustc-version) 66 66 help 67 67 It does not depend on `RUST` since that one may need to use the version 68 68 in a `depends on`. ··· 77 77 78 78 In particular, the Makefile target 'rustavailable' is useful to check 79 79 why the Rust toolchain is not being detected. 80 + 81 + config RUSTC_LLVM_VERSION 82 + int 83 + default $(rustc-llvm-version) 80 84 81 85 config CC_CAN_LINK 82 86 bool ··· 1950 1946 depends on !GCC_PLUGIN_RANDSTRUCT 1951 1947 depends on !RANDSTRUCT 1952 1948 depends on !DEBUG_INFO_BTF || PAHOLE_HAS_LANG_EXCLUDE 1953 - depends on !CFI_CLANG || RUSTC_VERSION >= 107900 && HAVE_CFI_ICALL_NORMALIZE_INTEGERS 1949 + depends on !CFI_CLANG || HAVE_CFI_ICALL_NORMALIZE_INTEGERS_RUSTC 1954 1950 select CFI_ICALL_NORMALIZE_INTEGERS if CFI_CLANG 1955 1951 depends on !CALL_PADDING || RUSTC_VERSION >= 108100 1956 1952 depends on !KASAN_SW_TAGS
+1 -1
lib/Kconfig.debug
··· 3060 3060 bool "Allow unoptimized build-time assertions" 3061 3061 depends on RUST 3062 3062 help 3063 - Controls how are `build_error!` and `build_assert!` handled during build. 3063 + Controls how `build_error!` and `build_assert!` are handled during the build. 3064 3064 3065 3065 If calls to them exist in the binary, it may indicate a violated invariant 3066 3066 or that the optimizer failed to verify the invariant during compilation.
+3
scripts/Kconfig.include
··· 65 65 m32-flag := $(cc-option-bit,-m32) 66 66 m64-flag := $(cc-option-bit,-m64) 67 67 68 + rustc-version := $(shell,$(srctree)/scripts/rustc-version.sh $(RUSTC)) 69 + rustc-llvm-version := $(shell,$(srctree)/scripts/rustc-llvm-version.sh $(RUSTC)) 70 + 68 71 # $(rustc-option,<flag>) 69 72 # Return y if the Rust compiler supports <flag>, n otherwise 70 73 # Calls to this should be guarded so that they are not evaluated if
+7 -7
scripts/Makefile.compiler
··· 53 53 54 54 # cc-option-yn 55 55 # Usage: flag := $(call cc-option-yn,-march=winchip-c6) 56 - cc-option-yn = $(call try-run,\ 57 - $(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n) 56 + cc-option-yn = $(if $(call cc-option,$1),y,n) 58 57 59 58 # cc-disable-warning 60 59 # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable) 61 - cc-disable-warning = $(call try-run,\ 62 - $(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) 60 + cc-disable-warning = $(if $(call cc-option,-W$(strip $1)),-Wno-$(strip $1)) 63 61 64 62 # gcc-min-version 65 63 # Usage: cflags-$(call gcc-min-version, 70100) += -foo ··· 73 75 74 76 # __rustc-option 75 77 # Usage: MY_RUSTFLAGS += $(call __rustc-option,$(RUSTC),$(MY_RUSTFLAGS),-Cinstrument-coverage,-Zinstrument-coverage) 78 + # TODO: remove RUSTC_BOOTSTRAP=1 when we raise the minimum GNU Make version to 4.4 76 79 __rustc-option = $(call try-run,\ 77 - $(1) $(2) $(3) --crate-type=rlib /dev/null --out-dir=$$TMPOUT -o "$$TMP",$(3),$(4)) 80 + echo '#![allow(missing_docs)]#![feature(no_core)]#![no_core]' | RUSTC_BOOTSTRAP=1\ 81 + $(1) --sysroot=/dev/null $(filter-out --sysroot=/dev/null,$(2)) $(3)\ 82 + --crate-type=rlib --out-dir=$(TMPOUT) --emit=obj=- - >/dev/null,$(3),$(4)) 78 83 79 84 # rustc-option 80 85 # Usage: rustflags-y += $(call rustc-option,-Cinstrument-coverage,-Zinstrument-coverage) ··· 86 85 87 86 # rustc-option-yn 88 87 # Usage: flag := $(call rustc-option-yn,-Cinstrument-coverage) 89 - rustc-option-yn = $(call try-run,\ 90 - $(RUSTC) $(KBUILD_RUSTFLAGS) $(1) --crate-type=rlib /dev/null --out-dir=$$TMPOUT -o "$$TMP",y,n) 88 + rustc-option-yn = $(if $(call rustc-option,$1),y,n)
+22
scripts/rustc-llvm-version.sh
··· 1 + #!/bin/sh 2 + # SPDX-License-Identifier: GPL-2.0 3 + # 4 + # Usage: $ ./rustc-llvm-version.sh rustc 5 + # 6 + # Print the LLVM version that the Rust compiler uses in a 6 digit form. 7 + 8 + # Convert the version string x.y.z to a canonical up-to-6-digits form. 9 + get_canonical_version() 10 + { 11 + IFS=. 12 + set -- $1 13 + echo $((10000 * $1 + 100 * $2 + $3)) 14 + } 15 + 16 + if output=$("$@" --version --verbose 2>/dev/null | grep LLVM); then 17 + set -- $output 18 + get_canonical_version $3 19 + else 20 + echo 0 21 + exit 1 22 + fi