Subject: linux-next: manual merge of the rust tree with the block tree

From: Stephen Rothwell <[email-masked]>
Date: Tue, 14 Jun 2022 13:21:41 +1000

Hi all,

Today's linux-next merge of the rust tree got a conflict in:

  Makefile

between commit:

  197c5e8c9541 ("io_uring: move to separate directory")

from the block tree and commit:

  0ea4b9a1bece ("Kbuild: add Rust support")

from the rust tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc Makefile
index f4c1c37c0be6,ce17ec71f89b..000000000000
--- a/Makefile
+++ b/Makefile
@@@ -436,7 -445,7 +445,8 @@@ els
  HOSTCC	= gcc
  HOSTCXX	= g++
  endif
 +HOSTPKG_CONFIG	= pkg-config
+ HOSTRUSTC = rustc
  
  KBUILD_USERHOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \
  			 -O2 -fomit-frame-pointer -std=gnu11 \
@@@ -534,7 -580,23 +581,23 @@@ KBUILD_LDFLAGS_MODULE :
  KBUILD_LDFLAGS :=
  CLANG_FLAGS :=
  
+ ifeq ($(KBUILD_CLIPPY),1)
+ 	RUSTC_OR_CLIPPY_QUIET := CLIPPY
+ 	RUSTC_OR_CLIPPY = $(CLIPPY_DRIVER)
+ else
+ 	RUSTC_OR_CLIPPY_QUIET := RUSTC
+ 	RUSTC_OR_CLIPPY = $(RUSTC)
+ endif
+ 
+ ifdef RUST_LIB_SRC
+ 	export RUST_LIB_SRC
+ endif
+ 
+ export RUSTC_BOOTSTRAP := 1
+ 
 -export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC
 +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 CARGO
+ 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
  export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ ZSTD
@@@ -788,9 -867,11 +868,12 @@@ stackp-flags-$(CONFIG_STACKPROTECTOR_ST
  KBUILD_CFLAGS += $(stackp-flags-y)
  
  KBUILD_CFLAGS-$(CONFIG_WERROR) += -Werror
 +KBUILD_CFLAGS-$(CONFIG_CC_NO_ARRAY_BOUNDS) += -Wno-array-bounds
  KBUILD_CFLAGS += $(KBUILD_CFLAGS-y) $(CONFIG_CC_IMPLICIT_FALLTHROUGH)
  
+ KBUILD_RUSTFLAGS-$(CONFIG_WERROR) += -Dwarnings
+ KBUILD_RUSTFLAGS += $(KBUILD_RUSTFLAGS-y)
+ 
  ifdef CONFIG_CC_IS_CLANG
  KBUILD_CPPFLAGS += -Qunused-arguments
  # The kernel builds with '-std=gnu11' so use of GNU extensions is acceptable.
@@@ -806,11 -887,9 +889,12 @@@ endi
  KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
  KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
  
 +# These result in bogus false positives
 +KBUILD_CFLAGS += $(call cc-disable-warning, dangling-pointer)
 +
  ifdef CONFIG_FRAME_POINTER
  KBUILD_CFLAGS	+= -fno-omit-frame-pointer -fno-optimize-sibling-calls
+ KBUILD_RUSTFLAGS += -Cforce-frame-pointers=y
  else
  # Some targets (ARM with Thumb2, for example), can't be built with frame
  # pointers.  For those, we don't have FUNCTION_TRACER automatically
@@@ -1097,7 -1180,7 +1186,8 @@@ export MODULES_NSDEPS := $(extmod_prefi
  ifeq ($(KBUILD_EXTMOD),)
  core-y			+= kernel/ certs/ mm/ fs/ ipc/ security/ crypto/
  core-$(CONFIG_BLOCK)	+= block/
 +core-$(CONFIG_IO_URING)	+= io_uring/
+ core-$(CONFIG_RUST)	+= rust/
  
  vmlinux-dirs	:= $(patsubst %/,%,$(filter %/, \
  		     $(core-y) $(core-m) $(drivers-y) $(drivers-m) \