Proposal
Some rustc codegen flags are target specific (or specific to families of targets) and have no effect when used on unsupported targets. For example:
-C control-flow-guard - Only supported on Windows targets
-C dlltool - Only used on *-windows-gnu targets
-C dwarf-version - Has no effect on *-windows-msvc targets
-C relro-level - Has no effect on *-windows-msvc targets
The question of "what should a codegen flag do on unsupported targets" has previously come up during stabilization of some codegen flags.
I propose that we add a lint which fires when a codegen flag is passed to the compiler which is ignored for the active target:
$ rustc -C dlltool=something.exe -C control-flow-guard=on --target x86_64-unknown-linux-gnu hello_world.rs
warning: `-C dlltool` has no effect on the target platform
warning: `-C control-flow-guard` has no effect on the target platform
The lint should default to the warn level but users can choose to deny or allow it via -D or -A flags respectively. Ideally the lint would only flag attempts to activate unsupported options as to avoid unnecessary diagnostic noise (eg rustc -C control-flow-guard=off --target x86_64-unknown-linux-gnu ... would not trigger the lint).
Mentors or Reviewers
I'm willing to mentor or implement the proposal.
Process
The main points of the Major Change Process are as follows:
You can read more about Major Change Proposals on forge.
Proposal
Some rustc codegen flags are target specific (or specific to families of targets) and have no effect when used on unsupported targets. For example:
-C control-flow-guard- Only supported on Windows targets-C dlltool- Only used on*-windows-gnutargets-C dwarf-version- Has no effect on*-windows-msvctargets-C relro-level- Has no effect on*-windows-msvctargetsThe question of "what should a codegen flag do on unsupported targets" has previously come up during stabilization of some codegen flags.
I propose that we add a lint which fires when a codegen flag is passed to the compiler which is ignored for the active target:
The lint should default to the
warnlevel but users can choose todenyorallowit via-Dor-Aflags respectively. Ideally the lint would only flag attempts to activate unsupported options as to avoid unnecessary diagnostic noise (egrustc -C control-flow-guard=off --target x86_64-unknown-linux-gnu ...would not trigger the lint).Mentors or Reviewers
I'm willing to mentor or implement the proposal.
Process
The main points of the Major Change Process are as follows:
@rustbot secondor kickoff a team FCP with@rfcbot fcp $RESOLUTION.You can read more about Major Change Proposals on forge.