Skip to content

Commit

Permalink
Change default Solaris x86 target to x86_64-pc-solaris
Browse files Browse the repository at this point in the history
  • Loading branch information
kulikjak committed Mar 1, 2021
1 parent d2731d8 commit c615bed
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 24 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_session/src/config.rs
Expand Up @@ -1536,7 +1536,7 @@ fn parse_target_triple(matches: &getopts::Matches, error_format: ErrorOutputType
early_error(error_format, &format!("target file {:?} does not exist", path))
})
}
Some(target) => TargetTriple::from_alias(target),
Some(target) => TargetTriple::TargetTriple(target),
_ => TargetTriple::from_triple(host_triple()),
}
}
Expand Down
23 changes: 2 additions & 21 deletions compiler/rustc_target/src/spec/mod.rs
Expand Up @@ -736,9 +736,8 @@ supported_targets! {
("armv7r-none-eabi", armv7r_none_eabi),
("armv7r-none-eabihf", armv7r_none_eabihf),

// `x86_64-pc-solaris` is an alias for `x86_64_sun_solaris` for backwards compatibility reasons.
// (See <https://github.com/rust-lang/rust/issues/40531>.)
("x86_64-sun-solaris", "x86_64-pc-solaris", x86_64_sun_solaris),
("x86_64-pc-solaris", x86_64_pc_solaris),
("x86_64-sun-solaris", x86_64_sun_solaris),
("sparcv9-sun-solaris", sparcv9_sun_solaris),

("x86_64-unknown-illumos", x86_64_unknown_illumos),
Expand Down Expand Up @@ -1986,24 +1985,6 @@ impl TargetTriple {
Ok(TargetTriple::TargetPath(canonicalized_path))
}

/// Creates a target triple from its alias
pub fn from_alias(triple: String) -> Self {
macro_rules! target_aliases {
( $(($alias:literal, $target:literal ),)+ ) => {
match triple.as_str() {
$( $alias => TargetTriple::from_triple($target), )+
_ => TargetTriple::TargetTriple(triple),
}
}
}

target_aliases! {
// `x86_64-pc-solaris` is an alias for `x86_64_sun_solaris` for backwards compatibility reasons.
// (See <https://github.com/rust-lang/rust/issues/40531>.)
("x86_64-pc-solaris", "x86_64-sun-solaris"),
}
}

/// Returns a string triple for this target.
///
/// If this target is a path, the file name (without extension) is returned.
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_target/src/spec/solaris_base.rs
Expand Up @@ -3,7 +3,6 @@ use crate::spec::TargetOptions;
pub fn opts() -> TargetOptions {
TargetOptions {
os: "solaris".to_string(),
vendor: "sun".to_string(),
dynamic_linking: true,
executables: true,
has_rpath: true,
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_target/src/spec/sparcv9_sun_solaris.rs
Expand Up @@ -7,6 +7,7 @@ pub fn target() -> Target {
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m64".to_string()]);
// llvm calls this "v9"
base.cpu = "v9".to_string();
base.vendor = "sun".to_string();
base.max_atomic_width = Some(64);

Target {
Expand Down
19 changes: 19 additions & 0 deletions compiler/rustc_target/src/spec/x86_64_pc_solaris.rs
@@ -0,0 +1,19 @@
use crate::spec::{LinkerFlavor, StackProbeType, Target};

pub fn target() -> Target {
let mut base = super::solaris_base::opts();
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m64".to_string()]);
base.cpu = "x86-64".to_string();
base.vendor = "pc".to_string();
base.max_atomic_width = Some(64);
base.stack_probes = StackProbeType::InlineOrCall { min_llvm_version_for_inline: (11, 0, 1) };

Target {
llvm_target: "x86_64-pc-solaris".to_string(),
pointer_width: 64,
data_layout: "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
.to_string(),
arch: "x86_64".to_string(),
options: base,
}
}
1 change: 1 addition & 0 deletions compiler/rustc_target/src/spec/x86_64_sun_solaris.rs
Expand Up @@ -4,6 +4,7 @@ pub fn target() -> Target {
let mut base = super::solaris_base::opts();
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m64".to_string()]);
base.cpu = "x86-64".to_string();
base.vendor = "sun".to_string();
base.max_atomic_width = Some(64);
base.stack_probes = StackProbeType::InlineOrCall { min_llvm_version_for_inline: (11, 0, 1) };

Expand Down
5 changes: 4 additions & 1 deletion src/bootstrap/bootstrap.py
Expand Up @@ -240,13 +240,16 @@ def default_build_triple(verbose):
else:
ostype = 'unknown-linux-gnu'
elif ostype == 'SunOS':
ostype = 'sun-solaris'
ostype = 'pc-solaris'
# On Solaris, uname -m will return a machine classification instead
# of a cpu type, so uname -p is recommended instead. However, the
# output from that option is too generic for our purposes (it will
# always emit 'i386' on x86/amd64 systems). As such, isainfo -k
# must be used instead.
cputype = require(['isainfo', '-k']).decode(default_encoding)
# sparc cpus have sun as a target vendor
if 'sparc' in cputype:
ostype = 'sun-solaris'
elif ostype.startswith('MINGW'):
# msys' `uname` does not print gcc configuration, but prints msys
# configuration. so we cannot believe `uname -m`:
Expand Down

0 comments on commit c615bed

Please sign in to comment.