Skip to content

Commit c51f215

Browse files
committed
Handle "uwp" as a windows target OS
1 parent efe2f32 commit c51f215

File tree

9 files changed

+15
-9
lines changed

9 files changed

+15
-9
lines changed

src/bootstrap/bin/rustc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ fn main() {
237237
cmd.arg("-Z").arg("osx-rpath-install-name");
238238
Some("-Wl,-rpath,@loader_path/../lib")
239239
} else if !target.contains("windows") &&
240+
!target.contains("uwp") &&
240241
!target.contains("wasm32") &&
241242
!target.contains("fuchsia") {
242243
Some("-Wl,-rpath,$ORIGIN/../lib")

src/bootstrap/compile.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ impl Step for StartupObjects {
297297
fn run(self, builder: &Builder<'_>) {
298298
let for_compiler = self.compiler;
299299
let target = self.target;
300-
if !target.contains("pc-windows-gnu") {
300+
if !target.contains("pc-windows-gnu") && !target.contains("pc-uwp-gnu") {
301301
return
302302
}
303303

@@ -752,6 +752,7 @@ pub fn build_codegen_backend(builder: &Builder<'_>,
752752
if builder.config.llvm_static_stdcpp &&
753753
!target.contains("freebsd") &&
754754
!target.contains("windows") &&
755+
!target.contains("uwp") &&
755756
!target.contains("apple") {
756757
let file = compiler_file(builder,
757758
builder.cxx(target).unwrap(),

src/bootstrap/native.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ impl Step for Llvm {
183183

184184
// For distribution we want the LLVM tools to be *statically* linked to libstdc++
185185
if builder.config.llvm_tools_enabled || want_lldb {
186-
if !target.contains("windows") {
186+
if !target.contains("windows") && !target.contains("uwp") {
187187
if target.contains("apple") {
188188
cfg.define("CMAKE_EXE_LINKER_FLAGS", "-static-libstdc++");
189189
} else {
@@ -405,6 +405,7 @@ fn configure_cmake(builder: &Builder<'_>,
405405
let mut cxxflags = builder.cflags(target, GitRepo::Llvm).join(" ");
406406
if builder.config.llvm_static_stdcpp &&
407407
!target.contains("windows") &&
408+
!target.contains("uwp") &&
408409
!target.contains("netbsd")
409410
{
410411
cxxflags.push_str(" -static-libstdc++");

src/bootstrap/tool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ impl<'a> Builder<'a> {
717717
additional_paths.push(lld_bin_path);
718718
}
719719

720-
if host.contains("windows") {
720+
if host.contains("windows") || host.contains("uwp") {
721721
// On Windows, PATH and the dynamic library path are the same,
722722
// so we just add the LLVM bin path to lib_path
723723
lib_paths.extend(additional_paths);

src/bootstrap/util.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use crate::builder::Builder;
1616

1717
/// Returns the `name` as the filename of a static library for `target`.
1818
pub fn staticlib(name: &str, target: &str) -> String {
19-
if target.contains("windows") {
19+
if target.contains("windows") || target.contains("uwp") {
2020
format!("{}.lib", name)
2121
} else {
2222
format!("lib{}.a", name)
@@ -26,7 +26,7 @@ pub fn staticlib(name: &str, target: &str) -> String {
2626
/// Given an executable called `name`, return the filename for the
2727
/// executable for a particular target.
2828
pub fn exe(name: &str, target: &str) -> String {
29-
if target.contains("windows") {
29+
if target.contains("windows") || target.contains("uwp") {
3030
format!("{}.exe", name)
3131
} else {
3232
name.to_string()
@@ -41,7 +41,7 @@ pub fn is_dylib(name: &str) -> bool {
4141
/// Returns the corresponding relative library directory that the compiler's
4242
/// dylibs will be found in.
4343
pub fn libdir(target: &str) -> &'static str {
44-
if target.contains("windows") {"bin"} else {"lib"}
44+
if target.contains("windows") || target.contains("uwp") {"bin"} else {"lib"}
4545
}
4646

4747
/// Adds a list of lookup paths to `cmd`'s dynamic library lookup path.

src/librustc_codegen_llvm/abi.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,8 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
441441
};
442442

443443
let target = &cx.sess().target.target;
444-
let win_x64_gnu = target.target_os == "windows"
444+
let win_x64_gnu = (target.target_os == "windows" ||
445+
target.target_os == "uwp")
445446
&& target.arch == "x86_64"
446447
&& target.target_env == "gnu";
447448
let linux_s390x = target.target_os == "linux"

src/libstd/build.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ fn main() {
4444
println!("cargo:rustc-link-lib=advapi32");
4545
println!("cargo:rustc-link-lib=ws2_32");
4646
println!("cargo:rustc-link-lib=userenv");
47+
} else if target.contains("uwp") {
48+
println!("cargo:rustc-link-lib=ws2_32");
4749
} else if target.contains("fuchsia") {
4850
println!("cargo:rustc-link-lib=zircon");
4951
println!("cargo:rustc-link-lib=fdio");

src/rtstartup/rsbegin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
3333
drop_in_place(to_drop);
3434
}
3535

36-
#[cfg(all(target_os = "windows", target_arch = "x86", target_env = "gnu"))]
36+
#[cfg(all(any(target_os = "windows", target_os = "uwp"), target_arch = "x86", target_env = "gnu"))]
3737
pub mod eh_frames {
3838
#[no_mangle]
3939
#[link_section = ".eh_frame"]

src/rtstartup/rsend.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
2121
drop_in_place(to_drop);
2222
}
2323

24-
#[cfg(all(target_os="windows", target_arch = "x86", target_env="gnu"))]
24+
#[cfg(all(any(target_os = "windows", target_os = "uwp"), target_arch = "x86", target_env = "gnu"))]
2525
pub mod eh_frames {
2626
// Terminate the frame unwind info section with a 0 as a sentinel;
2727
// this would be the 'length' field in a real FDE.

0 commit comments

Comments
 (0)