qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-rust@nongnu.org, marcandre.lureau@redhat.com
Subject: [PATCH 05/11] rust: only link the Rust part of the code into devices
Date: Mon, 15 Dec 2025 08:49:54 +0100	[thread overview]
Message-ID: <20251215075000.335043-6-pbonzini@redhat.com> (raw)
In-Reply-To: <20251215075000.335043-1-pbonzini@redhat.com>

Do not include libqemuutil in the device crates for the same
reason as in the previous commit.  Static libraries like qemuutil
are sensitive to their position on the command line and rustc does not
always get it right.

If rustc places the library too early on the command line, the stubs
are included in the final link product, which results in duplicate
symbols.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 rust/hw/char/pl011/meson.build | 18 ++++++++++--------
 rust/hw/timer/hpet/meson.build | 18 +++++++++---------
 2 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/rust/hw/char/pl011/meson.build b/rust/hw/char/pl011/meson.build
index 33b91f21911..9c0e8290e9a 100644
--- a/rust/hw/char/pl011/meson.build
+++ b/rust/hw/char/pl011/meson.build
@@ -28,20 +28,22 @@ _libpl011_rs = static_library(
   ),
   override_options: ['rust_std=2021', 'build.rust_std=2021'],
   rust_abi: 'rust',
+  link_with: [
+    _util_rs,
+    _migration_rs,
+    _bql_rs,
+    _qom_rs,
+    _chardev_rs,
+    _system_rs,
+    _hwcore_rs,
+    _trace_rs
+  ],
   dependencies: [
     bilge_rs,
     bilge_impl_rs,
     bits_rs,
     common_rs,
     glib_sys_rs,
-    util_rs,
-    migration_rs,
-    bql_rs,
-    qom_rs,
-    chardev_rs,
-    system_rs,
-    hwcore_rs,
-    trace_rs
   ],
 )
 
diff --git a/rust/hw/timer/hpet/meson.build b/rust/hw/timer/hpet/meson.build
index 9a3dd62caa3..3bb7ce2a6ca 100644
--- a/rust/hw/timer/hpet/meson.build
+++ b/rust/hw/timer/hpet/meson.build
@@ -3,16 +3,16 @@ _libhpet_rs = static_library(
   files('src/lib.rs'),
   override_options: ['rust_std=2021', 'build.rust_std=2021'],
   rust_abi: 'rust',
-  dependencies: [
-    common_rs,
-    util_rs,
-    migration_rs,
-    bql_rs,
-    qom_rs,
-    system_rs,
-    hwcore_rs,
-    trace_rs,
+  link_with: [
+    _util_rs,
+    _migration_rs,
+    _bql_rs,
+    _qom_rs,
+    _system_rs,
+    _hwcore_rs,
+    _trace_rs,
   ],
+  dependencies: [common_rs],
 )
 
 rust_devices_ss.add(when: 'CONFIG_X_HPET_RUST', if_true: [declare_dependency(
-- 
2.52.0



  parent reply	other threads:[~2025-12-15  7:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-15  7:49 [PATCH for 11.0 00/11] First batch of Meson/Rust build system changes Paolo Bonzini
2025-12-15  7:49 ` [PATCH 01/11] build: do not include @block.syms/@qemu.sys with modules disabled Paolo Bonzini
2025-12-15  7:49 ` [PATCH 02/11] tests/meson: do not reuse migration_files variable Paolo Bonzini
2025-12-15  7:49 ` [PATCH 04/11] rust: Do not link qemuutil into Rust rlibs Paolo Bonzini
2025-12-17  3:37   ` Zhao Liu
2025-12-15  7:49 ` Paolo Bonzini [this message]
2025-12-17  3:42   ` [PATCH 05/11] rust: only link the Rust part of the code into devices Zhao Liu
2025-12-15  7:49 ` [PATCH 06/11] rust: Meson now adds -Cdefault-linker-libraries Paolo Bonzini
2025-12-17  3:43   ` Zhao Liu
2025-12-15  7:49 ` [PATCH 07/11] meson: let Meson handle mixed-language linking of Rust and C objects Paolo Bonzini
2025-12-15  7:49 ` [PATCH 08/11] rust: skip compilation if there are no system emulators Paolo Bonzini
2025-12-17  3:55   ` Zhao Liu
2025-12-15  7:49 ` [PATCH 09/11] lcitool: enable Rust for Windows cross targets Paolo Bonzini
2025-12-15 13:01   ` Alex Bennée
2025-12-15  7:49 ` [PATCH 10/11] cirrus/macos: enable Rust Paolo Bonzini
2025-12-15  7:50 ` [PATCH 11/11] gitlab-ci: enable rust for msys2-64bit Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251215075000.335043-6-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-rust@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).