Skip to content

Add space-friendly arguments #1509

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

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions text/0000-space-friendly-arguments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
- Feature Name: Space-friendly arguments
- Start Date: 2016-02-23
- RFC PR: (leave this empty)
- Rust Issue: (leave this empty)

# Summary
[summary]: #summary

Add `-C link-arg` and `-C llvm-arg` command line arguments which correspond to `-C link-args` and `-C llvm-args` but takes a single argument which accepts spaces.

# Motivation
[motivation]: #motivation

It is common to pass paths to the linker. Paths may contain spaces and so `-C link-args` is insufficient for this. MSVC's linker also has [atleast one argument which require spaces](https://msdn.microsoft.com/en-us/library/ew0y5khy.aspx).
This would also fix [#30947](https://github.com/rust-lang/rust/issues/30947).
We don't control what arguments the linker or LLVM accepts so we shouldn't limit them to not use spaces.

# Detailed design
[design]: #detailed-design

We add two new arguments `-C link-arg` and `-C llvm-arg` which can be used multiple times and combined with the old `-C link-args` and `-C llvm-args`. The value passed to them represent a single argument to be passed to the linker or LLVM respectively. The order of the arguments should be preserved when passing them on.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a motivating use case for adding -C llvm-arg for now? It's somewhat unfortunate that we stabilized -C llvm-args at all in the first place, and I wouldn't personally be eager to continue stabilizing avenues to pass arguments to LLVM.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know of a use case for that, but there are arguments that take paths in LLVM.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be best to err on the side of being conservative in that case and avoid adding it for now.

This design corresponds to clang's with `-Xlinker <val>` and `-mllvm <val>`.

# Drawbacks
[drawbacks]: #drawbacks

This results in multiple ways to pass on arguments (without spaces) to the linker and LLVM.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RFCs tend to have some discussion of drawbacks instead of just listing them. For example why is this an acceptable drawback? Can we take steps to mitigate this drawback? Are there reasons those steps are not currently worth it but may eventually become worth it?


# Alternatives
[alternatives]: #alternatives

None.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think saying that there are no alternatives may be a bit disingenuous here. One possible alternative would be to invent some form of syntax which allows spaces to be escaped. A drawback of the alternative is that it is not strictly backwards compatible, but it is likely in practice compatible so that may not matter.


# Unresolved questions
[unresolved]: #unresolved-questions

None.