Skip to content

Commit 52542ca

Browse files
committed
Auto merge of #62237 - Centril:rollup-nsrgek8, r=Centril
Rollup of 4 pull requests Successful merges: - #60260 (Add support for UWP targets) - #62128 (Adjust warning of -C extra-filename with -o.) - #62153 (Update the `rust-installer` submodule) - #62224 (rustdoc: remove unused derives and variants) Failed merges: r? @ghost
2 parents 9a90d03 + b30f62f commit 52542ca

29 files changed

+590
-187
lines changed

Cargo.lock

+2-1
Original file line numberDiff line numberDiff line change
@@ -1272,9 +1272,10 @@ name = "installer"
12721272
version = "0.0.0"
12731273
dependencies = [
12741274
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
1275-
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
1275+
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
12761276
"flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
12771277
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
1278+
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
12781279
"rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
12791280
"tar 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)",
12801281
"walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)",

src/bootstrap/compile.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ impl Step for StartupObjects {
326326
fn run(self, builder: &Builder<'_>) {
327327
let for_compiler = self.compiler;
328328
let target = self.target;
329-
if !target.contains("pc-windows-gnu") {
329+
if !target.contains("windows-gnu") {
330330
return
331331
}
332332

@@ -1130,6 +1130,7 @@ pub fn run_cargo(builder: &Builder<'_>,
11301130
// Skip files like executables
11311131
if !filename.ends_with(".rlib") &&
11321132
!filename.ends_with(".lib") &&
1133+
!filename.ends_with(".a") &&
11331134
!is_dylib(&filename) &&
11341135
!(is_check && filename.ends_with(".rmeta")) {
11351136
continue;

src/librustc_codegen_ssa/back/linker.rs

+20
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,26 @@ impl<'a> Linker for GccLinker<'a> {
368368
}
369369
} else {
370370
self.cmd.arg("-shared");
371+
if self.sess.target.target.options.is_like_windows {
372+
// The output filename already contains `dll_suffix` so
373+
// the resulting import library will have a name in the
374+
// form of libfoo.dll.a
375+
let implib_name = out_filename
376+
.file_name()
377+
.and_then(|file| file.to_str())
378+
.map(|file| format!("{}{}{}",
379+
self.sess.target.target.options.staticlib_prefix,
380+
file,
381+
self.sess.target.target.options.staticlib_suffix));
382+
if let Some(implib_name) = implib_name {
383+
let implib = out_filename
384+
.parent()
385+
.map(|dir| dir.join(&implib_name));
386+
if let Some(implib) = implib {
387+
self.linker_arg(&format!("--out-implib,{}", (*implib).to_str().unwrap()));
388+
}
389+
}
390+
}
371391
}
372392
}
373393

src/librustc_interface/util.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -642,14 +642,14 @@ pub fn build_output_filenames(
642642
);
643643
None
644644
} else {
645+
if !sess.opts.cg.extra_filename.is_empty() {
646+
sess.warn("ignoring -C extra-filename flag due to -o flag");
647+
}
645648
Some(out_file.clone())
646649
};
647650
if *odir != None {
648651
sess.warn("ignoring --out-dir flag due to -o flag");
649652
}
650-
if !sess.opts.cg.extra_filename.is_empty() {
651-
sess.warn("ignoring -C extra-filename flag due to -o flag");
652-
}
653653

654654
OutputFilenames {
655655
out_directory: out_file.parent().unwrap_or_else(|| Path::new("")).to_path_buf(),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
use crate::spec::{LinkerFlavor, Target, TargetResult};
2+
3+
pub fn target() -> TargetResult {
4+
let mut base = super::windows_uwp_base::opts();
5+
base.cpu = "pentium4".to_string();
6+
base.max_atomic_width = Some(64);
7+
base.eliminate_frame_pointer = false; // Required for backtraces
8+
9+
// Mark all dynamic libraries and executables as compatible with the larger 4GiB address
10+
// space available to x86 Windows binaries on x86_64.
11+
base.pre_link_args
12+
.get_mut(&LinkerFlavor::Gcc).unwrap().push("-Wl,--large-address-aware".to_string());
13+
14+
Ok(Target {
15+
llvm_target: "i686-pc-windows-gnu".to_string(),
16+
target_endian: "little".to_string(),
17+
target_pointer_width: "32".to_string(),
18+
target_c_int_width: "32".to_string(),
19+
data_layout: "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32".to_string(),
20+
arch: "x86".to_string(),
21+
target_os: "windows".to_string(),
22+
target_env: "gnu".to_string(),
23+
target_vendor: "uwp".to_string(),
24+
linker_flavor: LinkerFlavor::Gcc,
25+
options: base,
26+
})
27+
}

src/librustc_target/spec/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ mod solaris_base;
6060
mod uefi_base;
6161
mod windows_base;
6262
mod windows_msvc_base;
63+
mod windows_uwp_base;
6364
mod thumb_base;
6465
mod l4re_base;
6566
mod fuchsia_base;
@@ -433,6 +434,8 @@ supported_targets! {
433434

434435
("x86_64-pc-windows-gnu", x86_64_pc_windows_gnu),
435436
("i686-pc-windows-gnu", i686_pc_windows_gnu),
437+
("i686-uwp-windows-gnu", i686_uwp_windows_gnu),
438+
("x86_64-uwp-windows-gnu", x86_64_uwp_windows_gnu),
436439

437440
("aarch64-pc-windows-msvc", aarch64_pc_windows_msvc),
438441
("x86_64-pc-windows-msvc", x86_64_pc_windows_msvc),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
use crate::spec::{LinkArgs, LinkerFlavor, TargetOptions};
2+
use std::default::Default;
3+
4+
pub fn opts() -> TargetOptions {
5+
let mut pre_link_args = LinkArgs::new();
6+
pre_link_args.insert(LinkerFlavor::Gcc, vec![
7+
// Tell GCC to avoid linker plugins, because we are not bundling
8+
// them with Windows installer, and Rust does its own LTO anyways.
9+
"-fno-use-linker-plugin".to_string(),
10+
11+
// Always enable DEP (NX bit) when it is available
12+
"-Wl,--nxcompat".to_string(),
13+
]);
14+
15+
let mut late_link_args = LinkArgs::new();
16+
late_link_args.insert(LinkerFlavor::Gcc, vec![
17+
//"-lwinstorecompat".to_string(),
18+
//"-lmingwex".to_string(),
19+
//"-lwinstorecompat".to_string(),
20+
"-lwinstorecompat".to_string(),
21+
"-lruntimeobject".to_string(),
22+
"-lsynchronization".to_string(),
23+
"-lvcruntime140_app".to_string(),
24+
"-lucrt".to_string(),
25+
"-lwindowsapp".to_string(),
26+
"-lmingwex".to_string(),
27+
"-lmingw32".to_string(),
28+
]);
29+
30+
TargetOptions {
31+
// FIXME(#13846) this should be enabled for windows
32+
function_sections: false,
33+
linker: Some("gcc".to_string()),
34+
dynamic_linking: true,
35+
executables: false,
36+
dll_prefix: String::new(),
37+
dll_suffix: ".dll".to_string(),
38+
exe_suffix: ".exe".to_string(),
39+
staticlib_prefix: "lib".to_string(),
40+
staticlib_suffix: ".a".to_string(),
41+
no_default_libraries: true,
42+
target_family: Some("windows".to_string()),
43+
is_like_windows: true,
44+
allows_weak_linkage: false,
45+
pre_link_args,
46+
pre_link_objects_exe: vec![
47+
"rsbegin.o".to_string(), // Rust compiler runtime initialization, see rsbegin.rs
48+
],
49+
pre_link_objects_dll: vec![
50+
"rsbegin.o".to_string(),
51+
],
52+
late_link_args,
53+
post_link_objects: vec![
54+
"rsend.o".to_string(),
55+
],
56+
custom_unwind_resume: true,
57+
abi_return_struct_as_int: true,
58+
emit_debug_gdb_scripts: false,
59+
requires_uwtable: true,
60+
limit_rdylib_exports: false,
61+
62+
.. Default::default()
63+
}
64+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
use crate::spec::{LinkerFlavor, Target, TargetResult};
2+
3+
pub fn target() -> TargetResult {
4+
let mut base = super::windows_uwp_base::opts();
5+
base.cpu = "x86-64".to_string();
6+
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string());
7+
base.max_atomic_width = Some(64);
8+
9+
Ok(Target {
10+
llvm_target: "x86_64-pc-windows-gnu".to_string(),
11+
target_endian: "little".to_string(),
12+
target_pointer_width: "64".to_string(),
13+
target_c_int_width: "32".to_string(),
14+
data_layout: "e-m:w-i64:64-f80:128-n8:16:32:64-S128".to_string(),
15+
arch: "x86_64".to_string(),
16+
target_os: "windows".to_string(),
17+
target_env: "gnu".to_string(),
18+
target_vendor: "uwp".to_string(),
19+
linker_flavor: LinkerFlavor::Gcc,
20+
options: base,
21+
})
22+
}

src/librustdoc/clean/cfg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use syntax_pos::Span;
1616

1717
use crate::html::escape::Escape;
1818

19-
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, PartialEq, Eq, Hash)]
19+
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
2020
pub enum Cfg {
2121
/// Accepts all configurations.
2222
True,

0 commit comments

Comments
 (0)