-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Tracking Issue for extra-link-arg
#9426
Labels
A-build-scripts
Area: build.rs scripts
A-linkage
Area: linker issues, dylib, cdylib, shared libraries, so
C-tracking-issue
Category: A tracking issue for something unstable.
Comments
ehuss
added
A-linkage
Area: linker issues, dylib, cdylib, shared libraries, so
A-build-scripts
Area: build.rs scripts
C-tracking-issue
Category: A tracking issue for something unstable.
labels
Apr 28, 2021
bors
added a commit
that referenced
this issue
May 24, 2021
Add `cargo:rustc-link-arg-bin` flag. This PR implements a `cargo:rustc-link-arg-bin` command to specify per-binary link args from build scripts. This follows the suggestion from the tracking issue #9426. Syntax is `cargo:rustc-link-arg-bin=BIN_NAME=ARG` This was previously possible to do using the `#[link_args=".."]` attribute, but it was removed in rust-lang/rust#83820 in favor of the Cargo extra-link-args feature, which can currently not specify different link args for different bins in the same crate. This PR adds back the ability to do that.
bors
added a commit
that referenced
this issue
Jun 1, 2021
Add some validation to rustc-link-arg This adds some validation, so that if a `cargo:rustc-link-arg-*` build script instruction specifies a target that doesn't exist, it will generate an error. This also changes a parse warning to an error if the `=` is missing from BIN=ARG. I intentionally did not bother to add the validation to config overrides, as it is a bit trickier to do, and that feature is very rarely used (AFAIK), and I'm uncertain if rustc-link-arg is really useful in that context. cc #9426
1 task
bors
added a commit
that referenced
this issue
Jul 26, 2021
Stabilize the rustc-link-arg option This change removes the unstable option (tracked by #9426) and unconditionally accepts additional linker arguments (as implemented in #7811 and #8441). Documentation is moved from unstable to what appeared to be the correct location. I am not aware of any significant concerns with the option and it appears consistent with some other existing stable linker options. Please let me know if this is not the appropriate process or if there is anything that I am missing from the PR.
Closing as this has now been stabilized via #9557. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-build-scripts
Area: build.rs scripts
A-linkage
Area: linker issues, dylib, cdylib, shared libraries, so
C-tracking-issue
Category: A tracking issue for something unstable.
Summary
Implementation: #7811 #8441
Documentation: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#extra-link-arg
The
-Z extra-link-arg
flag allows build scripts to issue additional cargo commands to pass custom flags to the linker:*
cargo:rustc-link-arg-bins=FLAG
– Passes custom flags to a linker for binaries.*
cargo:rustc-link-arg=FLAG
– Passes custom flags to a linker for benchmarks, binaries,cdylib
crates, examples, and tests.Unresolved issues
None at this time.
Future extensions
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.
cc @reitermarkus
The text was updated successfully, but these errors were encountered: