Skip to content

Commit 8d7f555

Browse files
committed
Use dedicated function for finding cc
1 parent 0282cd8 commit 8d7f555

File tree

1 file changed

+3
-5
lines changed
  • src/librustc_codegen_ssa/back

1 file changed

+3
-5
lines changed

src/librustc_codegen_ssa/back/link.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -985,15 +985,13 @@ fn get_crt_libs_path(sess: &Session) -> Option<PathBuf> {
985985
Some(Ok(compiler_libs_path)) => Some(compiler_libs_path),
986986
Some(Err(_)) => None,
987987
_ => {
988-
let compiler = if let Some(linker) = &sess.opts.cg.linker {
989-
linker.clone().into_os_string()
990-
} else if let Some(linker) = &sess.target.target.options.linker {
991-
linker.into()
988+
let cc = if let (linker, LinkerFlavor::Gcc) = linker_and_flavor(&sess) {
989+
linker
992990
} else {
993991
*SYSTEM_LIBS.lock().unwrap() = Some(Err(()));
994992
return None;
995993
};
996-
if let Ok(output) = Command::new(compiler).arg("-print-file-name=crt2.o").output() {
994+
if let Ok(output) = Command::new(cc).arg("-print-file-name=crt2.o").output() {
997995
if let Some(compiler_libs_path) =
998996
PathBuf::from(std::str::from_utf8(&output.stdout).unwrap()).parent()
999997
{

0 commit comments

Comments
 (0)