Re: [PATCH 07/11] meson: let Meson handle mixed-language linking of Rust and C objects

Zhao Liu <[email protected]>
Newsgroups org.nongnu.qemu-rust,org.nongnu.qemu-devel
Message-ID <[email protected]>
On Mon, Dec 15, 2025 at 08:49:56AM +0100, Paolo Bonzini wrote:
> Date: Mon, 15 Dec 2025 08:49:56 +0100
> From: Paolo Bonzini <[email protected]>
> Subject: [PATCH 07/11] meson: let Meson handle mixed-language linking of
>  Rust and C objects
> X-Mailer: git-send-email 2.52.0
> 
> With the bump to Meson 1.10.0, C objects can be passed to rust targets.
> This way, the Rust libstd will be added by rustc itself in its final
> linker invocation.  Use that to eliminate the staticlib and allow
> dynamic linking with libstd (also introduced by Meson 1.9.0, but not
> for staticlib crates due to lack of support in rustc).
> 
> The main() function is still provided by C, which is possible by
> declaring the main source file of the Rust executable (which is
> still created by scripts/rust/rust_root_crate.sh) as #![no_main].
> 
> Signed-off-by: Paolo Bonzini <[email protected]>
> ---
>  meson.build                     | 19 ++++++++-----------
>  scripts/rust/rust_root_crate.sh |  1 +
>  2 files changed, 9 insertions(+), 11 deletions(-)

Reviewed-by: Zhao Liu <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.