Skip to content

Instantly share code, notes, and snippets.

@errordeveloper
Created June 27, 2014 13:59
Show Gist options
  • Save errordeveloper/4d88d217cd3d58bd31c4 to your computer and use it in GitHub Desktop.
Save errordeveloper/4d88d217cd3d58bd31c4 to your computer and use it in GitHub Desktop.
diff --git a/src/librustc/back/arm.rs b/src/librustc/back/arm.rs
index 7a7d248..3fa7bfe 100644
--- a/src/librustc/back/arm.rs
+++ b/src/librustc/back/arm.rs
@@ -68,6 +68,14 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs
-v64:64:64-v128:64:128\
-a0:0:64-n32".to_string()
}
+
+ abi::OsNone => {
+ "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\
+ -v64:64:64-v128:64:128\
+ -a0:0:64-n32".to_string()
+ }
},
target_triple: target_triple,
diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs
index 7a3e912..9b8303d 100644
--- a/src/librustc/back/link.rs
+++ b/src/librustc/back/link.rs
@@ -873,7 +873,7 @@ pub fn filename_for_input(sess: &Session, crate_type: config::CrateType,
abi::OsLinux => (loader::LINUX_DLL_PREFIX, loader::LINUX_DLL_SUFFIX),
abi::OsAndroid => (loader::ANDROID_DLL_PREFIX, loader::ANDROID_DLL_SUFFIX),
abi::OsFreebsd => (loader::FREEBSD_DLL_PREFIX, loader::FREEBSD_DLL_SUFFIX),
- abi::OsiOS => unreachable!(),
+ abi::OsiOS | abi::OsNone => unreachable!(),
};
out_filename.with_filename(format!("{}{}{}",
prefix,
diff --git a/src/librustc/back/mips.rs b/src/librustc/back/mips.rs
index 8f3da03..7abe73c 100644
--- a/src/librustc/back/mips.rs
+++ b/src/librustc/back/mips.rs
@@ -63,6 +63,14 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs
-v64:64:64-v128:64:128\
-a0:0:64-n32".to_string()
}
+
+ abi::OsNone => {
+ "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\
+ -v64:64:64-v128:64:128\
+ -a0:0:64-n32".to_string()
+ }
},
target_triple: target_triple,
diff --git a/src/librustc/back/mipsel.rs b/src/librustc/back/mipsel.rs
index c2c48a4..5dc4620 100644
--- a/src/librustc/back/mipsel.rs
+++ b/src/librustc/back/mipsel.rs
@@ -63,6 +63,14 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs
-v64:64:64-v128:64:128\
-a0:0:64-n32".to_string()
}
+
+ abi::OsNone => {
+ "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\
+ -v64:64:64-v128:64:128\
+ -a0:0:64-n32".to_string()
+ }
},
target_triple: target_triple,
diff --git a/src/librustc/back/rpath.rs b/src/librustc/back/rpath.rs
index a458cf2..4354744 100644
--- a/src/librustc/back/rpath.rs
+++ b/src/librustc/back/rpath.rs
@@ -122,7 +122,7 @@ pub fn get_rpath_relative_to_output(os: abi::Os,
abi::OsAndroid | abi::OsLinux | abi::OsFreebsd
=> "$ORIGIN",
abi::OsMacos => "@loader_path",
- abi::OsWin32 | abi::OsiOS => unreachable!()
+ abi::OsWin32 | abi::OsiOS | abi::OsNone => unreachable!()
};
let mut lib = fs::realpath(&os::make_absolute(lib)).unwrap();
diff --git a/src/librustc/back/x86.rs b/src/librustc/back/x86.rs
index d2dac03..069dd12 100644
--- a/src/librustc/back/x86.rs
+++ b/src/librustc/back/x86.rs
@@ -48,6 +48,10 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os)
abi::OsFreebsd => {
"e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string()
}
+
+ abi::OsNone => {
+ "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string()
+ }
},
target_triple: target_triple,
diff --git a/src/librustc/back/x86_64.rs b/src/librustc/back/x86_64.rs
index c2eae18..9eca6e7 100644
--- a/src/librustc/back/x86_64.rs
+++ b/src/librustc/back/x86_64.rs
@@ -52,6 +52,12 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs
f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-\
s0:64:64-f80:128:128-n8:16:32:64-S128".to_string()
}
+
+ abi::OsNone => {
+ "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-\
+ s0:64:64-f80:128:128-n8:16:32:64-S128".to_string()
+ }
},
target_triple: target_triple,
diff --git a/src/librustc/driver/config.rs b/src/librustc/driver/config.rs
index f14efb6..dfd2159 100644
--- a/src/librustc/driver/config.rs
+++ b/src/librustc/driver/config.rs
@@ -367,6 +367,7 @@ pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
abi::OsAndroid => InternedString::new("android"),
abi::OsFreebsd => InternedString::new("freebsd"),
abi::OsiOS => InternedString::new("ios"),
+ abi::OsNone => InternedString::new("none"),
};
// ARM is bi-endian, however using NDK seems to default
@@ -434,7 +435,8 @@ static os_names : &'static [(&'static str, abi::Os)] = &'static [
("android", abi::OsAndroid),
("linux", abi::OsLinux),
("freebsd", abi::OsFreebsd),
- ("ios", abi::OsiOS)];
+ ("ios", abi::OsiOS),
+ ("none", abi::OsNone)];
pub fn get_arch(triple: &str) -> Option<abi::Architecture> {
for &(arch, abi) in architecture_abis.iter() {
diff --git a/src/librustc/metadata/loader.rs b/src/librustc/metadata/loader.rs
index eca0432..9908f10 100644
--- a/src/librustc/metadata/loader.rs
+++ b/src/librustc/metadata/loader.rs
@@ -453,6 +453,7 @@ impl<'a> Context<'a> {
abi::OsAndroid => Some((ANDROID_DLL_PREFIX, ANDROID_DLL_SUFFIX)),
abi::OsFreebsd => Some((FREEBSD_DLL_PREFIX, FREEBSD_DLL_SUFFIX)),
abi::OsiOS => None,
+ abi::OsNone => None,
}
}
@@ -595,18 +596,19 @@ pub fn meta_section_name(os: abi::Os) -> Option<&'static str> {
abi::OsWin32 => Some(".note.rustc"),
abi::OsLinux => Some(".note.rustc"),
abi::OsAndroid => Some(".note.rustc"),
- abi::OsFreebsd => Some(".note.rustc")
+ abi::OsFreebsd => Some(".note.rustc"),
+ abi::OsNone => Some(".note.rustc"),
}
}
pub fn read_meta_section_name(os: abi::Os) -> &'static str {
match os {
abi::OsMacos => "__note.rustc",
- abi::OsiOS => unreachable!(),
+ abi::OsiOS | abi::OsNone => unreachable!(),
abi::OsWin32 => ".note.rustc",
abi::OsLinux => ".note.rustc",
abi::OsAndroid => ".note.rustc",
- abi::OsFreebsd => ".note.rustc"
+ abi::OsFreebsd => ".note.rustc",
}
}
diff --git a/src/librustc/middle/trans/context.rs b/src/librustc/middle/trans/context.rs
index 68c6f17..a6e9f96 100644
--- a/src/librustc/middle/trans/context.rs
+++ b/src/librustc/middle/trans/context.rs
@@ -283,7 +283,7 @@ impl CrateContext {
// but it could be enabled (with patched LLVM)
pub fn is_split_stack_supported(&self) -> bool {
let ref cfg = self.sess().targ_cfg;
- cfg.os != abi::OsiOS || cfg.arch != abi::Arm
+ cfg.os != abi::OsiOS || cfg.arch != abi::Arm || cfg.os != abi::OsNone
}
}
diff --git a/src/libsyntax/abi.rs b/src/libsyntax/abi.rs
index 9771bc9..7c493bd 100644
--- a/src/libsyntax/abi.rs
+++ b/src/libsyntax/abi.rs
@@ -11,7 +11,7 @@
use std::fmt;
#[deriving(PartialEq)]
-pub enum Os { OsWin32, OsMacos, OsLinux, OsAndroid, OsFreebsd, OsiOS, }
+pub enum Os { OsWin32, OsMacos, OsLinux, OsAndroid, OsFreebsd, OsiOS, OsNone, }
#[deriving(PartialEq, Eq, Hash, Encodable, Decodable, Clone)]
pub enum Abi {
@@ -168,7 +168,8 @@ impl fmt::Show for Os {
OsMacos => "macos".fmt(f),
OsiOS => "ios".fmt(f),
OsAndroid => "android".fmt(f),
- OsFreebsd => "freebsd".fmt(f)
+ OsFreebsd => "freebsd".fmt(f),
+ OsNone => "none".fmt(f),
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment