pub color: ColorConfig,
pub externs: HashMap<String, Vec<String>>,
pub crate_name: Option<String>,
+ /// An optional name to use as the crate for std during std injection,
+ /// written `extern crate std = "name"`. Default to "std". Used by
+ /// out-of-tree drivers.
+ pub alt_std_name: Option<String>
}
/// Some reasonable defaults
color: Auto,
externs: HashMap::new(),
crate_name: None,
+ alt_std_name: None,
}
}
"disable the use of the redzone"),
relocation_model: String = ("pic".to_string(), parse_string,
"choose the relocation model to use (llc -relocation-model for details)"),
+ code_model: String = ("default".to_string(), parse_string,
+ "choose the code model to use (llc -code-model for details)"),
metadata: Vec<String> = (Vec::new(), parse_list,
"metadata to mangle symbol names with"),
extra_filename: String = ("".to_string(), parse_string,
pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
let tos = match sess.targ_cfg.os {
- abi::OsWin32 => InternedString::new("win32"),
- abi::OsMacos => InternedString::new("macos"),
- abi::OsLinux => InternedString::new("linux"),
- abi::OsAndroid => InternedString::new("android"),
- abi::OsFreebsd => InternedString::new("freebsd"),
- abi::OsiOS => InternedString::new("ios"),
+ abi::OsWin32 => InternedString::new("win32"),
+ abi::OsMacos => InternedString::new("macos"),
+ abi::OsLinux => InternedString::new("linux"),
+ abi::OsAndroid => InternedString::new("android"),
+ abi::OsFreebsd => InternedString::new("freebsd"),
+ abi::OsDragonfly => InternedString::new("dragonfly"),
+ abi::OsiOS => InternedString::new("ios"),
};
// ARM is bi-endian, however using NDK seems to default
if sess.opts.test {
append_configuration(&mut user_cfg, InternedString::new("test"))
}
- // If the user requested GC, then add the GC cfg
- append_configuration(&mut user_cfg, if sess.opts.gc {
- InternedString::new("gc")
- } else {
- InternedString::new("nogc")
- });
user_cfg.move_iter().collect::<Vec<_>>().append(default_cfg.as_slice())
}
None
}
static os_names : &'static [(&'static str, abi::Os)] = &[
- ("mingw32", abi::OsWin32),
- ("win32", abi::OsWin32),
- ("darwin", abi::OsMacos),
- ("android", abi::OsAndroid),
- ("linux", abi::OsLinux),
- ("freebsd", abi::OsFreebsd),
- ("ios", abi::OsiOS)];
+ ("mingw32", abi::OsWin32),
+ ("win32", abi::OsWin32),
+ ("darwin", abi::OsMacos),
+ ("android", abi::OsAndroid),
+ ("linux", abi::OsLinux),
+ ("freebsd", abi::OsFreebsd),
+ ("dragonfly", abi::OsDragonfly),
+ ("ios", abi::OsiOS)];
pub fn get_arch(triple: &str) -> Option<abi::Architecture> {
for &(arch, abi) in architecture_abis.iter() {
always = always colorize output;
never = never colorize output", "auto|always|never"),
optmulti("", "extern", "Specify where an external rust library is located",
- "PATH"),
+ "NAME=PATH"),
)
}
}
pub fn build_session_options(matches: &getopts::Matches) -> Options {
- let mut crate_types: Vec<CrateType> = Vec::new();
+
let unparsed_crate_types = matches.opt_strs("crate-type");
- for unparsed_crate_type in unparsed_crate_types.iter() {
- for part in unparsed_crate_type.as_slice().split(',') {
- let new_part = match part {
- "lib" => default_lib_output(),
- "rlib" => CrateTypeRlib,
- "staticlib" => CrateTypeStaticlib,
- "dylib" => CrateTypeDylib,
- "bin" => CrateTypeExecutable,
- _ => {
- early_error(format!("unknown crate type: `{}`",
- part).as_slice())
- }
- };
- crate_types.push(new_part)
- }
- }
+ let crate_types = parse_crate_types_from_list(unparsed_crate_types)
+ .unwrap_or_else(|e| early_error(e.as_slice()));
let parse_only = matches.opt_present("parse-only");
let no_trans = matches.opt_present("no-trans");
color: color,
externs: externs,
crate_name: crate_name,
+ alt_std_name: None
+ }
+}
+
+pub fn parse_crate_types_from_list(list_list: Vec<String>) -> Result<Vec<CrateType>, String> {
+
+ let mut crate_types: Vec<CrateType> = Vec::new();
+ for unparsed_crate_type in list_list.iter() {
+ for part in unparsed_crate_type.as_slice().split(',') {
+ let new_part = match part {
+ "lib" => default_lib_output(),
+ "rlib" => CrateTypeRlib,
+ "staticlib" => CrateTypeStaticlib,
+ "dylib" => CrateTypeDylib,
+ "bin" => CrateTypeExecutable,
+ _ => {
+ return Err(format!("unknown crate type: `{}`",
+ part));
+ }
+ };
+ crate_types.push(new_part)
+ }
}
+
+ return Ok(crate_types);
}
impl fmt::Show for CrateType {