All of lore.kernel.org
 help / color / mirror / Atom feed
* linux-next: manual merge of the rust tree with the kbuild tree
@ 2021-10-15  7:24 Stephen Rothwell
  2021-10-15 12:24 ` Miguel Ojeda
  2021-10-28  9:09 ` Stephen Rothwell
  0 siblings, 2 replies; 28+ messages in thread
From: Stephen Rothwell @ 2021-10-15  7:24 UTC (permalink / raw)
  To: Miguel Ojeda, Masahiro Yamada
  Cc: Adam Bratschi-Kaye, Alex Gaynor, Ayaan Zaidi, Boqun Feng,
	Boris-Chengbiao Zhou, Douglas Su, Finn Behrens, Fox Chen,
	Gary Guo, Geoffrey Thomas, Linux Kernel Mailing List,
	Linux Next Mailing List, Michael Ellerman, Miguel Ojeda,
	Sumera Priyadarsini, Sven Van Asbroeck, Wedson Almeida Filho,
	Yuki Okushi

[-- Attachment #1: Type: text/plain, Size: 2132 bytes --]

Hi all,

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

  Makefile

between commit:

  09708df61f2b ("kbuild: split DEBUG_CFLAGS out to scripts/Makefile.debug")

from the kbuild tree and commit:

  dc08d49444e9 ("Kbuild: add Rust support")

from the rust tree.

I fixed it up (I used the Makefile conflicting part from the former and
applied the patch 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.

Miguel,  it might be worth do a back merge of v5.14 (or maybe even
v5.15-rc1) to fix up the old conflicts ... If you do that, though,
please don't use github's GUI to do it, do it in your own git tree,
include a good commit message in the merge commit (saying why you did
the merge), and push it up to git hub.

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Fri, 15 Oct 2021 18:16:09 +1100
Subject: [PATCH] Kbuild: fix for "kbuild: split DEBUG_CFLAGS out to scripts/Makefile.debug"

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 scripts/Makefile.debug | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/scripts/Makefile.debug b/scripts/Makefile.debug
index 9f39b0130551..ad9308a08240 100644
--- a/scripts/Makefile.debug
+++ b/scripts/Makefile.debug
@@ -1,4 +1,5 @@
 DEBUG_CFLAGS	:=
+DEBUG_RUSTFLAGS :=
 
 ifdef CONFIG_DEBUG_INFO_SPLIT
 DEBUG_CFLAGS	+= -gsplit-dwarf
@@ -8,6 +9,11 @@ endif
 
 ifndef CONFIG_AS_IS_LLVM
 KBUILD_AFLAGS	+= -Wa,-gdwarf-2
+ifdef CONFIG_DEBUG_INFO_REDUCED
+DEBUG_RUSTFLAGS += -Cdebuginfo=1
+else
+DEBUG_RUSTFLAGS += -Cdebuginfo=2
+endif
 endif
 
 ifndef CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
@@ -31,3 +37,6 @@ endif
 
 KBUILD_CFLAGS += $(DEBUG_CFLAGS)
 export DEBUG_CFLAGS
+
+KBUILD_RUSTFLAGS += $(DEBUG_RUSTFLAGS)
+export DEBUG_RUSTFLAGS
-- 
2.33.0

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: linux-next: manual merge of the rust tree with the kbuild tree
  2021-10-15  7:24 linux-next: manual merge of the rust tree with the kbuild tree Stephen Rothwell
@ 2021-10-15 12:24 ` Miguel Ojeda
  2021-10-28  9:09 ` Stephen Rothwell
  1 sibling, 0 replies; 28+ messages in thread
From: Miguel Ojeda @ 2021-10-15 12:24 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Masahiro Yamada, Adam Bratschi-Kaye, Alex Gaynor, Ayaan Zaidi,
	Boqun Feng, Boris-Chengbiao Zhou, Douglas Su, Finn Behrens,
	Fox Chen, Gary Guo, Geoffrey Thomas, Linux Kernel Mailing List,
	Linux Next Mailing List, Michael Ellerman, Miguel Ojeda,
	Sumera Priyadarsini, Sven Van Asbroeck, Wedson Almeida Filho,
	Yuki Okushi

Hi Stephen,

On Fri, Oct 15, 2021 at 9:24 AM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Miguel,  it might be worth do a back merge of v5.14 (or maybe even
> v5.15-rc1) to fix up the old conflicts ... If you do that, though,
> please don't use github's GUI to do it, do it in your own git tree,
> include a good commit message in the merge commit (saying why you did
> the merge), and push it up to git hub.

Yeah, the last release has been rough on conflicts. I will move the
new code to rust-next for your Monday run (based onto -rc5) -- there
has been some changes since last time and I already have it in sync in
our internal branch. Thanks for keeping up with all the conflicts!

As for GitHub, thanks for the warning! We only use the GUI for
internal development only; for the -next branch I prepare it manually.
I will also rearrange things to follow a normal kernel process when we
hit mainline.

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: linux-next: manual merge of the rust tree with the kbuild tree
  2021-10-15  7:24 linux-next: manual merge of the rust tree with the kbuild tree Stephen Rothwell
  2021-10-15 12:24 ` Miguel Ojeda
@ 2021-10-28  9:09 ` Stephen Rothwell
  2021-10-28 11:06   ` Miguel Ojeda
  1 sibling, 1 reply; 28+ messages in thread
From: Stephen Rothwell @ 2021-10-28  9:09 UTC (permalink / raw)
  To: Miguel Ojeda, Masahiro Yamada
  Cc: Adam Bratschi-Kaye, Alex Gaynor, Ayaan Zaidi, Boqun Feng,
	Boris-Chengbiao Zhou, Douglas Su, Finn Behrens, Fox Chen,
	Gary Guo, Geoffrey Thomas, Linux Kernel Mailing List,
	Linux Next Mailing List, Michael Ellerman, Miguel Ojeda,
	Sumera Priyadarsini, Sven Van Asbroeck, Wedson Almeida Filho,
	Yuki Okushi

[-- Attachment #1: Type: text/plain, Size: 2079 bytes --]

Hi all,

On Fri, 15 Oct 2021 18:24:04 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Today's linux-next merge of the rust tree got a conflict in:
> 
>   Makefile
> 
> between commit:
> 
>   09708df61f2b ("kbuild: split DEBUG_CFLAGS out to scripts/Makefile.debug")
> 
> from the kbuild tree and commit:
> 
>   dc08d49444e9 ("Kbuild: add Rust support")
> 
> from the rust tree.
> 
> I fixed it up (I used the Makefile conflicting part from the former and
> applied the patch 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.

The fixup patch now looks like this:

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Fri, 15 Oct 2021 18:16:09 +1100
Subject: [PATCH] Kbuild: fix for "kbuild: split DEBUG_CFLAGS out to
 scripts/Makefile.debug"

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 scripts/Makefile.debug | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/scripts/Makefile.debug b/scripts/Makefile.debug
index 9f39b0130551..c664af3ccc6b 100644
--- a/scripts/Makefile.debug
+++ b/scripts/Makefile.debug
@@ -1,4 +1,5 @@
 DEBUG_CFLAGS	:=
+DEBUG_RUSTFLAGS :=
 
 ifdef CONFIG_DEBUG_INFO_SPLIT
 DEBUG_CFLAGS	+= -gsplit-dwarf
@@ -10,6 +11,12 @@ ifndef CONFIG_AS_IS_LLVM
 KBUILD_AFLAGS	+= -Wa,-gdwarf-2
 endif
 
+ifdef CONFIG_DEBUG_INFO_REDUCED
+DEBUG_RUSTFLAGS += -Cdebuginfo=1
+else
+DEBUG_RUSTFLAGS += -Cdebuginfo=2
+endif
+
 ifndef CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
 dwarf-version-$(CONFIG_DEBUG_INFO_DWARF4) := 4
 dwarf-version-$(CONFIG_DEBUG_INFO_DWARF5) := 5
@@ -31,3 +38,6 @@ endif
 
 KBUILD_CFLAGS += $(DEBUG_CFLAGS)
 export DEBUG_CFLAGS
+
+KBUILD_RUSTFLAGS += $(DEBUG_RUSTFLAGS)
+export DEBUG_RUSTFLAGS
-- 
2.33.0

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: linux-next: manual merge of the rust tree with the kbuild tree
  2021-10-28  9:09 ` Stephen Rothwell
@ 2021-10-28 11:06   ` Miguel Ojeda
  0 siblings, 0 replies; 28+ messages in thread
From: Miguel Ojeda @ 2021-10-28 11:06 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Masahiro Yamada, Adam Bratschi-Kaye, Alex Gaynor, Ayaan Zaidi,
	Boqun Feng, Boris-Chengbiao Zhou, Douglas Su, Finn Behrens,
	Fox Chen, Gary Guo, Geoffrey Thomas, Linux Kernel Mailing List,
	Linux Next Mailing List, Michael Ellerman, Miguel Ojeda,
	Sumera Priyadarsini, Sven Van Asbroeck, Wedson Almeida Filho,
	Yuki Okushi

Hi Stephen,

On Thu, Oct 28, 2021 at 11:09 AM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> The fixup patch now looks like this:

Looks correct, thanks!

(This was triggered due to my rebase tonight which contained a fix for
an `endif` in the vicinity)

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: linux-next: manual merge of the rust tree with the kbuild tree
  2022-09-27 18:16 broonie
  2022-09-28 17:16 ` Miguel Ojeda
@ 2022-10-04 22:23 ` Stephen Rothwell
  1 sibling, 0 replies; 28+ messages in thread
From: Stephen Rothwell @ 2022-10-04 22:23 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: broonie, Miguel Ojeda, Adam Bratschi-Kaye, Alex Gaynor,
	Antonio Terceiro, Björn Roy Baron, Boqun Feng,
	Boris-Chengbiao Zhou, Daniel Xu, Dariusz Sosnowski, Douglas Su,
	Finn Behrens, Gary Guo, Linux Kernel Mailing List,
	Linux Next Mailing List, Martin Rodriguez Reboredo,
	Michael Ellerman, Miguel Ojeda, Sven Van Asbroeck,
	Wedson Almeida Filho

[-- Attachment #1: Type: text/plain, Size: 3290 bytes --]

Hi all,

On Tue, 27 Sep 2022 19:16:47 +0100 broonie@kernel.org wrote:
>
> Today's linux-next merge of the rust tree got a conflict in:
> 
>   Makefile
> 
> between commit:
> 
>   0cc1b22fa606e ("kbuild: list sub-directories in ./Kbuild")
>   ca5f20da2ffcb ("kbuild: move .vmlinux.objs rule to Makefile.modpost")
> 
> from the kbuild tree and commit:
> 
>   d64ddbd68af8f ("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 2b4980490ecb2,c759ee3152544..0000000000000
> --- a/Makefile
> +++ b/Makefile
> @@@ -789,7 -862,11 +861,10 @@@ 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.
> @@@ -1098,9 -1182,16 +1179,8 @@@ export MODORDER := $(extmod_prefix)modu
>   export MODULES_NSDEPS := $(extmod_prefix)modules.nsdeps
>   
>   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) \
>  -		     $(libs-y) $(libs-m)))
> --
>  -vmlinux-alldirs	:= $(sort $(vmlinux-dirs) Documentation \
>  +build-dir	:= .
>  +clean-dirs	:= $(sort . Documentation \
>   		     $(patsubst %/,%,$(filter %/, $(core-) \
>   			$(drivers-) $(libs-))))
>   
> @@@ -1497,7 -1585,7 +1581,8 @@@ endif # CONFIG_MODULE
>   # Directories & files removed with 'make clean'
>   CLEAN_FILES += include/ksym vmlinux.symvers modules-only.symvers \
>   	       modules.builtin modules.builtin.modinfo modules.nsdeps \
> - 	       compile_commands.json .thinlto-cache .vmlinux.objs
>  -	       compile_commands.json .thinlto-cache rust/test rust/doc
> ++	       compile_commands.json .thinlto-cache .vmlinux.objs \
> ++	       rust/test rust/doc
>   
>   # Directories & files removed with 'make mrproper'
>   MRPROPER_FILES += include/config include/generated          \
> diff --git a/Kbuild b/Kbuild
> index 8a37584d1fd6b..5f4a23fc87b63 100644
> --- a/Kbuild
> +++ b/Kbuild
> @@ -91,6 +91,7 @@ obj-$(CONFIG_BLOCK)	+= block/
>  obj-$(CONFIG_IO_URING)	+= io_uring/
>  obj-y			+= $(ARCH_LIB)
>  obj-y			+= drivers/
> +obj-$(CONFIG_RUST)	+= rust/
>  obj-y			+= sound/
>  obj-$(CONFIG_SAMPLES)	+= samples/
>  obj-$(CONFIG_NET)	+= net/

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

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: linux-next: manual merge of the rust tree with the kbuild tree
  2022-09-27 18:16 broonie
@ 2022-09-28 17:16 ` Miguel Ojeda
  2022-10-04 22:23 ` Stephen Rothwell
  1 sibling, 0 replies; 28+ messages in thread
From: Miguel Ojeda @ 2022-09-28 17:16 UTC (permalink / raw)
  To: broonie
  Cc: Adam Bratschi-Kaye, Alex Gaynor, Antonio Terceiro,
	Björn Roy Baron, Boqun Feng, Boris-Chengbiao Zhou,
	Daniel Xu, Dariusz Sosnowski, Douglas Su, Finn Behrens, Gary Guo,
	Linux Kernel Mailing List, Linux Next Mailing List,
	Martin Rodriguez Reboredo, Masahiro Yamada, Michael Ellerman,
	Miguel Ojeda, Sven Van Asbroeck, Wedson Almeida Filho

On Tue, Sep 27, 2022 at 8:16 PM <broonie@kernel.org> wrote:
>
> I fixed it up (see below) and can carry the fix as necessary. This

Build-tested it -- works, thanks!

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* linux-next: manual merge of the rust tree with the kbuild tree
@ 2022-09-27 18:16 broonie
  2022-09-28 17:16 ` Miguel Ojeda
  2022-10-04 22:23 ` Stephen Rothwell
  0 siblings, 2 replies; 28+ messages in thread
From: broonie @ 2022-09-27 18:16 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Adam Bratschi-Kaye, Alex Gaynor, Antonio Terceiro,
	Björn Roy Baron, Boqun Feng, Boris-Chengbiao Zhou,
	Daniel Xu, Dariusz Sosnowski, Douglas Su, Finn Behrens, Gary Guo,
	Linux Kernel Mailing List, Linux Next Mailing List,
	Martin Rodriguez Reboredo, Masahiro Yamada, Michael Ellerman,
	Miguel Ojeda, Sven Van Asbroeck, Wedson Almeida Filho

Hi all,

FIXME: Add owner of second tree to To:
       Add author(s)/SOB of conflicting commits.

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

  Makefile

between commit:

  0cc1b22fa606e ("kbuild: list sub-directories in ./Kbuild")
  ca5f20da2ffcb ("kbuild: move .vmlinux.objs rule to Makefile.modpost")

from the kbuild tree and commit:

  d64ddbd68af8f ("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 2b4980490ecb2,c759ee3152544..0000000000000
--- a/Makefile
+++ b/Makefile
@@@ -789,7 -862,11 +861,10 @@@ 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.
@@@ -1098,9 -1182,16 +1179,8 @@@ export MODORDER := $(extmod_prefix)modu
  export MODULES_NSDEPS := $(extmod_prefix)modules.nsdeps
  
  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) \
 -		     $(libs-y) $(libs-m)))
--
 -vmlinux-alldirs	:= $(sort $(vmlinux-dirs) Documentation \
 +build-dir	:= .
 +clean-dirs	:= $(sort . Documentation \
  		     $(patsubst %/,%,$(filter %/, $(core-) \
  			$(drivers-) $(libs-))))
  
@@@ -1497,7 -1585,7 +1581,8 @@@ endif # CONFIG_MODULE
  # Directories & files removed with 'make clean'
  CLEAN_FILES += include/ksym vmlinux.symvers modules-only.symvers \
  	       modules.builtin modules.builtin.modinfo modules.nsdeps \
- 	       compile_commands.json .thinlto-cache .vmlinux.objs
 -	       compile_commands.json .thinlto-cache rust/test rust/doc
++	       compile_commands.json .thinlto-cache .vmlinux.objs \
++	       rust/test rust/doc
  
  # Directories & files removed with 'make mrproper'
  MRPROPER_FILES += include/config include/generated          \
diff --git a/Kbuild b/Kbuild
index 8a37584d1fd6b..5f4a23fc87b63 100644
--- a/Kbuild
+++ b/Kbuild
@@ -91,6 +91,7 @@ obj-$(CONFIG_BLOCK)	+= block/
 obj-$(CONFIG_IO_URING)	+= io_uring/
 obj-y			+= $(ARCH_LIB)
 obj-y			+= drivers/
+obj-$(CONFIG_RUST)	+= rust/
 obj-y			+= sound/
 obj-$(CONFIG_SAMPLES)	+= samples/
 obj-$(CONFIG_NET)	+= net/

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: linux-next: manual merge of the rust tree with the kbuild tree
  2022-09-26 23:12 broonie
@ 2022-09-27 12:47 ` Miguel Ojeda
  0 siblings, 0 replies; 28+ messages in thread
From: Miguel Ojeda @ 2022-09-27 12:47 UTC (permalink / raw)
  To: broonie
  Cc: Adam Bratschi-Kaye, Alex Gaynor, Antonio Terceiro,
	Björn Roy Baron, Boqun Feng, Boris-Chengbiao Zhou,
	Daniel Xu, Dariusz Sosnowski, Douglas Su, Finn Behrens, Gary Guo,
	Linux Kernel Mailing List, Linux Next Mailing List,
	Martin Rodriguez Reboredo, Masahiro Yamada, Michael Ellerman,
	Miguel Ojeda, Nick Desaulniers, Sven Van Asbroeck,
	Wedson Almeida Filho

On Tue, Sep 27, 2022 at 1:12 AM <broonie@kernel.org> wrote:
>
> I fixed it up (see below) and can carry the fix as necessary. This

Thanks Mark, it looks good.

This should be gone in v10 which I have just pushed.

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* linux-next: manual merge of the rust tree with the kbuild tree
@ 2022-09-26 23:12 broonie
  2022-09-27 12:47 ` Miguel Ojeda
  0 siblings, 1 reply; 28+ messages in thread
From: broonie @ 2022-09-26 23:12 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Adam Bratschi-Kaye, Alex Gaynor, Antonio Terceiro,
	Björn Roy Baron, Boqun Feng, Boris-Chengbiao Zhou,
	Daniel Xu, Dariusz Sosnowski, Douglas Su, Finn Behrens, Gary Guo,
	Linux Kernel Mailing List, Linux Next Mailing List,
	Martin Rodriguez Reboredo, Masahiro Yamada, Michael Ellerman,
	Miguel Ojeda, Nick Desaulniers, Sven Van Asbroeck,
	Wedson Almeida Filho

Hi all,

FIXME: Add owner of second tree to To:
       Add author(s)/SOB of conflicting commits.

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:

  4f6a738b5c348 ("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 2dba99828e893,a105cb893b4ca..0000000000000
--- a/Makefile
+++ b/Makefile
@@@ -757,10 -819,20 +821,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
  

^ permalink raw reply	[flat|nested] 28+ messages in thread

* linux-next: manual merge of the rust tree with the kbuild tree
@ 2022-09-12  7:41 Stephen Rothwell
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Rothwell @ 2022-09-12  7:41 UTC (permalink / raw)
  To: Miguel Ojeda, Masahiro Yamada
  Cc: Adam Bratschi-Kaye, Alex Gaynor, Antonio Terceiro,
	Björn Roy Baron, Boqun Feng, Boris-Chengbiao Zhou,
	Daniel Xu, Dariusz Sosnowski, Douglas Su, Finn Behrens, Gary Guo,
	Linux Kernel Mailing List, Linux Next Mailing List,
	Martin Rodriguez Reboredo, Michael Ellerman, Miguel Ojeda,
	Sven Van Asbroeck, Wedson Almeida Filho

[-- Attachment #1: Type: text/plain, Size: 3008 bytes --]

Hi all,

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

  Makefile

between commits:

  d0d7e9163953 ("kbuild: move .vmlinux.objs rule to Makefile.modpost")
  1e9657fb4b8f ("kbuild: move core-y and drivers-y to ./Kbuild")

from the kbuild tree and commit:

  4f6a738b5c34 ("Kbuild: add Rust support")

from the rust tree.

I fixed it up (see at the end and the merge fix patch 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.

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Mon, 12 Sep 2022 17:38:35 +1000
Subject: [PATCH] rust: fix up for "kbuild: move core-y and drivers-y to ./Kbuild"

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 Kbuild | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Kbuild b/Kbuild
index 8854e88e0619..253e9f789cf6 100644
--- a/Kbuild
+++ b/Kbuild
@@ -89,6 +89,7 @@ obj-y			+= security/
 obj-y			+= crypto/
 obj-$(CONFIG_BLOCK)	+= block/
 obj-$(CONFIG_IO_URING)	+= io_uring/
+obj-$(CONFIG_RUST)	+= rust/
 obj-y			+= drivers/
 obj-y			+= sound/
 obj-$(CONFIG_SAMPLES)	+= samples/
-- 
2.35.1

-- 
Cheers,
Stephen Rothwell

diff --cc Makefile
index f8413c411923,a105cb893b4c..000000000000
--- a/Makefile
+++ b/Makefile
@@@ -757,10 -819,20 +821,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
@@@ -1505,7 -1576,7 +1589,8 @@@ endif # CONFIG_MODULE
  # Directories & files removed with 'make clean'
  CLEAN_FILES += include/ksym vmlinux.symvers modules-only.symvers \
  	       modules.builtin modules.builtin.modinfo modules.nsdeps \
- 	       compile_commands.json .thinlto-cache .vmlinux.objs
 -	       compile_commands.json .thinlto-cache rust/test rust/doc
++	       compile_commands.json .thinlto-cache .vmlinux.objs \
++	       rust/test rust/doc
  
  # Directories & files removed with 'make mrproper'
  MRPROPER_FILES += include/config include/generated          \

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: linux-next: manual merge of the rust tree with the kbuild tree
  2022-08-02 23:38 broonie
  2022-08-03  9:28 ` Miguel Ojeda
@ 2022-08-14 23:08 ` Stephen Rothwell
  1 sibling, 0 replies; 28+ messages in thread
From: Stephen Rothwell @ 2022-08-14 23:08 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: broonie, Adam Bratschi-Kaye, Alex Gaynor, Antonio Terceiro,
	Björn Roy Baron, Boqun Feng, Boris-Chengbiao Zhou,
	Daniel Xu, Dariusz Sosnowski, David Gow, Douglas Su,
	Finn Behrens, Gary Guo, Linux Kernel Mailing List,
	Linux Next Mailing List, Martin Rodriguez Reboredo,
	Masahiro Yamada, Michael Ellerman, Miguel Cano, Miguel Ojeda,
	Nick Desaulniers, Sven Van Asbroeck, Tiago Lam,
	Wedson Almeida Filho

[-- Attachment #1: Type: text/plain, Size: 2317 bytes --]

Hi all,

On Wed,  3 Aug 2022 00:38:44 +0100 broonie@kernel.org 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

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: linux-next: manual merge of the rust tree with the kbuild tree
  2022-08-02 23:38 broonie
@ 2022-08-03  9:28 ` Miguel Ojeda
  2022-08-14 23:08 ` Stephen Rothwell
  1 sibling, 0 replies; 28+ messages in thread
From: Miguel Ojeda @ 2022-08-03  9:28 UTC (permalink / raw)
  To: broonie
  Cc: Adam Bratschi-Kaye, Alex Gaynor, Antonio Terceiro,
	Björn Roy Baron, Boqun Feng, Boris-Chengbiao Zhou,
	Daniel Xu, Dariusz Sosnowski, David Gow, Douglas Su,
	Finn Behrens, Gary Guo, Linux Kernel Mailing List,
	Linux Next Mailing List, Martin Rodriguez Reboredo,
	Masahiro Yamada, Michael Ellerman, Miguel Cano, Miguel Ojeda,
	Nick Desaulniers, Sven Van Asbroeck, Tiago Lam,
	Wedson Almeida Filho

On Wed, Aug 3, 2022 at 1:38 AM <broonie@kernel.org> wrote:
>
> 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.

Looks good to me! Thanks!

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* linux-next: manual merge of the rust tree with the kbuild tree
@ 2022-08-02 23:38 broonie
  2022-08-03  9:28 ` Miguel Ojeda
  2022-08-14 23:08 ` Stephen Rothwell
  0 siblings, 2 replies; 28+ messages in thread
From: broonie @ 2022-08-02 23:38 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Adam Bratschi-Kaye, Alex Gaynor, Antonio Terceiro,
	Björn Roy Baron, Boqun Feng, Boris-Chengbiao Zhou,
	Daniel Xu, Dariusz Sosnowski, David Gow, Douglas Su,
	Finn Behrens, Gary Guo, Linux Kernel Mailing List,
	Linux Next Mailing List, Martin Rodriguez Reboredo,
	Masahiro Yamada, Michael Ellerman, Miguel Cano, Miguel Ojeda,
	Nick Desaulniers, Sven Van Asbroeck, Tiago Lam,
	Wedson Almeida Filho

Hi all,

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) \

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: linux-next: manual merge of the rust tree with the kbuild tree
  2022-04-05  3:14 Stephen Rothwell
@ 2022-04-05  8:33 ` Miguel Ojeda
  0 siblings, 0 replies; 28+ messages in thread
From: Miguel Ojeda @ 2022-04-05  8:33 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Masahiro Yamada, Adam Bratschi-Kaye, Alex Gaynor,
	Antonio Terceiro, Boqun Feng, Boris-Chengbiao Zhou,
	Chun-Tse Shao, Daniel Xu, Dariusz Sosnowski, Douglas Su,
	Finn Behrens, Gary Guo, Linux Kernel Mailing List,
	Linux Next Mailing List, Michael Ellerman, Miguel Cano,
	Miguel Ojeda, Sven Van Asbroeck, Wedson Almeida Filho

On Tue, Apr 5, 2022 at 5:14 AM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> I fixed it up (see below) and can carry the fix as necessary. This

Looks fine, thanks Stephen!

I will likely rebase again for -rc2 like for -rc1 (done to avoid a
build error on our side and a conflict on yours).

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* linux-next: manual merge of the rust tree with the kbuild tree
@ 2022-04-05  3:14 Stephen Rothwell
  2022-04-05  8:33 ` Miguel Ojeda
  0 siblings, 1 reply; 28+ messages in thread
From: Stephen Rothwell @ 2022-04-05  3:14 UTC (permalink / raw)
  To: Miguel Ojeda, Masahiro Yamada
  Cc: Adam Bratschi-Kaye, Alex Gaynor, Antonio Terceiro, Boqun Feng,
	Boris-Chengbiao Zhou, Chun-Tse Shao, Daniel Xu,
	Dariusz Sosnowski, Douglas Su, Finn Behrens, Gary Guo,
	Linux Kernel Mailing List, Linux Next Mailing List,
	Michael Ellerman, Miguel Cano, Miguel Ojeda, Sven Van Asbroeck,
	Wedson Almeida Filho

[-- Attachment #1: Type: text/plain, Size: 1973 bytes --]

Hi all,

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

  Makefile

between commit:

  703f8d8fad36 ("kbuild: Allow kernel installation packaging to override pkg-config")

from the kbuild tree and commit:

  241608fc4d70 ("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 d9336e783be3,40182fcc211a..000000000000
--- a/Makefile
+++ b/Makefile
@@@ -436,7 -443,7 +443,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 -578,23 +579,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

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: linux-next: manual merge of the rust tree with the kbuild tree
  2022-03-17  6:02 Stephen Rothwell
@ 2022-03-17  7:11 ` Miguel Ojeda
  0 siblings, 0 replies; 28+ messages in thread
From: Miguel Ojeda @ 2022-03-17  7:11 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Masahiro Yamada, Adam Bratschi-Kaye, Alex Gaynor,
	Antonio Terceiro, Boqun Feng, Boris-Chengbiao Zhou, Daniel Xu,
	Dariusz Sosnowski, Douglas Su, Elliot Berman, Finn Behrens,
	Gary Guo, Linux Kernel Mailing List, Linux Next Mailing List,
	Michael Ellerman, Miguel Cano, Miguel Ojeda, Sven Van Asbroeck,
	Wedson Almeida Filho

Hi Stephen,

On Thu, Mar 17, 2022 at 7:03 AM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> I fixed it up (see below) and can carry the fix as necessary. This

Looks good to me -- thanks!

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* linux-next: manual merge of the rust tree with the kbuild tree
@ 2022-03-17  6:02 Stephen Rothwell
  2022-03-17  7:11 ` Miguel Ojeda
  0 siblings, 1 reply; 28+ messages in thread
From: Stephen Rothwell @ 2022-03-17  6:02 UTC (permalink / raw)
  To: Miguel Ojeda, Masahiro Yamada
  Cc: Adam Bratschi-Kaye, Alex Gaynor, Antonio Terceiro, Boqun Feng,
	Boris-Chengbiao Zhou, Daniel Xu, Dariusz Sosnowski, Douglas Su,
	Elliot Berman, Finn Behrens, Gary Guo, Linux Kernel Mailing List,
	Linux Next Mailing List, Michael Ellerman, Miguel Cano,
	Miguel Ojeda, Sven Van Asbroeck, Wedson Almeida Filho

[-- Attachment #1: Type: text/plain, Size: 4130 bytes --]

Hi all,

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

  Makefile

between commit:

  f67695c9962e ("kbuild: Add environment variables for userprogs flags")

from the kbuild tree and commit:

  e2e7cf27b587 ("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 d2269ea42eac,67008a2d964c..000000000000
--- a/Makefile
+++ b/Makefile
@@@ -430,15 -437,32 +437,34 @@@ els
  HOSTCC	= gcc
  HOSTCXX	= g++
  endif
+ HOSTRUSTC = rustc
  
 -export KBUILD_USERCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \
 -			      -O2 -fomit-frame-pointer -std=gnu89
 -export KBUILD_USERLDFLAGS :=
 +KBUILD_USERHOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \
 +			 -O2 -fomit-frame-pointer -std=gnu11 \
 +			 -Wdeclaration-after-statement
 +KBUILD_USERCFLAGS  := $(KBUILD_USERHOSTCFLAGS) $(USERCFLAGS)
 +KBUILD_USERLDFLAGS := $(USERLDFLAGS)
  
+ # These flags apply to all Rust code in the tree, including the kernel and
+ # host programs.
+ export rust_common_flags := --edition=2021 \
+ 			    -Zbinary_dep_depinfo=y \
+ 			    -Dunsafe_op_in_unsafe_fn -Drust_2018_idioms \
+ 			    -Dunreachable_pub -Dnon_ascii_idents \
+ 			    -Wmissing_docs \
+ 			    -Drustdoc::missing_crate_level_docs \
+ 			    -Dclippy::correctness -Dclippy::style \
+ 			    -Dclippy::suspicious -Dclippy::complexity \
+ 			    -Dclippy::perf \
+ 			    -Dclippy::let_unit_value -Dclippy::mut_mut \
+ 			    -Dclippy::needless_bitwise_bool \
+ 			    -Dclippy::needless_continue \
+ 			    -Wclippy::dbg_macro
+ 
 -KBUILD_HOSTCFLAGS   := $(KBUILD_USERCFLAGS) $(HOST_LFS_CFLAGS) $(HOSTCFLAGS)
 +KBUILD_HOSTCFLAGS   := $(KBUILD_USERHOSTCFLAGS) $(HOST_LFS_CFLAGS) $(HOSTCFLAGS)
  KBUILD_HOSTCXXFLAGS := -Wall -O2 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS)
+ KBUILD_HOSTRUSTFLAGS := $(rust_common_flags) -O -Cstrip=debuginfo \
+ 			-Zallow-features= $(HOSTRUSTFLAGS)
  KBUILD_HOSTLDFLAGS  := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS)
  KBUILD_HOSTLDLIBS   := $(HOST_LFS_LIBS) $(HOSTLDLIBS)
  
@@@ -517,12 -549,23 +551,23 @@@ KBUILD_CFLAGS   := -Wall -Wundef -Werro
  		   -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE \
  		   -Werror=implicit-function-declaration -Werror=implicit-int \
  		   -Werror=return-type -Wno-format-security \
 -		   -std=gnu89
 +		   -std=gnu11
  KBUILD_CPPFLAGS := -D__KERNEL__
+ KBUILD_RUSTFLAGS := $(rust_common_flags) \
+ 		    --target=$(objtree)/rust/target.json \
+ 		    -Cpanic=abort -Cembed-bitcode=n -Clto=n \
+ 		    -Cforce-unwind-tables=n -Ccodegen-units=1 \
+ 		    -Csymbol-mangling-version=v0 \
+ 		    -Crelocation-model=static \
+ 		    -Zfunction-sections=n \
+ 		    -Dclippy::float_arithmetic
+ 
  KBUILD_AFLAGS_KERNEL :=
  KBUILD_CFLAGS_KERNEL :=
+ KBUILD_RUSTFLAGS_KERNEL :=
  KBUILD_AFLAGS_MODULE  := -DMODULE
  KBUILD_CFLAGS_MODULE  := -DMODULE
+ KBUILD_RUSTFLAGS_MODULE := --cfg MODULE
  KBUILD_LDFLAGS_MODULE :=
  KBUILD_LDFLAGS :=
  CLANG_FLAGS :=
@@@ -783,9 -858,12 +861,12 @@@ KBUILD_CFLAGS += $(stackp-flags-y
  KBUILD_CFLAGS-$(CONFIG_WERROR) += -Werror
  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=gnu89' so use of GNU extensions is acceptable.
 +# The kernel builds with '-std=gnu11' so use of GNU extensions is acceptable.
  KBUILD_CFLAGS += -Wno-gnu
  # CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the
  # source of a reference will be _MergedGlobals and not on of the whitelisted names.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* linux-next: manual merge of the rust tree with the kbuild tree
@ 2022-01-17 23:51 Stephen Rothwell
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Rothwell @ 2022-01-17 23:51 UTC (permalink / raw)
  To: Miguel Ojeda, Masahiro Yamada
  Cc: Adam Bratschi-Kaye, Alex Gaynor, Boris-Chengbiao Zhou, Daniel Xu,
	Finn Behrens, Gary Guo, Linux Kernel Mailing List,
	Linux Next Mailing List, Michael Ellerman, Miguel Ojeda,
	Nathan Chancellor, Sven Van Asbroeck, Wedson Almeida Filho,
	Wei Liu, Wu XiangCheng, Yuki Okushi

[-- Attachment #1: Type: text/plain, Size: 1607 bytes --]

Hi all,

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

  Documentation/process/changes.rst

between commit:

  df05c0e9496c ("Documentation: Raise the minimum supported version of LLVM to 11.0.0")

from the kbuild tree and commit:

  78b471443e27 ("docs: add Rust documentation")

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 Documentation/process/changes.rst
index a337e8eabfe1,0f5d64d3993f..000000000000
--- a/Documentation/process/changes.rst
+++ b/Documentation/process/changes.rst
@@@ -30,7 -30,9 +30,9 @@@ you probably needn't concern yourself w
          Program        Minimal version       Command to check the version
  ====================== ===============  ========================================
  GNU C                  5.1              gcc --version
 -Clang/LLVM (optional)  10.0.1           clang --version
 +Clang/LLVM (optional)  11.0.0           clang --version
+ Rust (optional)        1.58.0           rustc --version
+ bindgen (optional)     0.56.0           bindgen --version
  GNU make               3.81             make --version
  binutils               2.23             ld -v
  flex                   2.5.35           flex --version

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* linux-next: manual merge of the rust tree with the kbuild tree
@ 2021-12-07  5:13 Stephen Rothwell
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Rothwell @ 2021-12-07  5:13 UTC (permalink / raw)
  To: Miguel Ojeda, Masahiro Yamada
  Cc: Adam Bratschi-Kaye, Alex Gaynor, Antonio Terceiro, Boqun Feng,
	Boris-Chengbiao Zhou, Daniel Xu, Dariusz Sosnowski, Douglas Su,
	Finn Behrens, Gary Guo, Linux Kernel Mailing List,
	Linux Next Mailing List, Michael Ellerman, Miguel Ojeda,
	Sven Van Asbroeck, Wedson Almeida Filho

[-- Attachment #1: Type: text/plain, Size: 873 bytes --]

Hi all,

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

  scripts/kconfig/confdata.c

between commit:

  373c0a890520 ("[for -next only] kconfig: generate include/generated/rustc_cfg")

from the kbuild tree and commit:

  62cb43b76df3 ("Kbuild: add Rust support")

from the rust tree.

I fixed it up (I basically used the latter version) 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.

Masahiro, you probably don't need that kbuild tree patch any more since
the rust tree has been rebased onto v5.16-rc3.
-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: linux-next: manual merge of the rust tree with the kbuild tree
  2021-12-03  5:20 Stephen Rothwell
@ 2021-12-03  9:05 ` Miguel Ojeda
  0 siblings, 0 replies; 28+ messages in thread
From: Miguel Ojeda @ 2021-12-03  9:05 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Masahiro Yamada, Adam Bratschi-Kaye, Alex Gaynor,
	Boris-Chengbiao Zhou, Finn Behrens, Gary Guo,
	Linux Kernel Mailing List, Linux Next Mailing List,
	Michael Ellerman, Miguel Ojeda, Nathan Chancellor,
	Sven Van Asbroeck, Wedson Almeida Filho, Wei Liu, Wu XiangCheng,
	Yuki Okushi

On Fri, Dec 3, 2021 at 6:20 AM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> 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.

Looks good to me. Thanks!

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* linux-next: manual merge of the rust tree with the kbuild tree
@ 2021-12-03  5:20 Stephen Rothwell
  2021-12-03  9:05 ` Miguel Ojeda
  0 siblings, 1 reply; 28+ messages in thread
From: Stephen Rothwell @ 2021-12-03  5:20 UTC (permalink / raw)
  To: Miguel Ojeda, Masahiro Yamada
  Cc: Adam Bratschi-Kaye, Alex Gaynor, Boris-Chengbiao Zhou,
	Finn Behrens, Gary Guo, Linux Kernel Mailing List,
	Linux Next Mailing List, Michael Ellerman, Miguel Ojeda,
	Nathan Chancellor, Sven Van Asbroeck, Wedson Almeida Filho,
	Wei Liu, Wu XiangCheng, Yuki Okushi

[-- Attachment #1: Type: text/plain, Size: 1607 bytes --]

Hi all,

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

  Documentation/process/changes.rst

between commit:

  df05c0e9496c ("Documentation: Raise the minimum supported version of LLVM to 11.0.0")

from the kbuild tree and commit:

  d029d8003e02 ("docs: add Rust documentation")

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 Documentation/process/changes.rst
index a337e8eabfe1,c51644fbb801..000000000000
--- a/Documentation/process/changes.rst
+++ b/Documentation/process/changes.rst
@@@ -30,7 -35,9 +35,9 @@@ know what you are doing, use the exact 
          Program        Minimal version       Command to check the version
  ====================== ===============  ========================================
  GNU C                  5.1              gcc --version
 -Clang/LLVM (optional)  10.0.1           clang --version
 +Clang/LLVM (optional)  11.0.0           clang --version
+ rustc (optional)       1.56.0           rustc --version
+ bindgen (optional)     0.56.0           bindgen --version
  GNU make               3.81             make --version
  binutils               2.23             ld -v
  flex                   2.5.35           flex --version

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* linux-next: manual merge of the rust tree with the kbuild tree
@ 2021-10-06  5:46 Stephen Rothwell
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Rothwell @ 2021-10-06  5:46 UTC (permalink / raw)
  To: Miguel Ojeda, Masahiro Yamada
  Cc: Adam Bratschi-Kaye, Alex Gaynor, Ayaan Zaidi, Boqun Feng,
	Boris-Chengbiao Zhou, Douglas Su, Finn Behrens, Fox Chen,
	Gary Guo, Geoffrey Thomas, Linux Kernel Mailing List,
	Linux Next Mailing List, Michael Ellerman, Miguel Ojeda,
	Sumera Priyadarsini, Sven Van Asbroeck, Wedson Almeida Filho,
	Yuki Okushi

[-- Attachment #1: Type: text/plain, Size: 813 bytes --]

Hi all,

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

  scripts/kconfig/confdata.c

between several commits, including

  2836b7a7bd05 ("[for -next only] kconfig: generate include/generated/rustc_cfg")

from the kbuild tree and commit:

  dc08d49444e9 ("Kbuild: add Rust support")

from the rust tree.

I fixed it up (as per Masahiro Yamada's suggestion, I used the version
from the kbuild tree) 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

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: linux-next: manual merge of the rust tree with the kbuild tree
  2021-08-11 17:04 ` Nick Desaulniers
@ 2021-08-12  6:34   ` Stephen Rothwell
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Rothwell @ 2021-08-12  6:34 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Miguel Ojeda, Masahiro Yamada, Adam Bratschi-Kaye, Alex Gaynor,
	Finn Behrens, Geoffrey Thomas, Linux Kernel Mailing List,
	Linux Next Mailing List, Miguel Ojeda, Wedson Almeida Filho,
	Randy Dunlap

[-- Attachment #1: Type: text/plain, Size: 3628 bytes --]

Hi Nick,

On Wed, 11 Aug 2021 10:04:36 -0700 Nick Desaulniers <ndesaulniers@google.com> wrote:
>
> Thanks Stephen for taking the time to resolve this and send a patch.
> We owe you one. We knew this conflict was coming.
> 
> Miguel, would you mind rolling this patch into your tree, then
> crediting Stephen if possible (on the patch that adds
> TENTATIVE_CLANG_FLAGS)?
> 
> I think the above `ifneq ($(findstring clang,$(CC_VERSION_TEXT)),)`
> should stay in the top level Makefile though. It does look nicer to
> bury it in scripts/Makefile.clang, but I worry that someone doing a
> GCC build might trip the $(error) in that file (if CROSS_COMPILE was
> set and we're building a non-llvm-supported target).

OK, I have changed the patch today to be this:

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Wed, 11 Aug 2021 17:18:36 +1000
Subject: [PATCH] fixup for rust integration with Makefile.clang creation

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 Makefile               | 17 -----------------
 scripts/Makefile.clang | 19 +++++++++++++------
 2 files changed, 13 insertions(+), 23 deletions(-)

diff --git a/Makefile b/Makefile
index 5d504a1dcb06..3638ce07f208 100644
--- a/Makefile
+++ b/Makefile
@@ -625,22 +625,7 @@ endif
 # and from include/config/auto.conf.cmd to detect the compiler upgrade.
 CC_VERSION_TEXT = $(subst $(pound),,$(shell LC_ALL=C $(CC) --version 2>/dev/null | head -n 1))
 
-TENTATIVE_CLANG_FLAGS := -Werror=unknown-warning-option
-
-ifneq ($(CROSS_COMPILE),)
-TENTATIVE_CLANG_FLAGS	+= --target=$(notdir $(CROSS_COMPILE:%-=%))
-endif
-ifeq ($(LLVM_IAS),1)
-TENTATIVE_CLANG_FLAGS	+= -integrated-as
-else
-TENTATIVE_CLANG_FLAGS	+= -no-integrated-as
-GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
-TENTATIVE_CLANG_FLAGS	+= --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
-endif
-
-export TENTATIVE_CLANG_FLAGS
-
 ifneq ($(findstring clang,$(CC_VERSION_TEXT)),)
 include $(srctree)/scripts/Makefile.clang
 endif
 
diff --git a/scripts/Makefile.clang b/scripts/Makefile.clang
index 3ae63bd35582..555b5255d9b3 100644
--- a/scripts/Makefile.clang
+++ b/scripts/Makefile.clang
@@ -12,24 +12,29 @@ CLANG_TARGET_FLAGS_s390		:= s390x-linux-gnu
 CLANG_TARGET_FLAGS_x86		:= x86_64-linux-gnu
 CLANG_TARGET_FLAGS		:= $(CLANG_TARGET_FLAGS_$(SRCARCH))
 
+TENTATIVE_CLANG_FLAGS := -Werror=unknown-warning-option
+
 ifeq ($(CROSS_COMPILE),)
 ifeq ($(CLANG_TARGET_FLAGS),)
 $(error Specify CROSS_COMPILE or add '--target=' option to scripts/Makefile.clang)
 else
-CLANG_FLAGS	+= --target=$(CLANG_TARGET_FLAGS)
+TENTATIVE_CLANG_FLAGS	+= --target=$(CLANG_TARGET_FLAGS)
 endif # CLANG_TARGET_FLAGS
 else
-CLANG_FLAGS	+= --target=$(notdir $(CROSS_COMPILE:%-=%))
+TENTATIVE_CLANG_FLAGS	+= --target=$(notdir $(CROSS_COMPILE:%-=%))
 endif # CROSS_COMPILE
 
 ifeq ($(LLVM_IAS),0)
-CLANG_FLAGS	+= -no-integrated-as
+TENTATIVE_CLANG_FLAGS	+= -no-integrated-as
 GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
-CLANG_FLAGS	+= --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
+TENTATIVE_CLANG_FLAGS	+= --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
 else
-CLANG_FLAGS	+= -integrated-as
+TENTATIVE_CLANG_FLAGS	+= -integrated-as
 endif
-CLANG_FLAGS	+= -Werror=unknown-warning-option
+
+export TENTATIVE_CLANG_FLAGS
+
+CLANG_FLAGS	+= $(TENTATIVE_CLANG_FLAGS)
 KBUILD_CFLAGS	+= $(CLANG_FLAGS)
 KBUILD_AFLAGS	+= $(CLANG_FLAGS)
 export CLANG_FLAGS
-- 
2.30.2

Please give it a spin when linux-next has been released.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: linux-next: manual merge of the rust tree with the kbuild tree
  2021-08-11  7:26 Stephen Rothwell
@ 2021-08-11 17:04 ` Nick Desaulniers
  2021-08-12  6:34   ` Stephen Rothwell
  0 siblings, 1 reply; 28+ messages in thread
From: Nick Desaulniers @ 2021-08-11 17:04 UTC (permalink / raw)
  To: Stephen Rothwell, Miguel Ojeda, Masahiro Yamada
  Cc: Adam Bratschi-Kaye, Alex Gaynor, Finn Behrens, Geoffrey Thomas,
	Linux Kernel Mailing List, Linux Next Mailing List, Miguel Ojeda,
	Wedson Almeida Filho

On Wed, Aug 11, 2021 at 12:26 AM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Hi all,
>
> Today's linux-next merge of the rust tree got a conflict in:
>
>   Makefile
>
> between commit:
>
>   6f5b41a2f5a6 ("Makefile: move initial clang flag handling into scripts/Makefile.clang")
>   231ad7f409f1 ("Makefile: infer --target from ARCH for CC=clang")
>   f12b034afeb3 ("scripts/Makefile.clang: default to LLVM_IAS=1")
>
> from the kbuild tree and commit:
>
>   e17f1b1f3e01 ("Makefile: generate `CLANG_FLAGS` even in GCC builds")
>
> from the rust tree.
>
> I fixed it up (Makefile fix up at the bottom, plus the following patch)
> 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.
>
> From: Stephen Rothwell <sfr@canb.auug.org.au>
> Date: Wed, 11 Aug 2021 17:18:36 +1000
> Subject: [PATCH] fixup for rust integration with Makefile.clang creation
>
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
> ---
>  Makefile               | 17 -----------------
>  scripts/Makefile.clang | 19 +++++++++++++------
>  2 files changed, 13 insertions(+), 23 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 5d504a1dcb06..3638ce07f208 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -625,24 +625,7 @@ endif
>  # and from include/config/auto.conf.cmd to detect the compiler upgrade.
>  CC_VERSION_TEXT = $(subst $(pound),,$(shell LC_ALL=C $(CC) --version 2>/dev/null | head -n 1))
>
> -TENTATIVE_CLANG_FLAGS := -Werror=unknown-warning-option
> -
> -ifneq ($(CROSS_COMPILE),)
> -TENTATIVE_CLANG_FLAGS  += --target=$(notdir $(CROSS_COMPILE:%-=%))
> -endif
> -ifeq ($(LLVM_IAS),1)
> -TENTATIVE_CLANG_FLAGS  += -integrated-as
> -else
> -TENTATIVE_CLANG_FLAGS  += -no-integrated-as
> -GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
> -TENTATIVE_CLANG_FLAGS  += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
> -endif
> -
> -export TENTATIVE_CLANG_FLAGS
> -
> -ifneq ($(findstring clang,$(CC_VERSION_TEXT)),)
>  include $(srctree)/scripts/Makefile.clang
> -endif

Thanks Stephen for taking the time to resolve this and send a patch.
We owe you one. We knew this conflict was coming.

Miguel, would you mind rolling this patch into your tree, then
crediting Stephen if possible (on the patch that adds
TENTATIVE_CLANG_FLAGS)?

I think the above `ifneq ($(findstring clang,$(CC_VERSION_TEXT)),)`
should stay in the top level Makefile though. It does look nicer to
bury it in scripts/Makefile.clang, but I worry that someone doing a
GCC build might trip the $(error) in that file (if CROSS_COMPILE was
set and we're building a non-llvm-supported target).

Also, if you're rebasing the related patches, I hope we can use a
shorter identifier than TENTATIVE_CLANG_FLAGS? If they're used for
bindgen, maybe BINDGEN_FLAGS?

>
>  # Include this also for config targets because some architectures need
>  # cc-cross-prefix to determine CROSS_COMPILE.
> diff --git a/scripts/Makefile.clang b/scripts/Makefile.clang
> index 3ae63bd35582..555b5255d9b3 100644
> --- a/scripts/Makefile.clang
> +++ b/scripts/Makefile.clang
> @@ -12,24 +12,31 @@ CLANG_TARGET_FLAGS_s390             := s390x-linux-gnu
>  CLANG_TARGET_FLAGS_x86         := x86_64-linux-gnu
>  CLANG_TARGET_FLAGS             := $(CLANG_TARGET_FLAGS_$(SRCARCH))
>
> +TENTATIVE_CLANG_FLAGS := -Werror=unknown-warning-option
> +
>  ifeq ($(CROSS_COMPILE),)
>  ifeq ($(CLANG_TARGET_FLAGS),)
>  $(error Specify CROSS_COMPILE or add '--target=' option to scripts/Makefile.clang)
>  else
> -CLANG_FLAGS    += --target=$(CLANG_TARGET_FLAGS)
> +TENTATIVE_CLANG_FLAGS  += --target=$(CLANG_TARGET_FLAGS)
>  endif # CLANG_TARGET_FLAGS
>  else
> -CLANG_FLAGS    += --target=$(notdir $(CROSS_COMPILE:%-=%))
> +TENTATIVE_CLANG_FLAGS  += --target=$(notdir $(CROSS_COMPILE:%-=%))
>  endif # CROSS_COMPILE
>
>  ifeq ($(LLVM_IAS),0)
> -CLANG_FLAGS    += -no-integrated-as
> +TENTATIVE_CLANG_FLAGS  += -no-integrated-as
>  GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
> -CLANG_FLAGS    += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
> +TENTATIVE_CLANG_FLAGS  += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
>  else
> -CLANG_FLAGS    += -integrated-as
> +TENTATIVE_CLANG_FLAGS  += -integrated-as
>  endif
> -CLANG_FLAGS    += -Werror=unknown-warning-option
> +
> +export TENTATIVE_CLANG_FLAGS
> +
> +ifneq ($(findstring clang,$(CC_VERSION_TEXT)),)
> +CLANG_FLAGS    += $(TENTATIVE_CLANG_FLAGS)
>  KBUILD_CFLAGS  += $(CLANG_FLAGS)
>  KBUILD_AFLAGS  += $(CLANG_FLAGS)
>  export CLANG_FLAGS
> +endif
> --
> 2.30.2
>
> --
> Cheers,
> Stephen Rothwell
>
> diff --cc Makefile
> index fcda81da6c20,c814b209b6c9..000000000000
> --- a/Makefile
> +++ b/Makefile
> @@@ -581,10 -613,28 +623,25 @@@ endi
>   # Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile.
>   # CC_VERSION_TEXT is referenced from Kconfig (so it needs export),
>   # and from include/config/auto.conf.cmd to detect the compiler upgrade.
>  -CC_VERSION_TEXT = $(subst $(pound),,$(shell $(CC) --version 2>/dev/null | head -n 1))
>  +CC_VERSION_TEXT = $(subst $(pound),,$(shell LC_ALL=C $(CC) --version 2>/dev/null | head -n 1))
>
> + TENTATIVE_CLANG_FLAGS := -Werror=unknown-warning-option
> +
> + ifneq ($(CROSS_COMPILE),)
> + TENTATIVE_CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%))
> + endif
> + ifeq ($(LLVM_IAS),1)
> + TENTATIVE_CLANG_FLAGS += -integrated-as
> + else
> + TENTATIVE_CLANG_FLAGS += -no-integrated-as
> + GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
> + TENTATIVE_CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
> + endif
> +
> + export TENTATIVE_CLANG_FLAGS
> +
>   ifneq ($(findstring clang,$(CC_VERSION_TEXT)),)
>  -CLANG_FLAGS   += $(TENTATIVE_CLANG_FLAGS)
>  -KBUILD_CFLAGS += $(CLANG_FLAGS)
>  -KBUILD_AFLAGS += $(CLANG_FLAGS)
>  -export CLANG_FLAGS
>  +include $(srctree)/scripts/Makefile.clang
>   endif
>
>   # Include this also for config targets because some architectures need
> @@@ -713,12 -763,11 +770,12 @@@ $(KCONFIG_CONFIG)
>   # This exploits the 'multi-target pattern rule' trick.
>   # The syncconfig should be executed only once to make all the targets.
>   # (Note: use the grouped target '&:' when we bump to GNU Make 4.3)
>  -quiet_cmd_syncconfig = SYNC    $@
>  -      cmd_syncconfig = $(MAKE) -f $(srctree)/Makefile syncconfig
>  -
>  +#
>  +# Do not use $(call cmd,...) here. That would suppress prompts from syncconfig,
>  +# so you cannot notice that Kconfig is waiting for the user input.
> - %/config/auto.conf %/config/auto.conf.cmd %/generated/autoconf.h: $(KCONFIG_CONFIG)
> + %/config/auto.conf %/config/auto.conf.cmd %/generated/autoconf.h %/generated/rustc_cfg: $(KCONFIG_CONFIG)
>  -      +$(call cmd,syncconfig)
>  +      $(Q)$(kecho) "  SYNC    $@"
>  +      $(Q)$(MAKE) -f $(srctree)/Makefile syncconfig
>   else # !may-sync-config
>   # External modules and some install targets need include/generated/autoconf.h
>   # and include/config/auto.conf but do not care if they are up-to-date.
> @@@ -848,8 -926,13 +939,13 @@@ els
>   DEBUG_CFLAGS  += -g
>   endif
>
>  -ifneq ($(LLVM_IAS),1)
>  +ifndef CONFIG_AS_IS_LLVM
>   KBUILD_AFLAGS += -Wa,-gdwarf-2
> + ifdef CONFIG_DEBUG_INFO_REDUCED
> + DEBUG_RUSTFLAGS += -Cdebuginfo=1
> + else
> + DEBUG_RUSTFLAGS += -Cdebuginfo=2
> + endif
>   endif
>
>   ifndef CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
> @@@ -1201,9 -1327,12 +1305,12 @@@ archprepare: outputmakefile archheader
>   prepare0: archprepare
>         $(Q)$(MAKE) $(build)=scripts/mod
>         $(Q)$(MAKE) $(build)=.
> + ifdef CONFIG_RUST
> +       $(Q)$(MAKE) $(build)=rust
> + endif
>
>   # All the preparing..
>  -prepare: prepare0 prepare-objtool prepare-resolve_btfids
>  +prepare: prepare0
>
>   PHONY += remove-stale-files
>   remove-stale-files:



-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 28+ messages in thread

* linux-next: manual merge of the rust tree with the kbuild tree
@ 2021-08-11  7:26 Stephen Rothwell
  2021-08-11 17:04 ` Nick Desaulniers
  0 siblings, 1 reply; 28+ messages in thread
From: Stephen Rothwell @ 2021-08-11  7:26 UTC (permalink / raw)
  To: Miguel Ojeda, Masahiro Yamada
  Cc: Adam Bratschi-Kaye, Alex Gaynor, Finn Behrens, Geoffrey Thomas,
	Linux Kernel Mailing List, Linux Next Mailing List, Miguel Ojeda,
	Nick Desaulniers, Wedson Almeida Filho

[-- Attachment #1: Type: text/plain, Size: 6968 bytes --]

Hi all,

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

  Makefile

between commit:

  6f5b41a2f5a6 ("Makefile: move initial clang flag handling into scripts/Makefile.clang")
  231ad7f409f1 ("Makefile: infer --target from ARCH for CC=clang")
  f12b034afeb3 ("scripts/Makefile.clang: default to LLVM_IAS=1")

from the kbuild tree and commit:

  e17f1b1f3e01 ("Makefile: generate `CLANG_FLAGS` even in GCC builds")

from the rust tree.

I fixed it up (Makefile fix up at the bottom, plus the following patch)
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.

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Wed, 11 Aug 2021 17:18:36 +1000
Subject: [PATCH] fixup for rust integration with Makefile.clang creation

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 Makefile               | 17 -----------------
 scripts/Makefile.clang | 19 +++++++++++++------
 2 files changed, 13 insertions(+), 23 deletions(-)

diff --git a/Makefile b/Makefile
index 5d504a1dcb06..3638ce07f208 100644
--- a/Makefile
+++ b/Makefile
@@ -625,24 +625,7 @@ endif
 # and from include/config/auto.conf.cmd to detect the compiler upgrade.
 CC_VERSION_TEXT = $(subst $(pound),,$(shell LC_ALL=C $(CC) --version 2>/dev/null | head -n 1))
 
-TENTATIVE_CLANG_FLAGS := -Werror=unknown-warning-option
-
-ifneq ($(CROSS_COMPILE),)
-TENTATIVE_CLANG_FLAGS	+= --target=$(notdir $(CROSS_COMPILE:%-=%))
-endif
-ifeq ($(LLVM_IAS),1)
-TENTATIVE_CLANG_FLAGS	+= -integrated-as
-else
-TENTATIVE_CLANG_FLAGS	+= -no-integrated-as
-GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
-TENTATIVE_CLANG_FLAGS	+= --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
-endif
-
-export TENTATIVE_CLANG_FLAGS
-
-ifneq ($(findstring clang,$(CC_VERSION_TEXT)),)
 include $(srctree)/scripts/Makefile.clang
-endif
 
 # Include this also for config targets because some architectures need
 # cc-cross-prefix to determine CROSS_COMPILE.
diff --git a/scripts/Makefile.clang b/scripts/Makefile.clang
index 3ae63bd35582..555b5255d9b3 100644
--- a/scripts/Makefile.clang
+++ b/scripts/Makefile.clang
@@ -12,24 +12,31 @@ CLANG_TARGET_FLAGS_s390		:= s390x-linux-gnu
 CLANG_TARGET_FLAGS_x86		:= x86_64-linux-gnu
 CLANG_TARGET_FLAGS		:= $(CLANG_TARGET_FLAGS_$(SRCARCH))
 
+TENTATIVE_CLANG_FLAGS := -Werror=unknown-warning-option
+
 ifeq ($(CROSS_COMPILE),)
 ifeq ($(CLANG_TARGET_FLAGS),)
 $(error Specify CROSS_COMPILE or add '--target=' option to scripts/Makefile.clang)
 else
-CLANG_FLAGS	+= --target=$(CLANG_TARGET_FLAGS)
+TENTATIVE_CLANG_FLAGS	+= --target=$(CLANG_TARGET_FLAGS)
 endif # CLANG_TARGET_FLAGS
 else
-CLANG_FLAGS	+= --target=$(notdir $(CROSS_COMPILE:%-=%))
+TENTATIVE_CLANG_FLAGS	+= --target=$(notdir $(CROSS_COMPILE:%-=%))
 endif # CROSS_COMPILE
 
 ifeq ($(LLVM_IAS),0)
-CLANG_FLAGS	+= -no-integrated-as
+TENTATIVE_CLANG_FLAGS	+= -no-integrated-as
 GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
-CLANG_FLAGS	+= --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
+TENTATIVE_CLANG_FLAGS	+= --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
 else
-CLANG_FLAGS	+= -integrated-as
+TENTATIVE_CLANG_FLAGS	+= -integrated-as
 endif
-CLANG_FLAGS	+= -Werror=unknown-warning-option
+
+export TENTATIVE_CLANG_FLAGS
+
+ifneq ($(findstring clang,$(CC_VERSION_TEXT)),)
+CLANG_FLAGS	+= $(TENTATIVE_CLANG_FLAGS)
 KBUILD_CFLAGS	+= $(CLANG_FLAGS)
 KBUILD_AFLAGS	+= $(CLANG_FLAGS)
 export CLANG_FLAGS
+endif
-- 
2.30.2

-- 
Cheers,
Stephen Rothwell

diff --cc Makefile
index fcda81da6c20,c814b209b6c9..000000000000
--- a/Makefile
+++ b/Makefile
@@@ -581,10 -613,28 +623,25 @@@ endi
  # Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile.
  # CC_VERSION_TEXT is referenced from Kconfig (so it needs export),
  # and from include/config/auto.conf.cmd to detect the compiler upgrade.
 -CC_VERSION_TEXT = $(subst $(pound),,$(shell $(CC) --version 2>/dev/null | head -n 1))
 +CC_VERSION_TEXT = $(subst $(pound),,$(shell LC_ALL=C $(CC) --version 2>/dev/null | head -n 1))
  
+ TENTATIVE_CLANG_FLAGS := -Werror=unknown-warning-option
+ 
+ ifneq ($(CROSS_COMPILE),)
+ TENTATIVE_CLANG_FLAGS	+= --target=$(notdir $(CROSS_COMPILE:%-=%))
+ endif
+ ifeq ($(LLVM_IAS),1)
+ TENTATIVE_CLANG_FLAGS	+= -integrated-as
+ else
+ TENTATIVE_CLANG_FLAGS	+= -no-integrated-as
+ GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
+ TENTATIVE_CLANG_FLAGS	+= --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
+ endif
+ 
+ export TENTATIVE_CLANG_FLAGS
+ 
  ifneq ($(findstring clang,$(CC_VERSION_TEXT)),)
 -CLANG_FLAGS	+= $(TENTATIVE_CLANG_FLAGS)
 -KBUILD_CFLAGS	+= $(CLANG_FLAGS)
 -KBUILD_AFLAGS	+= $(CLANG_FLAGS)
 -export CLANG_FLAGS
 +include $(srctree)/scripts/Makefile.clang
  endif
  
  # Include this also for config targets because some architectures need
@@@ -713,12 -763,11 +770,12 @@@ $(KCONFIG_CONFIG)
  # This exploits the 'multi-target pattern rule' trick.
  # The syncconfig should be executed only once to make all the targets.
  # (Note: use the grouped target '&:' when we bump to GNU Make 4.3)
 -quiet_cmd_syncconfig = SYNC    $@
 -      cmd_syncconfig = $(MAKE) -f $(srctree)/Makefile syncconfig
 -
 +#
 +# Do not use $(call cmd,...) here. That would suppress prompts from syncconfig,
 +# so you cannot notice that Kconfig is waiting for the user input.
- %/config/auto.conf %/config/auto.conf.cmd %/generated/autoconf.h: $(KCONFIG_CONFIG)
+ %/config/auto.conf %/config/auto.conf.cmd %/generated/autoconf.h %/generated/rustc_cfg: $(KCONFIG_CONFIG)
 -	+$(call cmd,syncconfig)
 +	$(Q)$(kecho) "  SYNC    $@"
 +	$(Q)$(MAKE) -f $(srctree)/Makefile syncconfig
  else # !may-sync-config
  # External modules and some install targets need include/generated/autoconf.h
  # and include/config/auto.conf but do not care if they are up-to-date.
@@@ -848,8 -926,13 +939,13 @@@ els
  DEBUG_CFLAGS	+= -g
  endif
  
 -ifneq ($(LLVM_IAS),1)
 +ifndef CONFIG_AS_IS_LLVM
  KBUILD_AFLAGS	+= -Wa,-gdwarf-2
+ ifdef CONFIG_DEBUG_INFO_REDUCED
+ DEBUG_RUSTFLAGS += -Cdebuginfo=1
+ else
+ DEBUG_RUSTFLAGS += -Cdebuginfo=2
+ endif
  endif
  
  ifndef CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
@@@ -1201,9 -1327,12 +1305,12 @@@ archprepare: outputmakefile archheader
  prepare0: archprepare
  	$(Q)$(MAKE) $(build)=scripts/mod
  	$(Q)$(MAKE) $(build)=.
+ ifdef CONFIG_RUST
+ 	$(Q)$(MAKE) $(build)=rust
+ endif
  
  # All the preparing..
 -prepare: prepare0 prepare-objtool prepare-resolve_btfids
 +prepare: prepare0
  
  PHONY += remove-stale-files
  remove-stale-files:

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* linux-next: manual merge of the rust tree with the kbuild tree
@ 2021-03-29  7:32 Stephen Rothwell
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Rothwell @ 2021-03-29  7:32 UTC (permalink / raw)
  To: Miguel Ojeda, Masahiro Yamada
  Cc: Adam Bratschi-Kaye, Alex Gaynor, Finn Behrens, Geoffrey Thomas,
	Linux Kernel Mailing List, Linux Next Mailing List, Miguel Ojeda,
	Wedson Almeida Filho

[-- Attachment #1: Type: text/plain, Size: 3836 bytes --]

Hi all,

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

  Makefile

between commit:

  b0600f0d9b54 ("kbuild: check the minimum assembler version in Kconfig")

from the kbuild tree and commit:

  98898dfbdf72 ("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 072e7a6a1a75,62b3bba38635..f86d011caedf
--- a/Makefile
+++ b/Makefile
@@@ -263,11 -270,7 +270,11 @@@ no-dot-config-targets := $(clean-target
  			 cscope gtags TAGS tags help% %docs check% coccicheck \
  			 $(version_h) headers headers_% archheaders archscripts \
  			 %asm-generic kernelversion %src-pkg dt_binding_check \
- 			 outputmakefile
+ 			 outputmakefile rustfmt rustfmtcheck
 +# Installation targets should not require compiler. Unfortunately, vdso_install
 +# is an exception where build artifacts may be updated. This must be fixed.
 +no-compiler-targets := $(no-dot-config-targets) install dtbs_install \
 +			headers_install modules_install kernelrelease image_name
  no-sync-config-targets := $(no-dot-config-targets) %install kernelrelease \
  			  image_name
  single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.s %.symtypes %/
@@@ -567,24 -588,31 +596,29 @@@ ifdef building_out_of_srctre
  	{ echo "# this is build directory, ignore it"; echo "*"; } > .gitignore
  endif
  
- # The expansion should be delayed until arch/$(SRCARCH)/Makefile is included.
- # Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile.
- # CC_VERSION_TEXT is referenced from Kconfig (so it needs export),
- # and from include/config/auto.conf.cmd to detect the compiler upgrade.
- CC_VERSION_TEXT = $(subst $(pound),,$(shell $(CC) --version 2>/dev/null | head -n 1))
+ TENTATIVE_CLANG_FLAGS := -Werror=unknown-warning-option
  
- ifneq ($(findstring clang,$(CC_VERSION_TEXT)),)
  ifneq ($(CROSS_COMPILE),)
- CLANG_FLAGS	+= --target=$(notdir $(CROSS_COMPILE:%-=%))
+ TENTATIVE_CLANG_FLAGS	+= --target=$(notdir $(CROSS_COMPILE:%-=%))
 -GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
 -TENTATIVE_CLANG_FLAGS	+= --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
 -GCC_TOOLCHAIN	:= $(realpath $(GCC_TOOLCHAIN_DIR)/..)
 -endif
 -ifneq ($(GCC_TOOLCHAIN),)
 -TENTATIVE_CLANG_FLAGS	+= --gcc-toolchain=$(GCC_TOOLCHAIN)
  endif
 -ifneq ($(LLVM_IAS),1)
 +ifeq ($(LLVM_IAS),1)
- CLANG_FLAGS	+= -integrated-as
++TENTATIVE_CLANG_FLAGS	+= -integrated-as
 +else
- CLANG_FLAGS	+= -no-integrated-as
+ TENTATIVE_CLANG_FLAGS	+= -no-integrated-as
 +GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
- CLANG_FLAGS	+= --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
++TENTATIVE_CLANG_FLAGS	+= --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
  endif
- CLANG_FLAGS	+= -Werror=unknown-warning-option
+ 
+ export TENTATIVE_CLANG_FLAGS
+ 
+ # The expansion should be delayed until arch/$(SRCARCH)/Makefile is included.
+ # Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile.
+ # CC_VERSION_TEXT is referenced from Kconfig (so it needs export),
+ # and from include/config/auto.conf.cmd to detect the compiler upgrade.
+ CC_VERSION_TEXT = $(shell $(CC) --version 2>/dev/null | head -n 1 | sed 's/\#//g')
+ 
+ ifneq ($(findstring clang,$(CC_VERSION_TEXT)),)
+ CLANG_FLAGS	+= $(TENTATIVE_CLANG_FLAGS)
  KBUILD_CFLAGS	+= $(CLANG_FLAGS)
  KBUILD_AFLAGS	+= $(CLANG_FLAGS)
  export CLANG_FLAGS

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: linux-next: manual merge of the rust tree with the kbuild tree
  2021-03-18  4:37 Stephen Rothwell
@ 2021-03-18  5:04 ` Miguel Ojeda
  0 siblings, 0 replies; 28+ messages in thread
From: Miguel Ojeda @ 2021-03-18  5:04 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Masahiro Yamada, Adam Bratschi-Kaye, Alex Gaynor, Finn Behrens,
	Geoffrey Thomas, Linux Kernel Mailing List,
	Linux Next Mailing List, Miguel Ojeda, Nathan Chancellor,
	Wedson Almeida Filho, Nick Desaulniers

On Thu, Mar 18, 2021 at 5:37 AM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> I fixed it up (see below - I think I got this right ...) 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.

Yeah, the TENTATIVE_CLANG_FLAGS is the workaround to support GCC I
mentioned privately. It is unfortunate that particular bit was the one
that had to give you a conflict... :-)

Longer-term, Masahiro et. al. may have better ideas on how to do the
whole trick in a cleaner way (kbuild folks: don't worry, our branch is
not going to be merged just yet ;-)

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* linux-next: manual merge of the rust tree with the kbuild tree
@ 2021-03-18  4:37 Stephen Rothwell
  2021-03-18  5:04 ` Miguel Ojeda
  0 siblings, 1 reply; 28+ messages in thread
From: Stephen Rothwell @ 2021-03-18  4:37 UTC (permalink / raw)
  To: Miguel Ojeda, Masahiro Yamada
  Cc: Adam Bratschi-Kaye, Alex Gaynor, Finn Behrens, Geoffrey Thomas,
	Linux Kernel Mailing List, Linux Next Mailing List, Miguel Ojeda,
	Nathan Chancellor, Wedson Almeida Filho

[-- Attachment #1: Type: text/plain, Size: 3779 bytes --]

Hi all,

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

  Makefile

between commits:

  a14efe0d73eb ("kbuild: include Makefile.compiler only when compiler is needed")
  9fc2872b700a ("Makefile: Remove '--gcc-toolchain' flag")
  71eb5c859a59 ("Makefile: Only specify '--prefix=' when building with clang + GNU as")
  884a7fa1b090 ("kbuild: replace sed with $(subst ) or $(patsubst )")

from the kbuild tree and commit:

  c77c8025525c ("Rust support")

from the rust tree.

I fixed it up (see below - I think I got this right ...) 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 cc5b7e39fde4,6e6562591a91..000000000000
--- a/Makefile
+++ b/Makefile
@@@ -263,11 -270,7 +270,11 @@@ no-dot-config-targets := $(clean-target
  			 cscope gtags TAGS tags help% %docs check% coccicheck \
  			 $(version_h) headers headers_% archheaders archscripts \
  			 %asm-generic kernelversion %src-pkg dt_binding_check \
- 			 outputmakefile
+ 			 outputmakefile rustfmt rustfmtcheck
 +# Installation targets should not require compiler. Unfortunately, vdso_install
 +# is an exception where build artifacts may be updated. This must be fixed.
 +no-compiler-targets := $(no-dot-config-targets) install dtbs_install \
 +			headers_install modules_install kernelrelease image_name
  no-sync-config-targets := $(no-dot-config-targets) %install kernelrelease \
  			  image_name
  single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.s %.symtypes %/
@@@ -570,22 -588,31 +599,27 @@@ ifdef building_out_of_srctre
  	{ echo "# this is build directory, ignore it"; echo "*"; } > .gitignore
  endif
  
+ TENTATIVE_CLANG_FLAGS := -Werror=unknown-warning-option
+ 
+ ifneq ($(CROSS_COMPILE),)
+ TENTATIVE_CLANG_FLAGS	+= --target=$(notdir $(CROSS_COMPILE:%-=%))
 -GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
 -TENTATIVE_CLANG_FLAGS	+= --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
 -GCC_TOOLCHAIN	:= $(realpath $(GCC_TOOLCHAIN_DIR)/..)
 -endif
 -ifneq ($(GCC_TOOLCHAIN),)
 -TENTATIVE_CLANG_FLAGS	+= --gcc-toolchain=$(GCC_TOOLCHAIN)
+ endif
+ ifneq ($(LLVM_IAS),1)
+ TENTATIVE_CLANG_FLAGS	+= -no-integrated-as
++GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
++TENTATIVE_CLANG_FLAGS	+= --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
+ endif
+ 
+ export TENTATIVE_CLANG_FLAGS
+ 
  # The expansion should be delayed until arch/$(SRCARCH)/Makefile is included.
  # Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile.
  # CC_VERSION_TEXT is referenced from Kconfig (so it needs export),
  # and from include/config/auto.conf.cmd to detect the compiler upgrade.
 -CC_VERSION_TEXT = $(shell $(CC) --version 2>/dev/null | head -n 1 | sed 's/\#//g')
 +CC_VERSION_TEXT = $(subst $(pound),,$(shell $(CC) --version 2>/dev/null | head -n 1))
  
  ifneq ($(findstring clang,$(CC_VERSION_TEXT)),)
- ifneq ($(CROSS_COMPILE),)
- CLANG_FLAGS	+= --target=$(notdir $(CROSS_COMPILE:%-=%))
- endif
- ifneq ($(LLVM_IAS),1)
- CLANG_FLAGS	+= -no-integrated-as
- GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
- CLANG_FLAGS	+= --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
- endif
- CLANG_FLAGS	+= -Werror=unknown-warning-option
+ CLANG_FLAGS	+= $(TENTATIVE_CLANG_FLAGS)
  KBUILD_CFLAGS	+= $(CLANG_FLAGS)
  KBUILD_AFLAGS	+= $(CLANG_FLAGS)
  export CLANG_FLAGS

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2022-10-04 22:24 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-15  7:24 linux-next: manual merge of the rust tree with the kbuild tree Stephen Rothwell
2021-10-15 12:24 ` Miguel Ojeda
2021-10-28  9:09 ` Stephen Rothwell
2021-10-28 11:06   ` Miguel Ojeda
  -- strict thread matches above, loose matches on Subject: below --
2022-09-27 18:16 broonie
2022-09-28 17:16 ` Miguel Ojeda
2022-10-04 22:23 ` Stephen Rothwell
2022-09-26 23:12 broonie
2022-09-27 12:47 ` Miguel Ojeda
2022-09-12  7:41 Stephen Rothwell
2022-08-02 23:38 broonie
2022-08-03  9:28 ` Miguel Ojeda
2022-08-14 23:08 ` Stephen Rothwell
2022-04-05  3:14 Stephen Rothwell
2022-04-05  8:33 ` Miguel Ojeda
2022-03-17  6:02 Stephen Rothwell
2022-03-17  7:11 ` Miguel Ojeda
2022-01-17 23:51 Stephen Rothwell
2021-12-07  5:13 Stephen Rothwell
2021-12-03  5:20 Stephen Rothwell
2021-12-03  9:05 ` Miguel Ojeda
2021-10-06  5:46 Stephen Rothwell
2021-08-11  7:26 Stephen Rothwell
2021-08-11 17:04 ` Nick Desaulniers
2021-08-12  6:34   ` Stephen Rothwell
2021-03-29  7:32 Stephen Rothwell
2021-03-18  4:37 Stephen Rothwell
2021-03-18  5:04 ` Miguel Ojeda

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.