-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Tracking Issue for -Z link-native-libraries
#134948
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
Comments
So Personally, if we ever stabilize something like this, I'd want it to be a bit more fine grained. So you could remove or replace individual native libraries as well as removing everything. You can kinda do a rename today with |
Windows: Enable issue 70093 link tests Tracking issue for `-Z link-native-libraries`: rust-lang#134948 Tracking issue for `-Z link-directives`: rust-lang#134947 `-Zlink-native-libraries=no` and `-Zlink-directives=no` *should* work on Windows, at least for msvc. The fly in ointment is that `default-linker-libraries` doesn't. On unixy platforms rustc calls another compiler which in turn calls the linker along with the default libraries. On MSVC rustc calls the linker directly therefore it would need to be the one to implement `default-linker-libraries`. Except it doesn't so we workaround that in the test by using `-C link-arg` to talk to the linker.
Rollup merge of rust-lang#134918 - ChrisDenton:issue-70093, r=jieyouxu Windows: Enable issue 70093 link tests Tracking issue for `-Z link-native-libraries`: rust-lang#134948 Tracking issue for `-Z link-directives`: rust-lang#134947 `-Zlink-native-libraries=no` and `-Zlink-directives=no` *should* work on Windows, at least for msvc. The fly in ointment is that `default-linker-libraries` doesn't. On unixy platforms rustc calls another compiler which in turn calls the linker along with the default libraries. On MSVC rustc calls the linker directly therefore it would need to be the one to implement `default-linker-libraries`. Except it doesn't so we workaround that in the test by using `-C link-arg` to talk to the linker.
This flag is useful in combination with the buck2 build system, which specifies most libraries explicitly. However, it breaks std on Windows for the reasons outlined by above. Thanks to the example at #134918, I worked out that you need to compensate by passing [a subset of] the libs referenced from https://github.com/rust-lang/rust/blob/master/library/std/src/sys/pal/windows/c/windows_sys.rs, where for each This is probably all working as intended -- for a hermitic build, you might want to instead pass paths to specific versions of those libraries, too. Still, it was difficult to uncover. |
This is a tracking issue for the unstable rustc flag
-Z link-native-libraries
.About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Discussion comments will get marked as off-topic or deleted.
Repeated discussions on the tracking issue may lead to the tracking issue getting locked.
Steps
Open an MCP and have it accepted.At the time of impl, there was no such requirement.Unresolved Questions
-Z link-native-libraries
do, exactly?#[link]
attribute?#[link]
attribute (which is a stable attribute)?-Z link-directives
?Implementation history
Related links
-Z link-directives
#134947The text was updated successfully, but these errors were encountered: