Uh oh!
There was an error while loading. Please reload this page.
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
rust-highfive
commented
Sep 19, 2016
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. |
japaric
commented
Sep 19, 2016
Added a simple test of using |
retep998
commented
Sep 19, 2016
Can |
japaric
commented
Sep 19, 2016
Yes, both sources get merged.
This PR doesn't touch -Clink-args. |
jethrogb
commented
Sep 23, 2016
Could you add the attribute counterpart |
japaric
commented
Sep 23, 2016
@jethrogb That I'm not sure about. The docs discourage using
|
alexcrichton
commented
Sep 26, 2016
bors
commented
Sep 26, 2016
📌 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-argshasproblems with "nested" spaces:
This passes three arguments to rustc:
-Clink-args="-Tlayout.ldand-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?