blob: b7c1b0dc94bf77f838b0f7c447ef7604dcc97907 [file] [log] [blame]
From 2b042cce4bd22392acf013f10a7effcfbaf8b513 Mon Sep 17 00:00:00 2001
From: George Burgess IV <gbiv@google.com>
Date: Fri, 30 Jul 2021 01:01:54 +0000
Subject: [PATCH 4/8] cc.patch
---
compiler/rustc_codegen_ssa/src/back/link.rs | 25 ++++++++++++---------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs
index 0be107fee..58db0df71 100644
--- a/compiler/rustc_codegen_ssa/src/back/link.rs
+++ b/compiler/rustc_codegen_ssa/src/back/link.rs
@@ -1191,12 +1191,12 @@ pub fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) {
(Some(linker), Some(flavor)) => Some((linker, flavor)),
// only the linker flavor is known; use the default linker for the selected flavor
(None, Some(flavor)) => Some((
- PathBuf::from(match flavor {
+ match flavor {
LinkerFlavor::Em => {
if cfg!(windows) {
- "emcc.bat"
+ "emcc.bat".into()
} else {
- "emcc"
+ "emcc".into()
}
}
LinkerFlavor::Gcc => {
@@ -1207,17 +1207,20 @@ pub fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) {
// and many modern illumos distributions today
// ship GCC as "gcc" without also making it
// available as "cc".
- "gcc"
+ "gcc".into()
} else {
- "cc"
+ match env::var_os("CC") {
+ Some(path) => path.into(),
+ None => "cc".into(),
+ }
}
}
- LinkerFlavor::Ld => "ld",
- LinkerFlavor::Msvc => "link.exe",
- LinkerFlavor::Lld(_) => "lld",
- LinkerFlavor::PtxLinker => "rust-ptx-linker",
- LinkerFlavor::BpfLinker => "bpf-linker",
- }),
+ LinkerFlavor::Ld => "ld".into(),
+ LinkerFlavor::Msvc => "link.exe".into(),
+ LinkerFlavor::Lld(_) => "lld".into(),
+ LinkerFlavor::PtxLinker => "rust-ptx-linker".into(),
+ LinkerFlavor::BpfLinker => "bpf-linker".into(),
+ },
flavor,
)),
(Some(linker), None) => {
--
2.32.0.554.ge1b32706d8-goog