From: Zhao Liu <zhao1.liu@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-rust@nongnu.org
Subject: Re: [PATCH] rust: Prefer link_with over link_whole
Date: Wed, 19 Feb 2025 01:50:27 +0800 [thread overview]
Message-ID: <Z7TIY2YWBahIElOb@intel.com> (raw)
In-Reply-To: <88a20e34-5aa8-4351-a33f-4df110933e35@redhat.com>
On Tue, Feb 18, 2025 at 09:58:44AM +0100, Paolo Bonzini wrote:
> Date: Tue, 18 Feb 2025 09:58:44 +0100
> From: Paolo Bonzini <pbonzini@redhat.com>
> Subject: Re: [PATCH] rust: Prefer link_with over link_whole
>
> On 2/18/25 09:37, Zhao Liu wrote:
> > The commit fccb744f41c6 ("gdbstub: Try unlinking the unix socket before
> > binding") causes the compilation of rust-qemu-api-integration to fail,
> > because rust-qemu-api-integration uses link_whole which meets the
> > duplicate symbol linker error.
> >
> > Though it's not the issue of link_whole used by Rust side, there's no
> > need to use link_whole.
> >
> > Use link_with, which may also bring some benefits, such as faster
> > linking or smaller output files.
>
> link_with, if I remember correctly, drops the constructors. Using it in
> rust_devices_ss therefore prevents the devices from being registered with
> QOM.
Interesting, I test with link_with and HPET QOM type can be registered.
I find this is because `module_init` macro adds `#[used]` for `LOAD_MODULE`,
which prevents linker dropping QOM type.
Without `#[used]`, both link_with and link_whole will optimize
`LOAD_MODULE`... So here `#[used]` is the key to getting everything to work
properly.
> The real issue is lack of support for "objects" in Meson for Rust
> executables. A patch to fix that is under review, after which it will be
> possible to build Rust executables using the same "dependency" objects as C
> code.
HMM, but with link_with, everything seems to compile fine?
Thanks,
Zhao
prev parent reply other threads:[~2025-02-18 17:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-18 8:37 [PATCH] rust: Prefer link_with over link_whole Zhao Liu
2025-02-18 8:58 ` Paolo Bonzini
2025-02-18 17:50 ` Zhao Liu [this message]
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=Z7TIY2YWBahIElOb@intel.com \
--to=zhao1.liu@intel.com \
--cc=pbonzini@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 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.