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

From: Stephen Rothwell <[email-masked]>
Date: Mon, 15 Aug 2022 09:08:24 +1000

Hi all,

On Wed,  3 Aug 2022 00:38:44 +0100 [email-masked] wrote:
>
> Today's linux-next merge of the rust tree got a conflict in:
> 
>   Makefile
> 
> between commit:
> 
>   a6036a41bffba ("kbuild: drop support for CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3")
> 
> from the kbuild tree and commit:
> 
>   fe24902ba8765 ("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.
> 
> diff --cc Makefile
> index 60a7e3e8b4787,cd1d545f316bc..0000000000000
> --- a/Makefile
> +++ b/Makefile
> @@@ -758,10 -819,20 +822,17 @@@ KBUILD_CFLAGS	+= $(call cc-disable-warn
>   
>   ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE
>   KBUILD_CFLAGS += -O2
> + KBUILD_RUSTFLAGS += -Copt-level=2
>  -else ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3
>  -KBUILD_CFLAGS += -O3
>  -KBUILD_RUSTFLAGS += -Copt-level=3
>   else ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
>   KBUILD_CFLAGS += -Os
> + KBUILD_RUSTFLAGS += -Copt-level=s
>   endif
>   
> + # Always set `debug-assertions` and `overflow-checks` because their default
> + # depends on `opt-level` and `debug-assertions`, respectively.
> + KBUILD_RUSTFLAGS += -Cdebug-assertions=$(if $(CONFIG_RUST_DEBUG_ASSERTIONS),y,n)
> + KBUILD_RUSTFLAGS += -Coverflow-checks=$(if $(CONFIG_RUST_OVERFLOW_CHECKS),y,n)
> + 
>   # Tell gcc to never replace conditional load with a non-conditional one
>   ifdef CONFIG_CC_IS_GCC
>   # gcc-10 renamed --param=allow-store-data-races=0 to
> @@@ -1098,7 -1178,7 +1178,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) \

This is now a conflict between the rust tree and Linus' tree.

-- 
Cheers,
Stephen Rothwell