qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rust: devices are not staticlibs
@ 2025-07-21 10:52 Paolo Bonzini
  2025-07-21 11:00 ` Manos Pitsidianakis
  2025-07-22 14:39 ` Zhao Liu
  0 siblings, 2 replies; 4+ messages in thread
From: Paolo Bonzini @ 2025-07-21 10:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-rust

This is only cosmetic for now, but hopefully later on Meson will parse more
of Cargo.toml.  Devices are linked into a staticlib but are not staticlibs
themselves.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 rust/hw/char/pl011/Cargo.toml | 3 ---
 rust/hw/timer/hpet/Cargo.toml | 3 ---
 2 files changed, 6 deletions(-)

diff --git a/rust/hw/char/pl011/Cargo.toml b/rust/hw/char/pl011/Cargo.toml
index 003ef9613d4..88ef110507d 100644
--- a/rust/hw/char/pl011/Cargo.toml
+++ b/rust/hw/char/pl011/Cargo.toml
@@ -12,9 +12,6 @@ license.workspace = true
 repository.workspace = true
 rust-version.workspace = true
 
-[lib]
-crate-type = ["staticlib"]
-
 [dependencies]
 bilge = { version = "0.2.0" }
 bilge-impl = { version = "0.2.0" }
diff --git a/rust/hw/timer/hpet/Cargo.toml b/rust/hw/timer/hpet/Cargo.toml
index 6f075027843..ac5df23c1d0 100644
--- a/rust/hw/timer/hpet/Cargo.toml
+++ b/rust/hw/timer/hpet/Cargo.toml
@@ -10,9 +10,6 @@ license.workspace = true
 repository.workspace = true
 rust-version.workspace = true
 
-[lib]
-crate-type = ["staticlib"]
-
 [dependencies]
 qemu_api = { path = "../../../qemu-api" }
 qemu_api_macros = { path = "../../../qemu-api-macros" }
-- 
2.50.1



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

* Re: [PATCH] rust: devices are not staticlibs
  2025-07-21 10:52 [PATCH] rust: devices are not staticlibs Paolo Bonzini
@ 2025-07-21 11:00 ` Manos Pitsidianakis
  2025-07-21 11:29   ` Paolo Bonzini
  2025-07-22 14:39 ` Zhao Liu
  1 sibling, 1 reply; 4+ messages in thread
From: Manos Pitsidianakis @ 2025-07-21 11:00 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, qemu-rust

Hi Paolo,

On Mon, Jul 21, 2025 at 1:53 PM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> This is only cosmetic for now, but hopefully later on Meson will parse more
> of Cargo.toml.  Devices are linked into a staticlib but are not staticlibs
> themselves.

Does meson compile them as rlibs instead of staticlibs?

-- 
Manos Pitsidianakis
Emulation and Virtualization Engineer at Linaro Ltd


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

* Re: [PATCH] rust: devices are not staticlibs
  2025-07-21 11:00 ` Manos Pitsidianakis
@ 2025-07-21 11:29   ` Paolo Bonzini
  0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2025-07-21 11:29 UTC (permalink / raw)
  To: Manos Pitsidianakis; +Cc: qemu-devel, qemu-rust

On Mon, Jul 21, 2025 at 1:01 PM Manos Pitsidianakis
<manos.pitsidianakis@linaro.org> wrote:
>
> Hi Paolo,
>
> On Mon, Jul 21, 2025 at 1:53 PM Paolo Bonzini <pbonzini@redhat.com> wrote:
> >
> > This is only cosmetic for now, but hopefully later on Meson will parse more
> > of Cargo.toml.  Devices are linked into a staticlib but are not staticlibs
> > themselves.
>
> Does meson compile them as rlibs instead of staticlibs?

Yes, see "rust_abi: 'rust'". I think you can't even do "extern crate"
with a staticlib - the only staticlib is the per-target one that is
put together via scripts/rust/rust_root_crate.sh.

In theory https://github.com/mesonbuild/meson/pull/14818 should allow
removing the staticlib as well, using rustc instead of gcc to create
the final executable even if it has system/main.c listed as one of its
sources. Executables should than be smaller or they can use dynamic
libstd. I haven't tested that yet though...

Paolo



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

* Re: [PATCH] rust: devices are not staticlibs
  2025-07-21 10:52 [PATCH] rust: devices are not staticlibs Paolo Bonzini
  2025-07-21 11:00 ` Manos Pitsidianakis
@ 2025-07-22 14:39 ` Zhao Liu
  1 sibling, 0 replies; 4+ messages in thread
From: Zhao Liu @ 2025-07-22 14:39 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, qemu-rust

On Mon, Jul 21, 2025 at 12:52:38PM +0200, Paolo Bonzini wrote:
> Date: Mon, 21 Jul 2025 12:52:38 +0200
> From: Paolo Bonzini <pbonzini@redhat.com>
> Subject: [PATCH] rust: devices are not staticlibs
> X-Mailer: git-send-email 2.50.1
> 
> This is only cosmetic for now, but hopefully later on Meson will parse more
> of Cargo.toml.  Devices are linked into a staticlib but are not staticlibs
> themselves.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  rust/hw/char/pl011/Cargo.toml | 3 ---
>  rust/hw/timer/hpet/Cargo.toml | 3 ---
>  2 files changed, 6 deletions(-)

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>



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

end of thread, other threads:[~2025-07-22 14:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-21 10:52 [PATCH] rust: devices are not staticlibs Paolo Bonzini
2025-07-21 11:00 ` Manos Pitsidianakis
2025-07-21 11:29   ` Paolo Bonzini
2025-07-22 14:39 ` Zhao Liu

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