Skip to content

Commit 89044a9

Browse files
committed
move store lib probing code to librustc_codegen_ssa
1 parent e3d8b68 commit 89044a9

File tree

6 files changed

+14
-41
lines changed

6 files changed

+14
-41
lines changed

Cargo.lock

-1
Original file line numberDiff line numberDiff line change
@@ -3126,7 +3126,6 @@ name = "rustc_target"
31263126
version = "0.0.0"
31273127
dependencies = [
31283128
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
3129-
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
31303129
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
31313130
"rustc_data_structures 0.0.0",
31323131
"serialize 0.0.0",

src/librustc_codegen_ssa/back/link.rs

+14
Original file line numberDiff line numberDiff line change
@@ -1027,6 +1027,20 @@ fn link_args<'a, B: ArchiveBuilder<'a>>(cmd: &mut dyn Linker,
10271027
let t = &sess.target.target;
10281028

10291029
cmd.include_path(&fix_windows_verbatim_for_gcc(&lib_path));
1030+
1031+
if t.linker_flavor == LinkerFlavor::Msvc && t.target_vendor == "uwp" {
1032+
let link_tool = windows_registry::find_tool("x86_64-pc-windows-msvc", "link.exe")
1033+
.expect("no path found for link.exe");
1034+
1035+
let original_path = link_tool.path();
1036+
let root_lib_path = original_path.ancestors().skip(4).next().unwrap();
1037+
if t.arch == "aarch64".to_string() {
1038+
cmd.include_path(&root_lib_path.join(format!("lib\\arm64\\store")));
1039+
} else {
1040+
cmd.include_path(&root_lib_path.join(format!("lib\\{}\\store", t.arch)));
1041+
}
1042+
}
1043+
10301044
for obj in codegen_results.modules.iter().filter_map(|m| m.object.as_ref()) {
10311045
cmd.add_object(obj);
10321046
}

src/librustc_target/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ path = "lib.rs"
1111
[dependencies]
1212
bitflags = "1.0"
1313
log = "0.4"
14-
cc = "1.0.1"
1514
rustc_data_structures = { path = "../librustc_data_structures" }
1615
rustc_serialize = { path = "../libserialize", package = "serialize" }
1716
syntax_pos = { path = "../libsyntax_pos" }

src/librustc_target/spec/aarch64_uwp_windows_msvc.rs

-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use crate::spec::{LinkerFlavor, Target, TargetResult, PanicStrategy};
2-
use cc::windows_registry;
32

43
pub fn target() -> TargetResult {
54
let mut base = super::windows_uwp_msvc_base::opts();
@@ -9,18 +8,6 @@ pub fn target() -> TargetResult {
98
// FIXME: this shouldn't be panic=abort, it should be panic=unwind
109
base.panic_strategy = PanicStrategy::Abort;
1110

12-
let link_tool = windows_registry::find_tool("x86_64-pc-windows-msvc", "link.exe")
13-
.expect("no path found for link.exe");
14-
15-
let original_path = link_tool.path();
16-
let lib_root_path = original_path.ancestors().skip(4).next().unwrap().display();
17-
18-
base.pre_link_args.get_mut(&LinkerFlavor::Msvc).unwrap()
19-
.push(format!("{}{}{}",
20-
"/LIBPATH:".to_string(),
21-
lib_root_path,
22-
"lib\\arm64\\store".to_string()));
23-
2411
Ok(Target {
2512
llvm_target: "aarch64-pc-windows-msvc".to_string(),
2613
target_endian: "little".to_string(),

src/librustc_target/spec/i686_uwp_windows_msvc.rs

-13
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,11 @@
11
use crate::spec::{LinkerFlavor, Target, TargetResult};
2-
use cc::windows_registry;
32

43
pub fn target() -> TargetResult {
54
let mut base = super::windows_uwp_msvc_base::opts();
65
base.cpu = "pentium4".to_string();
76
base.max_atomic_width = Some(64);
87
base.has_elf_tls = true;
98

10-
let link_tool = windows_registry::find_tool("x86_64-pc-windows-msvc", "link.exe")
11-
.expect("no path found for link.exe");
12-
13-
let original_path = link_tool.path();
14-
let lib_root_path = original_path.ancestors().skip(4).next().unwrap().display();
15-
16-
base.pre_link_args.get_mut(&LinkerFlavor::Msvc).unwrap()
17-
.push(format!("{}{}{}",
18-
"/LIBPATH:".to_string(),
19-
lib_root_path,
20-
"lib\\x86\\store".to_string()));
21-
229
Ok(Target {
2310
llvm_target: "i686-pc-windows-msvc".to_string(),
2411
target_endian: "little".to_string(),

src/librustc_target/spec/x86_64_uwp_windows_msvc.rs

-13
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,11 @@
11
use crate::spec::{LinkerFlavor, Target, TargetResult};
2-
use cc::windows_registry;
32

43
pub fn target() -> TargetResult {
54
let mut base = super::windows_uwp_msvc_base::opts();
65
base.cpu = "x86-64".to_string();
76
base.max_atomic_width = Some(64);
87
base.has_elf_tls = true;
98

10-
let link_tool = windows_registry::find_tool("x86_64-pc-windows-msvc", "link.exe")
11-
.expect("no path found for link.exe");
12-
13-
let original_path = link_tool.path();
14-
let lib_root_path = original_path.ancestors().skip(4).next().unwrap().display();
15-
16-
base.pre_link_args.get_mut(&LinkerFlavor::Msvc).unwrap()
17-
.push(format!("{}{}{}",
18-
"/LIBPATH:".to_string(),
19-
lib_root_path,
20-
"lib\\x64\\store".to_string()));
21-
229
Ok(Target {
2310
llvm_target: "x86_64-pc-windows-msvc".to_string(),
2411
target_endian: "little".to_string(),

0 commit comments

Comments
 (0)