For historical reasons, "Win32" has been used in Rust codebase to mean "Windows OS in general".
This is confusing, especially now, that Rust supports Win64 builds.
[breaking-change]
// OSX has -dead_strip, which doesn't rely on ffunction_sections
// FIXME(#13846) this should be enabled for windows
let ffunction_sections = sess.targ_cfg.os != abi::OsMacos &&
- sess.targ_cfg.os != abi::OsWin32;
+ sess.targ_cfg.os != abi::OsWindows;
let fdata_sections = ffunction_sections;
let reloc_model = match sess.opts.cg.relocation_model.as_slice() {
// instead of hard-coded gcc.
// For win32, there is no cc command, so we add a condition to make it use gcc.
match sess.targ_cfg.os {
- abi::OsWin32 => "gcc",
+ abi::OsWindows => "gcc",
_ => "cc",
}.to_string()
}
}
config::CrateTypeDylib => {
let (prefix, suffix) = match sess.targ_cfg.os {
- abi::OsWin32 => (loader::WIN32_DLL_PREFIX, loader::WIN32_DLL_SUFFIX),
+ abi::OsWindows => (loader::WIN32_DLL_PREFIX, loader::WIN32_DLL_SUFFIX),
abi::OsMacos => (loader::MACOS_DLL_PREFIX, loader::MACOS_DLL_SUFFIX),
abi::OsLinux => (loader::LINUX_DLL_PREFIX, loader::LINUX_DLL_SUFFIX),
abi::OsAndroid => (loader::ANDROID_DLL_PREFIX, loader::ANDROID_DLL_SUFFIX),
}
config::CrateTypeExecutable => {
match sess.targ_cfg.os {
- abi::OsWin32 => out_filename.with_extension("exe"),
+ abi::OsWindows => out_filename.with_extension("exe"),
abi::OsMacos |
abi::OsLinux |
abi::OsAndroid |
// subset we wanted.
//
// FIXME(#11937) we should invoke the system linker directly
- if sess.targ_cfg.os != abi::OsWin32 {
+ if sess.targ_cfg.os != abi::OsWindows {
cmd.arg("-nodefaultlibs");
}
cmd.arg("-Wl,-dead_strip");
}
- if sess.targ_cfg.os == abi::OsWin32 {
+ if sess.targ_cfg.os == abi::OsWindows {
// Make sure that we link to the dynamic libgcc, otherwise cross-module
// DWARF stack unwinding will not work.
// This behavior may be overridden by --link-args "-static-libgcc"
// Converts a library file-stem into a cc -l argument
fn unlib<'a>(config: &config::Config, stem: &'a [u8]) -> &'a [u8] {
- if stem.starts_with("lib".as_bytes()) && config.os != abi::OsWin32 {
+ if stem.starts_with("lib".as_bytes()) && config.os != abi::OsWindows {
stem.tailn(3)
} else {
stem
pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
let tos = match sess.targ_cfg.os {
- abi::OsWin32 => InternedString::new("win32"),
+ abi::OsWindows => InternedString::new("win32"),
abi::OsMacos => InternedString::new("macos"),
abi::OsLinux => InternedString::new("linux"),
abi::OsAndroid => InternedString::new("android"),
};
let fam = match sess.targ_cfg.os {
- abi::OsWin32 => InternedString::new("windows"),
+ abi::OsWindows => InternedString::new("windows"),
_ => InternedString::new("unix")
};
None
}
static os_names : &'static [(&'static str, abi::Os)] = &[
- ("mingw32", abi::OsWin32),
- ("win32", abi::OsWin32),
+ ("mingw32", abi::OsWindows),
+ ("win32", abi::OsWindows),
("darwin", abi::OsMacos),
("android", abi::OsAndroid),
("linux", abi::OsLinux),
// dynamic libraries
fn dylibname(&self) -> Option<(&'static str, &'static str)> {
match self.os {
- abi::OsWin32 => Some((WIN32_DLL_PREFIX, WIN32_DLL_SUFFIX)),
+ abi::OsWindows => Some((WIN32_DLL_PREFIX, WIN32_DLL_SUFFIX)),
abi::OsMacos => Some((MACOS_DLL_PREFIX, MACOS_DLL_SUFFIX)),
abi::OsLinux => Some((LINUX_DLL_PREFIX, LINUX_DLL_SUFFIX)),
abi::OsAndroid => Some((ANDROID_DLL_PREFIX, ANDROID_DLL_SUFFIX)),
match os {
abi::OsMacos => Some("__DATA,__note.rustc"),
abi::OsiOS => Some("__DATA,__note.rustc"),
- abi::OsWin32 => Some(".note.rustc"),
+ abi::OsWindows => Some(".note.rustc"),
abi::OsLinux => Some(".note.rustc"),
abi::OsAndroid => Some(".note.rustc"),
abi::OsFreebsd => Some(".note.rustc"),
match os {
abi::OsMacos => "__note.rustc",
abi::OsiOS => unreachable!(),
- abi::OsWin32 => ".note.rustc",
+ abi::OsWindows => ".note.rustc",
abi::OsLinux => ".note.rustc",
abi::OsAndroid => ".note.rustc",
abi::OsFreebsd => ".note.rustc",
use middle::trans::cabi_mips;
use middle::trans::type_::Type;
use syntax::abi::{X86, X86_64, Arm, Mips, Mipsel};
-use syntax::abi::{OsWin32};
+use syntax::abi::{OsWindows};
#[deriving(Clone, PartialEq)]
pub enum ArgKind {
match ccx.sess().targ_cfg.arch {
X86 => cabi_x86::compute_abi_info(ccx, atys, rty, ret_def),
X86_64 =>
- if ccx.sess().targ_cfg.os == OsWin32 {
+ if ccx.sess().targ_cfg.os == OsWindows {
cabi_x86_win64::compute_abi_info(ccx, atys, rty, ret_def)
} else {
cabi_x86_64::compute_abi_info(ccx, atys, rty, ret_def)
// except according to those terms.
-use syntax::abi::{OsWin32, OsMacos, OsiOS};
+use syntax::abi::{OsWindows, OsMacos, OsiOS};
use llvm::*;
use super::cabi::*;
use super::common::*;
enum Strategy { RetValue(Type), RetPointer }
let strategy = match ccx.sess().targ_cfg.os {
- OsWin32 | OsMacos | OsiOS => {
+ OsWindows | OsMacos | OsiOS => {
match llsize_of_alloc(ccx, rty) {
1 => RetValue(Type::i8(ccx)),
2 => RetValue(Type::i16(ccx)),
pub fn find_library(name: &str, os: abi::Os, search_paths: &[Path],
handler: &ErrorHandler) -> Path {
let (osprefix, osext) = match os {
- abi::OsWin32 => ("", "lib"), _ => ("lib", "a"),
+ abi::OsWindows => ("", "lib"), _ => ("lib", "a"),
};
// On Windows, static libraries sometimes show up as libfoo.a and other
// times show up as foo.lib
-a0:0:64-n32".to_string()
}
- abi::OsWin32 => {
+ abi::OsWindows => {
"e-p:32:32:32\
-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
-f32:32:32-f64:64:64\
-a0:0:64-n32".to_string()
}
- abi::OsWin32 => {
+ abi::OsWindows => {
"E-p:32:32:32\
-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
-f32:32:32-f64:64:64\
-a0:0:64-n32".to_string()
}
- abi::OsWin32 => {
+ abi::OsWindows => {
"e-p:32:32:32\
-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
-f32:32:32-f64:64:64\
pub fn get_rpath_flags(config: RPathConfig) -> Vec<String> {
// No rpath on windows
- if config.os == abi::OsWin32 {
+ if config.os == abi::OsWindows {
return Vec::new();
}
lib: &Path) -> String {
use std::os;
- assert!(config.os != abi::OsWin32);
+ assert!(config.os != abi::OsWindows);
// Mac doesn't appear to support $ORIGIN
let prefix = match config.os {
abi::OsAndroid | abi::OsLinux | abi::OsFreebsd | abi::OsDragonfly
=> "$ORIGIN",
abi::OsMacos => "@loader_path",
- abi::OsWin32 | abi::OsiOS => unreachable!()
+ abi::OsWindows | abi::OsiOS => unreachable!()
};
let mut lib = (config.realpath)(&os::make_absolute(lib)).unwrap();
-n8:16:32".to_string()
}
- abi::OsWin32 => {
+ abi::OsWindows => {
"e-p:32:32-f64:64:64-i64:64:64-f80:32:32-n8:16:32".to_string()
}
s0:64:64-f80:128:128-n8:16:32:64".to_string()
}
- abi::OsWin32 => {
+ abi::OsWindows => {
// FIXME: Test this. Copied from linux (#2398)
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\
f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-\
use std::fmt;
#[deriving(PartialEq)]
-pub enum Os { OsWin32, OsMacos, OsLinux, OsAndroid, OsFreebsd, OsiOS,
+pub enum Os { OsWindows, OsMacos, OsLinux, OsAndroid, OsFreebsd, OsiOS,
OsDragonfly }
#[deriving(PartialEq, Eq, Hash, Encodable, Decodable, Clone)]
// Transform this ABI as appropriate for the requested os/arch
// combination.
Some(match (*self, os, arch) {
- (System, OsWin32, X86) => Stdcall,
+ (System, OsWindows, X86) => Stdcall,
(System, _, _) => C,
(me, _, _) => me,
})
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
OsLinux => "linux".fmt(f),
- OsWin32 => "win32".fmt(f),
+ OsWindows => "win32".fmt(f),
OsMacos => "macos".fmt(f),
OsiOS => "ios".fmt(f),
OsAndroid => "android".fmt(f),
assert_eq!(Stdcall.for_target(OsLinux, X86), Some(Stdcall));
assert_eq!(Stdcall.for_target(OsLinux, Arm), None);
assert_eq!(System.for_target(OsLinux, X86), Some(C));
- assert_eq!(System.for_target(OsWin32, X86), Some(Stdcall));
- assert_eq!(System.for_target(OsWin32, X86_64), Some(C));
- assert_eq!(System.for_target(OsWin32, Arm), Some(C));
- assert_eq!(Stdcall.for_target(OsWin32, X86), Some(Stdcall));
- assert_eq!(Stdcall.for_target(OsWin32, X86_64), Some(Stdcall));
+ assert_eq!(System.for_target(OsWindows, X86), Some(Stdcall));
+ assert_eq!(System.for_target(OsWindows, X86_64), Some(C));
+ assert_eq!(System.for_target(OsWindows, Arm), Some(C));
+ assert_eq!(Stdcall.for_target(OsWindows, X86), Some(Stdcall));
+ assert_eq!(Stdcall.for_target(OsWindows, X86_64), Some(Stdcall));
}