Skip to content

Commit c615bed

Browse files
committed
Change default Solaris x86 target to x86_64-pc-solaris
1 parent d2731d8 commit c615bed

File tree

7 files changed

+28
-24
lines changed

7 files changed

+28
-24
lines changed

compiler/rustc_session/src/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1536,7 +1536,7 @@ fn parse_target_triple(matches: &getopts::Matches, error_format: ErrorOutputType
15361536
early_error(error_format, &format!("target file {:?} does not exist", path))
15371537
})
15381538
}
1539-
Some(target) => TargetTriple::from_alias(target),
1539+
Some(target) => TargetTriple::TargetTriple(target),
15401540
_ => TargetTriple::from_triple(host_triple()),
15411541
}
15421542
}

compiler/rustc_target/src/spec/mod.rs

+2-21
Original file line numberDiff line numberDiff line change
@@ -736,9 +736,8 @@ supported_targets! {
736736
("armv7r-none-eabi", armv7r_none_eabi),
737737
("armv7r-none-eabihf", armv7r_none_eabihf),
738738

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

744743
("x86_64-unknown-illumos", x86_64_unknown_illumos),
@@ -1986,24 +1985,6 @@ impl TargetTriple {
19861985
Ok(TargetTriple::TargetPath(canonicalized_path))
19871986
}
19881987

1989-
/// Creates a target triple from its alias
1990-
pub fn from_alias(triple: String) -> Self {
1991-
macro_rules! target_aliases {
1992-
( $(($alias:literal, $target:literal ),)+ ) => {
1993-
match triple.as_str() {
1994-
$( $alias => TargetTriple::from_triple($target), )+
1995-
_ => TargetTriple::TargetTriple(triple),
1996-
}
1997-
}
1998-
}
1999-
2000-
target_aliases! {
2001-
// `x86_64-pc-solaris` is an alias for `x86_64_sun_solaris` for backwards compatibility reasons.
2002-
// (See <https://github.com/rust-lang/rust/issues/40531>.)
2003-
("x86_64-pc-solaris", "x86_64-sun-solaris"),
2004-
}
2005-
}
2006-
20071988
/// Returns a string triple for this target.
20081989
///
20091990
/// If this target is a path, the file name (without extension) is returned.

compiler/rustc_target/src/spec/solaris_base.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use crate::spec::TargetOptions;
33
pub fn opts() -> TargetOptions {
44
TargetOptions {
55
os: "solaris".to_string(),
6-
vendor: "sun".to_string(),
76
dynamic_linking: true,
87
executables: true,
98
has_rpath: true,

compiler/rustc_target/src/spec/sparcv9_sun_solaris.rs

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pub fn target() -> Target {
77
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m64".to_string()]);
88
// llvm calls this "v9"
99
base.cpu = "v9".to_string();
10+
base.vendor = "sun".to_string();
1011
base.max_atomic_width = Some(64);
1112

1213
Target {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
use crate::spec::{LinkerFlavor, StackProbeType, Target};
2+
3+
pub fn target() -> Target {
4+
let mut base = super::solaris_base::opts();
5+
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m64".to_string()]);
6+
base.cpu = "x86-64".to_string();
7+
base.vendor = "pc".to_string();
8+
base.max_atomic_width = Some(64);
9+
base.stack_probes = StackProbeType::InlineOrCall { min_llvm_version_for_inline: (11, 0, 1) };
10+
11+
Target {
12+
llvm_target: "x86_64-pc-solaris".to_string(),
13+
pointer_width: 64,
14+
data_layout: "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
15+
.to_string(),
16+
arch: "x86_64".to_string(),
17+
options: base,
18+
}
19+
}

compiler/rustc_target/src/spec/x86_64_sun_solaris.rs

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pub fn target() -> Target {
44
let mut base = super::solaris_base::opts();
55
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m64".to_string()]);
66
base.cpu = "x86-64".to_string();
7+
base.vendor = "sun".to_string();
78
base.max_atomic_width = Some(64);
89
base.stack_probes = StackProbeType::InlineOrCall { min_llvm_version_for_inline: (11, 0, 1) };
910

src/bootstrap/bootstrap.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,16 @@ def default_build_triple(verbose):
240240
else:
241241
ostype = 'unknown-linux-gnu'
242242
elif ostype == 'SunOS':
243-
ostype = 'sun-solaris'
243+
ostype = 'pc-solaris'
244244
# On Solaris, uname -m will return a machine classification instead
245245
# of a cpu type, so uname -p is recommended instead. However, the
246246
# output from that option is too generic for our purposes (it will
247247
# always emit 'i386' on x86/amd64 systems). As such, isainfo -k
248248
# must be used instead.
249249
cputype = require(['isainfo', '-k']).decode(default_encoding)
250+
# sparc cpus have sun as a target vendor
251+
if 'sparc' in cputype:
252+
ostype = 'sun-solaris'
250253
elif ostype.startswith('MINGW'):
251254
# msys' `uname` does not print gcc configuration, but prints msys
252255
# configuration. so we cannot believe `uname -m`:

0 commit comments

Comments
 (0)