In our environment we end up setting -Clinker to a script called ld.sh; this script is implemented in terms of gcc as rustc used to expect. Now it treats it as a direct invocation of ld.
This was introduced in #52101.
I think rather than inferring the linker flavor from the name of the executable, rustc should either:
- invoke the binary with --version to try to work out what its dealing with, and/or
- have a stable
-Clinker-flavor option to set it explicitly
There's an unstable -Zlinker-flavor option, which I think should have been stabilized at the same time as flavor inference. Ideally inference should be opt-in with -Clinker-flavor=infer, with the default being the old default of -Clinker-flavor=gcc (at least for Linux platforms).
In our environment we end up setting
-Clinkerto a script calledld.sh; this script is implemented in terms ofgccasrustcused to expect. Now it treats it as a direct invocation ofld.This was introduced in #52101.
I think rather than inferring the linker flavor from the name of the executable, rustc should either:
-Clinker-flavoroption to set it explicitlyThere's an unstable -Zlinker-flavor option, which I think should have been stabilized at the same time as flavor inference. Ideally inference should be opt-in with
-Clinker-flavor=infer, with the default being the old default of-Clinker-flavor=gcc(at least for Linux platforms).