Skip to content

Support linking modifiers #689

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

Closed
lf- opened this issue Jun 16, 2022 · 1 comment · Fixed by #671
Closed

Support linking modifiers #689

lf- opened this issue Jun 16, 2022 · 1 comment · Fixed by #671

Comments

@lf-
Copy link

lf- commented Jun 16, 2022

Since a recent stabilization, rustc supports modifiers such as whole-archive for doing linking (rust-lang/rust#93901 (comment)). whole-archive is useful for cdylib crates that do their main initialization with ctors and thus are liable to have the C components be garbage collected by the linker to confusing results.

Currently it seems that cc emits the rustc-link-lib directive to cargo in such a way that it isn't possible to specify modifiers: https://docs.rs/cc/latest/src/cc/lib.rs.html#1017

It would be great if these modifiers could be specified in the Build builder.

docs on rustc side: https://doc.rust-lang.org/rustc/command-line-arguments.html#-l-link-the-generated-crate-to-a-native-library

@petrochenkov
Copy link
Contributor

PR for this - #671.
Workaround - #671 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants