-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
rustc: implement -C link-arg #36574
rustc: implement -C link-arg #36574
Conversation
this flag lets you pass a _single_ argument to the linker but can be used _repeatedly_. For example, instead of using: ``` rustc -C link-args='-l bar' (..) ``` you could write ``` rustc -C link-arg='-l' -C link-arg='bar' (..) ``` This new flag can be used with RUSTFLAGS where `-C link-args` has problems with "nested" spaces: ``` RUSTFLAGS='-C link-args="-Tlayout.ld -nostartfiles"' ``` This passes three arguments to rustc: `-C` `link-args="-Tlayout.ld` and `-nostartfiles"` to `rustc`. That's not what we meant. But this does what we want: ``` RUSTFLAGS='-C link-arg=-Tlayout.ld -C link-arg=-nostartfiles` ``` cc rust-lang/rfcs#1509
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (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. |
Added a simple test of using |
Can |
Yes, both sources get merged.
This PR doesn't touch -Clink-args. |
Could you add the attribute counterpart |
@jethrogb That I'm not sure about. The docs discourage using
|
📌 Commit 2f71fa7 has been approved by |
rustc: implement -C link-arg this flag lets you pass a _single_ argument to the linker but can be used _repeatedly_. For example, instead of using: ``` rustc -C link-args='-l bar' (..) ``` you could write ``` rustc -C link-arg='-l' -C link-arg='bar' (..) ``` This new flag can be used with RUSTFLAGS where `-C link-args` has problems with "nested" spaces: ``` RUSTFLAGS='-C link-args="-Tlayout.ld -nostartfiles"' ``` This passes three arguments to rustc: `-C` `link-args="-Tlayout.ld` and `-nostartfiles"` to `rustc`. That's not what we meant. But this does what we want: ``` RUSTFLAGS='-C link-arg=-Tlayout.ld -C link-arg=-nostartfiles` ``` cc rust-lang/rfcs#1509 r? @alexcrichton cc @Zoxc This needs a test. Any suggestion?
After rust-lang/rust/pull/36574 has been merged the latest Rust version 1.49 breaks the linking of dynamic libs in MacOS. These changes ensure that the extra link args are applied only at the dynamic lib generation linking step.
After rust-lang/rust/pull/36574 has been merged the latest Rust version 1.49 breaks the linking of dynamic libs in MacOS. These changes ensure that the extra link args are applied only at the dynamic lib generation linking step.
this flag lets you pass a single argument to the linker but can be
used repeatedly. For example, instead of using:
you could write
This new flag can be used with RUSTFLAGS where
-C link-args
hasproblems with "nested" spaces:
This passes three arguments to rustc:
-C
link-args="-Tlayout.ld
and-nostartfiles"
torustc
. That's not what we meant. But this doeswhat we want:
cc rust-lang/rfcs#1509
r? @alexcrichton
cc @Zoxc
This needs a test. Any suggestion?