-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Propagate linker args upwards in the dependency graph. #7612
Conversation
Suggestion from @froydnj to enable a build script to pass linker args relevant for dependencies of a crate. The use case is to allow specifying "-Wl,-undefined,dynamic_lookup" on MacOS for dynamic library crates with undefined symbols, such as a symbol defined in the program loading the library. We can consider supporting this case in rustc itself to avoid the need for platform-specific flags in typical cdylib cases. But this seems like an independently-useful mechanism that could enable workaround for other linking problems, as well. Enables workaround for #62874
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Eh2406 (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Thanks for the PR! I would unfortunately though have similar concerns for this as I would for rust-lang/rust#66204. Linker arguments are really hard, and this is unfortunately likely to cause regressions by changing the behavior of link argument propagation. I think to fix this we'd likely want to add a new directive for Cargo which specifically requests the transitive propagation of link arguments. Additionally this will need tests. For example link arguments from proc macros should not be propagated. |
Alex or somebody else is the right person to handle this. |
Are you really sure this is the right direction? I feel like this is getting more complex and fraught; not less. Even if we make this cargo PR acceptable, it still leaves a potential trap for any developer that doesn't test on MacOS. |
☔ The latest upstream changes (presumably #8441) made this pull request unmergeable. Please resolve the merge conflicts. Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels:
|
Closing due to inactivity. Larger features like this probably should go through the RFC process to determine what the fundamental use cases and design considerations are. |
Suggestion from @froydnj to enable a build script to pass linker args
relevant for dependencies of a crate.
The use case is to allow specifying "-Wl,-undefined,dynamic_lookup" on
MacOS for dynamic library crates with undefined symbols, such as a
symbol defined in the program loading the library.
We can consider supporting this case in rustc itself to avoid the need
for platform-specific flags in typical cdylib cases. But this seems
like an independently-useful mechanism that could enable workaround
for other linking problems, as well.
Enables workaround for #62874