move store lib probing code to librustc_codegen_ssa

This commit is contained in:
Martin Finkel 2019-08-07 17:49:15 +02:00
parent e3d8b6817e
commit 89044a908e
6 changed files with 14 additions and 41 deletions

View file

@ -3126,7 +3126,6 @@ name = "rustc_target"
version = "0.0.0"
dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_data_structures 0.0.0",
"serialize 0.0.0",

View file

@ -1027,6 +1027,20 @@ fn link_args<'a, B: ArchiveBuilder<'a>>(cmd: &mut dyn Linker,
let t = &sess.target.target;
cmd.include_path(&fix_windows_verbatim_for_gcc(&lib_path));
if t.linker_flavor == LinkerFlavor::Msvc && t.target_vendor == "uwp" {
let link_tool = windows_registry::find_tool("x86_64-pc-windows-msvc", "link.exe")
.expect("no path found for link.exe");
let original_path = link_tool.path();
let root_lib_path = original_path.ancestors().skip(4).next().unwrap();
if t.arch == "aarch64".to_string() {
cmd.include_path(&root_lib_path.join(format!("lib\\arm64\\store")));
} else {
cmd.include_path(&root_lib_path.join(format!("lib\\{}\\store", t.arch)));
}
}
for obj in codegen_results.modules.iter().filter_map(|m| m.object.as_ref()) {
cmd.add_object(obj);
}

View file

@ -11,7 +11,6 @@ path = "lib.rs"
[dependencies]
bitflags = "1.0"
log = "0.4"
cc = "1.0.1"
rustc_data_structures = { path = "../librustc_data_structures" }
rustc_serialize = { path = "../libserialize", package = "serialize" }
syntax_pos = { path = "../libsyntax_pos" }

View file

@ -1,5 +1,4 @@
use crate::spec::{LinkerFlavor, Target, TargetResult, PanicStrategy};
use cc::windows_registry;
pub fn target() -> TargetResult {
let mut base = super::windows_uwp_msvc_base::opts();
@ -9,18 +8,6 @@ pub fn target() -> TargetResult {
// FIXME: this shouldn't be panic=abort, it should be panic=unwind
base.panic_strategy = PanicStrategy::Abort;
let link_tool = windows_registry::find_tool("x86_64-pc-windows-msvc", "link.exe")
.expect("no path found for link.exe");
let original_path = link_tool.path();
let lib_root_path = original_path.ancestors().skip(4).next().unwrap().display();
base.pre_link_args.get_mut(&LinkerFlavor::Msvc).unwrap()
.push(format!("{}{}{}",
"/LIBPATH:".to_string(),
lib_root_path,
"lib\\arm64\\store".to_string()));
Ok(Target {
llvm_target: "aarch64-pc-windows-msvc".to_string(),
target_endian: "little".to_string(),

View file

@ -1,5 +1,4 @@
use crate::spec::{LinkerFlavor, Target, TargetResult};
use cc::windows_registry;
pub fn target() -> TargetResult {
let mut base = super::windows_uwp_msvc_base::opts();
@ -7,18 +6,6 @@ pub fn target() -> TargetResult {
base.max_atomic_width = Some(64);
base.has_elf_tls = true;
let link_tool = windows_registry::find_tool("x86_64-pc-windows-msvc", "link.exe")
.expect("no path found for link.exe");
let original_path = link_tool.path();
let lib_root_path = original_path.ancestors().skip(4).next().unwrap().display();
base.pre_link_args.get_mut(&LinkerFlavor::Msvc).unwrap()
.push(format!("{}{}{}",
"/LIBPATH:".to_string(),
lib_root_path,
"lib\\x86\\store".to_string()));
Ok(Target {
llvm_target: "i686-pc-windows-msvc".to_string(),
target_endian: "little".to_string(),

View file

@ -1,5 +1,4 @@
use crate::spec::{LinkerFlavor, Target, TargetResult};
use cc::windows_registry;
pub fn target() -> TargetResult {
let mut base = super::windows_uwp_msvc_base::opts();
@ -7,18 +6,6 @@ pub fn target() -> TargetResult {
base.max_atomic_width = Some(64);
base.has_elf_tls = true;
let link_tool = windows_registry::find_tool("x86_64-pc-windows-msvc", "link.exe")
.expect("no path found for link.exe");
let original_path = link_tool.path();
let lib_root_path = original_path.ancestors().skip(4).next().unwrap().display();
base.pre_link_args.get_mut(&LinkerFlavor::Msvc).unwrap()
.push(format!("{}{}{}",
"/LIBPATH:".to_string(),
lib_root_path,
"lib\\x64\\store".to_string()));
Ok(Target {
llvm_target: "x86_64-pc-windows-msvc".to_string(),
target_endian: "little".to_string(),