|
8 | 8 | // option. This file may not be copied, modified, or distributed |
9 | 9 | // except according to those terms. |
10 | 10 |
|
11 | | -use std::env; |
12 | 11 | use std::ffi::OsString; |
13 | 12 | use std::fs::{self, File}; |
14 | 13 | use std::io::{self, BufWriter}; |
@@ -57,7 +56,6 @@ pub trait Linker { |
57 | 56 | fn no_whole_archives(&mut self); |
58 | 57 | fn export_symbols(&mut self, sess: &Session, trans: &CrateTranslation, |
59 | 58 | tmpdir: &Path); |
60 | | - fn try_gold_linker(&mut self); |
61 | 59 | } |
62 | 60 |
|
63 | 61 | pub struct GnuLinker<'a> { |
@@ -201,53 +199,6 @@ impl<'a> Linker for GnuLinker<'a> { |
201 | 199 | fn export_symbols(&mut self, _: &Session, _: &CrateTranslation, _: &Path) { |
202 | 200 | // noop, visibility in object files takes care of this |
203 | 201 | } |
204 | | - |
205 | | - fn try_gold_linker(&mut self) { |
206 | | - // Only use gold under specific conditions that we know work |
207 | | - |
208 | | - let gold_exists = match env::var_os("PATH") { |
209 | | - Some(ref env_path) => { |
210 | | - env::split_paths(env_path).any(|mut p| { |
211 | | - p.push("ld.gold"); |
212 | | - p.exists() |
213 | | - }) |
214 | | - } |
215 | | - None => false |
216 | | - }; |
217 | | - let host_is_linux = cfg!(target_os = "linux"); |
218 | | - // Defensively prevent trying to use gold for bogus cross-targets. |
219 | | - let target_is_host_compatible = { |
220 | | - let host_os_is_target_os = self.sess.target.target.target_os == env::consts::OS; |
221 | | - let host_arch_is_target_arch = self.sess.target.target.arch == env::consts::ARCH; |
222 | | - // Support x86_64->i686 and reverse |
223 | | - let host_and_target_are_x86ish = |
224 | | - (self.sess.target.target.arch == "x86" || |
225 | | - self.sess.target.target.arch == "x86_64") && |
226 | | - (env::consts::ARCH == "x86" || |
227 | | - env::consts::ARCH == "x86_64"); |
228 | | - host_os_is_target_os && (host_arch_is_target_arch || host_and_target_are_x86ish) |
229 | | - }; |
230 | | - // We have strong confidence that x86 works, but not much |
231 | | - // visibility into other architectures. |
232 | | - let target_works_with_gold = |
233 | | - self.sess.target.target.arch == "x86" || |
234 | | - self.sess.target.target.arch == "x86_64"; |
235 | | - let opt_out = self.sess.opts.cg.disable_gold; |
236 | | - |
237 | | - let can_use_gold = |
238 | | - gold_exists && |
239 | | - host_is_linux && |
240 | | - target_is_host_compatible && |
241 | | - target_works_with_gold && |
242 | | - !opt_out; |
243 | | - |
244 | | - if can_use_gold { |
245 | | - info!("linking with ld.gold"); |
246 | | - self.cmd.arg("-fuse-ld=gold"); |
247 | | - } else { |
248 | | - info!("linking with ld"); |
249 | | - } |
250 | | - } |
251 | 202 | } |
252 | 203 |
|
253 | 204 | pub struct MsvcLinker<'a> { |
@@ -407,6 +358,4 @@ impl<'a> Linker for MsvcLinker<'a> { |
407 | 358 | arg.push(path); |
408 | 359 | self.cmd.arg(&arg); |
409 | 360 | } |
410 | | - |
411 | | - fn try_gold_linker(&mut self) {} |
412 | 361 | } |
0 commit comments