T-compiler Supplemental Tool Policy (Linker Scripts, etc.) #820
Labels
major-change
A proposal to make a major change to rustc
T-compiler
Add this label so rfcbot knows to poll the compiler team
to-announce
Announce this issue on triage meeting
Proposal
Periodically, people use the Rust toolchain with binary-manipulating tools that we do not ship. In addition, tools that we do ship are not always developed in an "in-house" manner. Some targets, in order to perform realistic builds for them, require a complex user-provided tool, like a linker script, to be executed in order to produce a working binary. Others are more predictable but no less exciting, like the BOLT post-link-optimizer.
There are many operational semantic concerns that these tools raise, because they manipulate a binary's contents in poorly-specified ways. This may have undermined the assumptions that were made as part of the compilation process. None of these concerns are easy to address.
Fortunately, I believe we do not yet have to address any of them directly! They are a distraction from a more fundamental decision that T-compiler can make: a more boring, fundamental correctness requirement on their inputs and outputs, and a contract about our own. I propose we adopt something in the mold of the following Supplemental Tool Policy, which is intended to be more of a formal crystallization of something like our current informal policy, rather than a change. The primary intent is to provide a default answer to many tiny triaging decisions about whether or not we should do something or consider it an open issue, so that we can close issues without having to defer decisions to meetings potentially several thousand times, reserving triage meeting time for more ambiguous or high-touch cases.
tl;dr: "If you ship a broken
strip
, we may treat it as damage and route around it. If you throw in a bad linker script, then you break it, you bought it. If you want the compiler sandboxed, then you can do it yourself. If you want a diagnostic in LLD or something and upstream rejects it, then tough luck, I guess?"Supplemental Tool Policy
T-compiler's mandate is to do what is necessary to ship a functioning Rust compiler (
rustc
), butrustc
has never worked in isolation. It has always required additional tools to use, whether provided with the compiler toolchain or expected in the environment. The following is an attempt to clarify some of the expectations aroundrustc
and the tools it may be used with or require, and make explicit some expectations that are already implicit.rustc
,rust-lld
, andrust-objcopy
, amongst others. Notably, this includes provided binary tools developed by the Rust Project and provided binary tools developed by external sources.ld.bfd
,link.exe
,llvm-bolt
, and scripts using the Link Editor Command Language.$CC
may be assumed to be a useful C compiler, or a program namedlink.exe
may be assumed to be the program provided by Microsoft. No attempt is required to verify the correctness of these assumptions, only a reasonable attempt to correctly locate the tools in question.For all cases where some behavior is not required, but remains desirable, it may still be pursued at the discretion of T-compiler. It's a guideline, not a straitjacket.
Mentors or Reviewers
uhh I guess I'd PR this to the forge or dev guide or something...? does that still require reviewers?
Process
The main points of the Major Change Process are as follows:
@rustbot second
.-C flag
, then full team check-off is required.@rfcbot fcp merge
on either the MCP or the PR.You can read more about Major Change Proposals on forge.
Comments
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.
The text was updated successfully, but these errors were encountered: