Skip to content

Commit a83e6c7

Browse files
committed
use "gcc" instead of "cc" on *-sun-solaris systems when linking
On illumos and Solaris systems, Rust will use GCC as the link editor. Rust does this by invoking "cc", which on many (Linux and perhaps BSD) systems is generally either GCC or a GCC-compatible front-end. On historical Solaris systems, "cc" was often the Sun Studio compiler. This history casts a long shadow, and as such, even most modern illumos-based operating systems tend to install GCC as "gcc", without also making it available as "cc". We should invoke GCC as "gcc" on such systems to ensure we get the right compiler driver.
1 parent 5e9ebf4 commit a83e6c7

File tree

1 file changed

+7
-1
lines changed
  • src/librustc_codegen_ssa/back

1 file changed

+7
-1
lines changed

src/librustc_codegen_ssa/back/link.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,13 @@ pub fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) {
839839
"emcc"
840840
}
841841
}
842-
LinkerFlavor::Gcc => "cc",
842+
LinkerFlavor::Gcc => {
843+
if cfg!(target_os = "solaris") {
844+
"gcc"
845+
} else {
846+
"cc"
847+
}
848+
}
843849
LinkerFlavor::Ld => "ld",
844850
LinkerFlavor::Msvc => "link.exe",
845851
LinkerFlavor::Lld(_) => "lld",

0 commit comments

Comments
 (0)