Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust: allow linking with dynamic libstd #14224

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bonzini
Copy link
Collaborator

@bonzini bonzini commented Feb 5, 2025

As a first step towards fixing #8828, allow linking Rust bin crates with dynamic libstd.

staticlib and cdylib crates cannot yet do this, but this can be extended later on; in the meanwhile, this PR creates the API with a minimal implementation.

@bonzini bonzini force-pushed the rust-dynamic-std branch 3 times, most recently from df1552f to daf6d4a Compare February 5, 2025 10:37
@bonzini bonzini marked this pull request as ready for review February 5, 2025 12:22
Allow adding extra directories to the rpath.  Rust needs this when Rustup
is in use.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
RustCompiler.build_rpath_args works by appending the directory to the
arguments computed by self.linker.build_rpath_args.  This does not
work if there is no argument to begin with, which happens for example
in program crates.

Use the new extra_paths argument to force inclusion of the libdir into
the rpath of the binary, even in that case.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
As an initial implementation, simply adding "-C prefer-dynamic" works
for binary crates (as well as dylib and proc-macro that already used it).
In the future this could be extended to other crate types.  For more
information see the comment in the changed file, as well as
mesonbuild#8828 and
mesonbuild#14215.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant