* [PATCH] rust: remove spurious compiler_builtins dependents
@ 2025-04-08 18:52 Tamir Duberstein
2025-04-24 10:40 ` Tamir Duberstein
0 siblings, 1 reply; 3+ messages in thread
From: Tamir Duberstein @ 2025-04-08 18:52 UTC (permalink / raw)
To: Miguel Ojeda, Lukas Fischer, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich
Cc: rust-for-linux, linux-kernel, Tamir Duberstein
The dependency on `compiler_builtins.o` was first added in commit
2f7ab1267dc9 ("Kbuild: add Rust support") to `alloc` which matches the
standard library[0] but was copied to other targets in:
- commit ecaa6ddff2fd ("rust: add `build_error` crate")
- commit d072acda4862 ("rust: use custom FFI integer types")
- commit 4e1746656839 ("rust: uapi: Add UAPI crate")
- commit d7659acca7a3 ("rust: add pin-init crate build infrastructure")
The alloc crate was removed in commit 392e34b6bc22 ("kbuild: rust:
remove the `alloc` crate and `GlobalAlloc`"). As fas as I can tell none
of the other dependencies are required; it is only required that
compiler_builtins be linked into the rust-enabled kernel. In the
standard library, compiler_builtins is a dependency of std[1].
Remove these dependency edges. Add a dependency edge from
`compiler_builtins` to `core` to `scripts/generate_rust_analyzer.py` to
match `rust/Makefile`. This has been incorrect since commit 8c4555ccc55c
("scripts: add `generate_rust_analyzer.py`")
Link: https://github.com/rust-lang/rust/blob/f820b75feef00654924c9351a2faca8d34818339/library/alloc/Cargo.toml#L19 [0]
Link: https://github.com/rust-lang/rust/blob/f820b75feef00654924c9351a2faca8d34818339/library/std/Cargo.toml#L21 [1]
Link: https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/rust-analyzer.20improvements/near/510200959
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
rust/Makefile | 6 +++---
scripts/generate_rust_analyzer.py | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/rust/Makefile b/rust/Makefile
index fa0eea8a9eca..eb0590a77e95 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -501,16 +501,16 @@ $(obj)/compiler_builtins.o: $(src)/compiler_builtins.rs $(obj)/core.o FORCE
$(obj)/pin_init.o: private skip_gendwarfksyms = 1
$(obj)/pin_init.o: private rustc_target_flags = --extern pin_init_internal \
--extern macros --cfg kernel
-$(obj)/pin_init.o: $(src)/pin-init/src/lib.rs $(obj)/compiler_builtins.o \
+$(obj)/pin_init.o: $(src)/pin-init/src/lib.rs \
$(obj)/$(libpin_init_internal_name) $(obj)/$(libmacros_name) FORCE
+$(call if_changed_rule,rustc_library)
$(obj)/build_error.o: private skip_gendwarfksyms = 1
-$(obj)/build_error.o: $(src)/build_error.rs $(obj)/compiler_builtins.o FORCE
+$(obj)/build_error.o: $(src)/build_error.rs FORCE
+$(call if_changed_rule,rustc_library)
$(obj)/ffi.o: private skip_gendwarfksyms = 1
-$(obj)/ffi.o: $(src)/ffi.rs $(obj)/compiler_builtins.o FORCE
+$(obj)/ffi.o: $(src)/ffi.rs FORCE
+$(call if_changed_rule,rustc_library)
$(obj)/bindings.o: private rustc_target_flags = --extern ffi
diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_analyzer.py
index cd41bc906fbd..b573349d688c 100755
--- a/scripts/generate_rust_analyzer.py
+++ b/scripts/generate_rust_analyzer.py
@@ -81,7 +81,7 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs):
append_crate(
"compiler_builtins",
srctree / "rust" / "compiler_builtins.rs",
- [],
+ ["core"],
)
append_crate(
@@ -94,7 +94,7 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs):
append_crate(
"build_error",
srctree / "rust" / "build_error.rs",
- ["core", "compiler_builtins"],
+ ["core"],
)
append_crate(
---
base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
change-id: 20250408-rust-remove-compiler-builtins-deps-1f061024dfce
Best regards,
--
Tamir Duberstein <tamird@gmail.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] rust: remove spurious compiler_builtins dependents
2025-04-08 18:52 [PATCH] rust: remove spurious compiler_builtins dependents Tamir Duberstein
@ 2025-04-24 10:40 ` Tamir Duberstein
2025-05-12 20:21 ` Tamir Duberstein
0 siblings, 1 reply; 3+ messages in thread
From: Tamir Duberstein @ 2025-04-24 10:40 UTC (permalink / raw)
To: Miguel Ojeda, Lukas Fischer, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich
Cc: rust-for-linux, linux-kernel
On Tue, Apr 8, 2025 at 2:52 PM Tamir Duberstein <tamird@gmail.com> wrote:
>
> The dependency on `compiler_builtins.o` was first added in commit
> 2f7ab1267dc9 ("Kbuild: add Rust support") to `alloc` which matches the
> standard library[0] but was copied to other targets in:
> - commit ecaa6ddff2fd ("rust: add `build_error` crate")
> - commit d072acda4862 ("rust: use custom FFI integer types")
> - commit 4e1746656839 ("rust: uapi: Add UAPI crate")
> - commit d7659acca7a3 ("rust: add pin-init crate build infrastructure")
>
> The alloc crate was removed in commit 392e34b6bc22 ("kbuild: rust:
> remove the `alloc` crate and `GlobalAlloc`"). As fas as I can tell none
> of the other dependencies are required; it is only required that
> compiler_builtins be linked into the rust-enabled kernel. In the
> standard library, compiler_builtins is a dependency of std[1].
>
> Remove these dependency edges. Add a dependency edge from
> `compiler_builtins` to `core` to `scripts/generate_rust_analyzer.py` to
> match `rust/Makefile`. This has been incorrect since commit 8c4555ccc55c
> ("scripts: add `generate_rust_analyzer.py`")
>
> Link: https://github.com/rust-lang/rust/blob/f820b75feef00654924c9351a2faca8d34818339/library/alloc/Cargo.toml#L19 [0]
> Link: https://github.com/rust-lang/rust/blob/f820b75feef00654924c9351a2faca8d34818339/library/std/Cargo.toml#L21 [1]
> Link: https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/rust-analyzer.20improvements/near/510200959
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>
@Miguel do you have opinions on this?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] rust: remove spurious compiler_builtins dependents
2025-04-24 10:40 ` Tamir Duberstein
@ 2025-05-12 20:21 ` Tamir Duberstein
0 siblings, 0 replies; 3+ messages in thread
From: Tamir Duberstein @ 2025-05-12 20:21 UTC (permalink / raw)
To: Miguel Ojeda, Lukas Fischer, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich
Cc: rust-for-linux, linux-kernel
On Thu, Apr 24, 2025 at 6:40 AM Tamir Duberstein <tamird@gmail.com> wrote:
>
> On Tue, Apr 8, 2025 at 2:52 PM Tamir Duberstein <tamird@gmail.com> wrote:
> >
> > The dependency on `compiler_builtins.o` was first added in commit
> > 2f7ab1267dc9 ("Kbuild: add Rust support") to `alloc` which matches the
> > standard library[0] but was copied to other targets in:
> > - commit ecaa6ddff2fd ("rust: add `build_error` crate")
> > - commit d072acda4862 ("rust: use custom FFI integer types")
> > - commit 4e1746656839 ("rust: uapi: Add UAPI crate")
> > - commit d7659acca7a3 ("rust: add pin-init crate build infrastructure")
> >
> > The alloc crate was removed in commit 392e34b6bc22 ("kbuild: rust:
> > remove the `alloc` crate and `GlobalAlloc`"). As fas as I can tell none
> > of the other dependencies are required; it is only required that
> > compiler_builtins be linked into the rust-enabled kernel. In the
> > standard library, compiler_builtins is a dependency of std[1].
> >
> > Remove these dependency edges. Add a dependency edge from
> > `compiler_builtins` to `core` to `scripts/generate_rust_analyzer.py` to
> > match `rust/Makefile`. This has been incorrect since commit 8c4555ccc55c
> > ("scripts: add `generate_rust_analyzer.py`")
> >
> > Link: https://github.com/rust-lang/rust/blob/f820b75feef00654924c9351a2faca8d34818339/library/alloc/Cargo.toml#L19 [0]
> > Link: https://github.com/rust-lang/rust/blob/f820b75feef00654924c9351a2faca8d34818339/library/std/Cargo.toml#L21 [1]
> > Link: https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/rust-analyzer.20improvements/near/510200959
> > Signed-off-by: Tamir Duberstein <tamird@gmail.com>
>
> @Miguel do you have opinions on this?
Gentle ping.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-05-12 20:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-08 18:52 [PATCH] rust: remove spurious compiler_builtins dependents Tamir Duberstein
2025-04-24 10:40 ` Tamir Duberstein
2025-05-12 20:21 ` Tamir Duberstein
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).