cc-rs icon indicating copy to clipboard operation
cc-rs copied to clipboard

Should integrate cc-rs knowledge of linkers with rustc

Open joshtriplett opened this issue 3 years ago • 2 comments

rustc currently has limited knowledge of the correct linker to use on various platforms. cc-rs has a much better idea of which linker to use. There's been a long-standing goal that many people have advocated of making the compiler use cc-rs to find the linker; this would fix cross-compilation for many targets.

Filing this issue to track that possibility. There are also corresponding issues on the rustc repo, which this should link to / be linked from.

joshtriplett avatar Jul 06 '22 21:07 joshtriplett

many people have advocated of making the compiler use cc-rs to find the linker

If the suggestion is to introduce dependency on cc-rs, then I for one[!] would advocate against it(*). I reckon that rustc would be better off being self-sufficient and maintaining its own cross-compile prefixing scheme(**) and provide a way for cc-rs to use at its discretion. As opposed the other way around. Just in case, I do recognize the sentiment behind the suggestion to let cc-rs decide over rustc, and even found myself wishing for it to be possible multiple times, yet at the same time I recognize the value of rustc being self-sufficient.

(*) Well, there already is a dependency, on Windows, so I suppose this is an argument against widening the dependency. (**) Yet keep the current way to specify the linker, so that one can override the default for experimental and trouble-shooting purposes.

dot-asm avatar Jul 11 '22 09:07 dot-asm

there already is a dependency, on Windows

For reference. The dependency on Windows is of different nature. cc-rs helps rustc to find the toolchain components it's looking for, but doesn't tell which components to use.

dot-asm avatar Jul 11 '22 09:07 dot-asm