linux-next: manual merge of the rust tree with Linus' tree
Hi all,
Today's linux-next merge of the rust tree got conflicts in:
Makefile
scripts/Makefile.modfinal
between commit:
9741e07ece7c ("kbuild: Unify options for BTF generation for vmlinux and modules")
from Linus' tree and commit:
fcd48fa27403 ("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.
Signature · 58 lines
Cheers,
Stephen Rothwell
diff --cc Makefile
index 8581ffca7f96,c4dd2c6b55e4..000000000000
--- a/Makefile
+++ b/Makefile
@@@ -533,10 -572,10 +574,11 @@@ export KBUILD_HOSTCXXFLAGS KBUILD_HOSTL
export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS
export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
+ export KBUILD_RUST_TARGET KBUILD_RUSTFLAGS RUSTFLAGS_KERNEL RUSTFLAGS_MODULE
export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
- export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
- export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
+ export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_RUSTFLAGS_MODULE KBUILD_LDFLAGS_MODULE
+ export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL KBUILD_RUSTFLAGS_KERNEL
+export PAHOLE_FLAGS
# Files to ignore in find ... statements
@@@ -1089,9 -1203,12 +1167,13 @@@ export MODORDER := $(extmod_prefix)modu
export MODULES_NSDEPS := $(extmod_prefix)modules.nsdeps
ifeq ($(KBUILD_EXTMOD),)
-core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/
+core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/
+core-$(CONFIG_BLOCK) += block/
+ ifdef CONFIG_RUST
+ core-y += rust/
+ endif
+
vmlinux-dirs := $(patsubst %/,%,$(filter %/, \
$(core-y) $(core-m) $(drivers-y) $(drivers-m) \
$(libs-y) $(libs-m)))
diff --cc scripts/Makefile.modfinal
index 7f39599e9fae,c0842e999a75..000000000000
--- a/scripts/Makefile.modfinal
+++ b/scripts/Makefile.modfinal
@@@ -39,11 -39,12 +39,12 @@@ quiet_cmd_ld_ko_o = LD [M] $
quiet_cmd_btf_ko = BTF [M] $@
cmd_btf_ko = \
- if [ -f vmlinux ]; then \
- LLVM_OBJCOPY="$(OBJCOPY)" $(PAHOLE) -J $(PAHOLE_FLAGS) --btf_base vmlinux $@; \
- $(RESOLVE_BTFIDS) -b vmlinux $@; \
- else \
+ if [ ! -f vmlinux ]; then \
printf "Skipping BTF generation for %s due to unavailability of vmlinux\n" $@ 1>&2; \
+ elif $(srctree)/scripts/is_rust_module.sh $@; then \
+ printf "Skipping BTF generation for %s because it's a Rust module\n" $@ 1>&2; \
+ else \
- LLVM_OBJCOPY="$(OBJCOPY)" $(PAHOLE) -J --btf_base vmlinux $@; \
++ LLVM_OBJCOPY="$(OBJCOPY)" $(PAHOLE) -J $(PAHOLE_FLAGS) --btf_base vmlinux $@; \
fi;
# Same as newer-prereqs, but allows to exclude specified extra dependenciesHi Stephen,
Quoted 11 lines · Stephen Rothwell
scripts/Makefile.modfinal +0
-2@@@ -39,11 -39,12 +39,12 @@@ quiet_cmd_ld_ko_o = LD [M] $ quiet_cmd_btf_ko = BTF [M] $@ cmd_btf_ko = \ - if [ -f vmlinux ]; then \ - LLVM_OBJCOPY="$(OBJCOPY)" $(PAHOLE) -J $(PAHOLE_FLAGS) --btf_base vmlinux $@; \
scripts/Makefile.modfinal
Quoted 10 lines
scripts/Makefile.modfinal +5
-2- $(RESOLVE_BTFIDS) -b vmlinux $@; \ - else \ + if [ ! -f vmlinux ]; then \ printf "Skipping BTF generation for %s due to unavailability of vmlinux\n" $@ 1>&2; \ + elif $(srctree)/scripts/is_rust_module.sh $@; then \ + printf "Skipping BTF generation for %s because it's a Rust module\n" $@ 1>&2; \ + else \ - LLVM_OBJCOPY="$(OBJCOPY)" $(PAHOLE) -J --btf_base vmlinux $@; \ ++ LLVM_OBJCOPY="$(OBJCOPY)" $(PAHOLE) -J $(PAHOLE_FLAGS) --btf_base vmlinux $@; \ fi;
It looks like the $(RESOLVE_BTFIDS) line is gone with this resolution. The rest looks good.
Thanks!
Cheers,
Miguel
Hi Miguel,
Quoted 18 lines · On Wed, 3 Nov 2021 11:30:35 +0100 Miguel Ojeda…
Quoted 16 lines · Stephen Rothwell
scripts/Makefile.modfinal +2
-4@@@ -39,11 -39,12 +39,12 @@@ quiet_cmd_ld_ko_o = LD [M] $ quiet_cmd_btf_ko = BTF [M] $@ cmd_btf_ko = \ - if [ -f vmlinux ]; then \ - LLVM_OBJCOPY="$(OBJCOPY)" $(PAHOLE) -J $(PAHOLE_FLAGS) --btf_base vmlinux $@; \ - $(RESOLVE_BTFIDS) -b vmlinux $@; \ - else \ + if [ ! -f vmlinux ]; then \ printf "Skipping BTF generation for %s due to unavailability of vmlinux\n" $@ 1>&2; \ + elif $(srctree)/scripts/is_rust_module.sh $@; then \
Quoted 8 lines
scripts/Makefile.modfinal
Quoted 5 lines
scripts/Makefile.modfinal +3
-0+ printf "Skipping BTF generation for %s because it's a Rust module\n" $@ 1>&2; \ + else \ - LLVM_OBJCOPY="$(OBJCOPY)" $(PAHOLE) -J --btf_base vmlinux $@; \ ++ LLVM_OBJCOPY="$(OBJCOPY)" $(PAHOLE) -J $(PAHOLE_FLAGS) --btf_base vmlinux $@; \ fi;It looks like the
$(RESOLVE_BTFIDS)line is gone with this resolution. The rest looks good.
Oops, sorry about that. I have added it back from today.
BTW, are you intending to submit the rust tree this merge window?
Signature · 2 lines
Cheers, Stephen Rothwell
Quoted 2 lines · Stephen Rothwell
Oops, sorry about that. I have added it back from today.
No worries! By the way, I will be rebasing soon to fix a build error that happened due to some changes in mainline, so the conflict will disappear.
Quoted 1 line
BTW, are you intending to submit the rust tree this merge window?
That was the idea, but a few things need to be taken care of before. In any case, I was told to start submitting it every couple weeks or so, so I think Linus et. al. do not mind if it aligns to a merge window or not (though I might be wrong...).
Cheers,
Miguel
Hi Miguel,
Quoted 8 lines · On Thu, 4 Nov 2021 13:19:22 +0100 Miguel Ojeda…
Quoted 2 lines · Stephen Rothwell
Oops, sorry about that. I have added it back from today.
No worries! By the way, I will be rebasing soon to fix a build error that happened due to some changes in mainline, so the conflict will disappear.
I would suggest that you don't rebase if you are intending to submit to Linus. Instead, do a test merge with his tree and fix the issue in the merge and test that, then explain it all the in the pull request (but ask him to pull your tree without the merge).
Quoted 6 lines
Quoted 1 line
BTW, are you intending to submit the rust tree this merge window?
That was the idea, but a few things need to be taken care of before. In any case, I was told to start submitting it every couple weeks or so, so I think Linus et. al. do not mind if it aligns to a merge window or not (though I might be wrong...).
Much better to do it in the merge window. Linus almost never takes new features outside a merge window (but you could always ask him).
Signature · 2 lines
Cheers, Stephen Rothwell
Quoted 5 lines · Stephen Rothwell
I would suggest that you don't rebase if you are intending to submit to Linus. Instead, do a test merge with his tree and fix the issue in the merge and test that, then explain it all the in the pull request (but ask him to pull your tree without the merge).
Note that I am still submitting this as patches, not as a PR. After we are in, yes, of course!
Cheers,
Miguel