forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#71145 - pfmooney:illumos-triple, r=nagisa
Add illumos triple This fixes rust-lang#55553 and adds support for `illumos` as a `target_os` on `x86_64`. In addition to the compile spec and libstd additions, several library dependencies have been bumped in order to permit working builds of cargo and rustup for the new target. Work originally started by @jasonbking, with subsequent additions by @pfmooney and @jclulow.
- Loading branch information
Showing
28 changed files
with
370 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
use crate::spec::{LinkArgs, LinkerFlavor, TargetOptions}; | ||
use std::default::Default; | ||
|
||
pub fn opts() -> TargetOptions { | ||
let mut late_link_args = LinkArgs::new(); | ||
late_link_args.insert( | ||
LinkerFlavor::Gcc, | ||
vec![ | ||
// LLVM will insert calls to the stack protector functions | ||
// "__stack_chk_fail" and "__stack_chk_guard" into code in native | ||
// object files. Some platforms include these symbols directly in | ||
// libc, but at least historically these have been provided in | ||
// libssp.so on illumos and Solaris systems. | ||
"-lssp".to_string(), | ||
], | ||
); | ||
|
||
TargetOptions { | ||
dynamic_linking: true, | ||
executables: true, | ||
has_rpath: true, | ||
target_family: Some("unix".to_string()), | ||
is_like_solaris: true, | ||
limit_rdylib_exports: false, // Linker doesn't support this | ||
eliminate_frame_pointer: false, | ||
late_link_args, | ||
|
||
// While we support ELF TLS, rust requires a way to register | ||
// cleanup handlers (in C, this would be something along the lines of: | ||
// void register_callback(void (*fn)(void *), void *arg); | ||
// (see src/libstd/sys/unix/fast_thread_local.rs) that is currently | ||
// missing in illumos. For now at least, we must fallback to using | ||
// pthread_{get,set}specific. | ||
//has_elf_tls: true, | ||
|
||
// FIXME: Currently, rust is invoking cc to link, which ends up | ||
// causing these to get included twice. We should eventually transition | ||
// to having rustc invoke ld directly, in which case these will need to | ||
// be uncommented. | ||
// | ||
// We want XPG6 behavior from libc and libm. See standards(5) | ||
//pre_link_objects_exe: vec![ | ||
// "/usr/lib/amd64/values-Xc.o".to_string(), | ||
// "/usr/lib/amd64/values-xpg6.o".to_string(), | ||
//], | ||
..Default::default() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use crate::spec::{LinkerFlavor, Target, TargetResult}; | ||
|
||
pub fn target() -> TargetResult { | ||
let mut base = super::illumos_base::opts(); | ||
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m64".to_string(), "-std=c99".to_string()]); | ||
base.cpu = "x86-64".to_string(); | ||
base.max_atomic_width = Some(64); | ||
|
||
Ok(Target { | ||
// LLVM does not currently have a separate illumos target, | ||
// so we still pass Solaris to it | ||
llvm_target: "x86_64-pc-solaris".to_string(), | ||
target_endian: "little".to_string(), | ||
target_pointer_width: "64".to_string(), | ||
target_c_int_width: "32".to_string(), | ||
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(), | ||
arch: "x86_64".to_string(), | ||
target_os: "illumos".to_string(), | ||
target_env: String::new(), | ||
target_vendor: "unknown".to_string(), | ||
linker_flavor: LinkerFlavor::Gcc, | ||
options: base, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
#![stable(feature = "metadata_ext", since = "1.1.0")] | ||
|
||
use libc; | ||
|
||
use crate::fs::Metadata; | ||
use crate::sys_common::AsInner; | ||
|
||
#[allow(deprecated)] | ||
use crate::os::illumos::raw; | ||
|
||
/// OS-specific extensions to [`fs::Metadata`]. | ||
/// | ||
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html | ||
#[stable(feature = "metadata_ext", since = "1.1.0")] | ||
pub trait MetadataExt { | ||
/// Gain a reference to the underlying `stat` structure which contains | ||
/// the raw information returned by the OS. | ||
/// | ||
/// The contents of the returned `stat` are **not** consistent across | ||
/// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the | ||
/// cross-Unix abstractions contained within the raw stat. | ||
#[stable(feature = "metadata_ext", since = "1.1.0")] | ||
#[rustc_deprecated( | ||
since = "1.8.0", | ||
reason = "deprecated in favor of the accessor methods of this trait" | ||
)] | ||
#[allow(deprecated)] | ||
fn as_raw_stat(&self) -> &raw::stat; | ||
|
||
#[stable(feature = "metadata_ext2", since = "1.8.0")] | ||
fn st_dev(&self) -> u64; | ||
#[stable(feature = "metadata_ext2", since = "1.8.0")] | ||
fn st_ino(&self) -> u64; | ||
#[stable(feature = "metadata_ext2", since = "1.8.0")] | ||
fn st_mode(&self) -> u32; | ||
#[stable(feature = "metadata_ext2", since = "1.8.0")] | ||
fn st_nlink(&self) -> u64; | ||
#[stable(feature = "metadata_ext2", since = "1.8.0")] | ||
fn st_uid(&self) -> u32; | ||
#[stable(feature = "metadata_ext2", since = "1.8.0")] | ||
fn st_gid(&self) -> u32; | ||
#[stable(feature = "metadata_ext2", since = "1.8.0")] | ||
fn st_rdev(&self) -> u64; | ||
#[stable(feature = "metadata_ext2", since = "1.8.0")] | ||
fn st_size(&self) -> u64; | ||
#[stable(feature = "metadata_ext2", since = "1.8.0")] | ||
fn st_atime(&self) -> i64; | ||
#[stable(feature = "metadata_ext2", since = "1.8.0")] | ||
fn st_atime_nsec(&self) -> i64; | ||
#[stable(feature = "metadata_ext2", since = "1.8.0")] | ||
fn st_mtime(&self) -> i64; | ||
#[stable(feature = "metadata_ext2", since = "1.8.0")] | ||
fn st_mtime_nsec(&self) -> i64; | ||
#[stable(feature = "metadata_ext2", since = "1.8.0")] | ||
fn st_ctime(&self) -> i64; | ||
#[stable(feature = "metadata_ext2", since = "1.8.0")] | ||
fn st_ctime_nsec(&self) -> i64; | ||
#[stable(feature = "metadata_ext2", since = "1.8.0")] | ||
fn st_blksize(&self) -> u64; | ||
#[stable(feature = "metadata_ext2", since = "1.8.0")] | ||
fn st_blocks(&self) -> u64; | ||
} | ||
|
||
#[stable(feature = "metadata_ext", since = "1.1.0")] | ||
impl MetadataExt for Metadata { | ||
#[allow(deprecated)] | ||
fn as_raw_stat(&self) -> &raw::stat { | ||
unsafe { &*(self.as_inner().as_inner() as *const libc::stat as *const raw::stat) } | ||
} | ||
fn st_dev(&self) -> u64 { | ||
self.as_inner().as_inner().st_dev as u64 | ||
} | ||
fn st_ino(&self) -> u64 { | ||
self.as_inner().as_inner().st_ino as u64 | ||
} | ||
fn st_mode(&self) -> u32 { | ||
self.as_inner().as_inner().st_mode as u32 | ||
} | ||
fn st_nlink(&self) -> u64 { | ||
self.as_inner().as_inner().st_nlink as u64 | ||
} | ||
fn st_uid(&self) -> u32 { | ||
self.as_inner().as_inner().st_uid as u32 | ||
} | ||
fn st_gid(&self) -> u32 { | ||
self.as_inner().as_inner().st_gid as u32 | ||
} | ||
fn st_rdev(&self) -> u64 { | ||
self.as_inner().as_inner().st_rdev as u64 | ||
} | ||
fn st_size(&self) -> u64 { | ||
self.as_inner().as_inner().st_size as u64 | ||
} | ||
fn st_atime(&self) -> i64 { | ||
self.as_inner().as_inner().st_atime as i64 | ||
} | ||
fn st_atime_nsec(&self) -> i64 { | ||
self.as_inner().as_inner().st_atime_nsec as i64 | ||
} | ||
fn st_mtime(&self) -> i64 { | ||
self.as_inner().as_inner().st_mtime as i64 | ||
} | ||
fn st_mtime_nsec(&self) -> i64 { | ||
self.as_inner().as_inner().st_mtime_nsec as i64 | ||
} | ||
fn st_ctime(&self) -> i64 { | ||
self.as_inner().as_inner().st_ctime as i64 | ||
} | ||
fn st_ctime_nsec(&self) -> i64 { | ||
self.as_inner().as_inner().st_ctime_nsec as i64 | ||
} | ||
fn st_blksize(&self) -> u64 { | ||
self.as_inner().as_inner().st_blksize as u64 | ||
} | ||
fn st_blocks(&self) -> u64 { | ||
self.as_inner().as_inner().st_blocks as u64 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//! illumos-specific definitions | ||
#![stable(feature = "raw_ext", since = "1.1.0")] | ||
|
||
pub mod fs; | ||
pub mod raw; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
//! illumos-specific raw type definitions | ||
#![stable(feature = "raw_ext", since = "1.1.0")] | ||
#![rustc_deprecated( | ||
since = "1.8.0", | ||
reason = "these type aliases are no longer supported by the standard library, the `libc` \ | ||
crate on crates.io should be used instead for the correct definitions" | ||
)] | ||
#![allow(deprecated)] | ||
|
||
use crate::os::raw::c_long; | ||
use crate::os::unix::raw::{gid_t, uid_t}; | ||
|
||
#[stable(feature = "raw_ext", since = "1.1.0")] | ||
pub type blkcnt_t = u64; | ||
#[stable(feature = "raw_ext", since = "1.1.0")] | ||
pub type blksize_t = u64; | ||
#[stable(feature = "raw_ext", since = "1.1.0")] | ||
pub type dev_t = u64; | ||
#[stable(feature = "raw_ext", since = "1.1.0")] | ||
pub type fflags_t = u32; | ||
#[stable(feature = "raw_ext", since = "1.1.0")] | ||
pub type ino_t = u64; | ||
#[stable(feature = "raw_ext", since = "1.1.0")] | ||
pub type mode_t = u32; | ||
#[stable(feature = "raw_ext", since = "1.1.0")] | ||
pub type nlink_t = u64; | ||
#[stable(feature = "raw_ext", since = "1.1.0")] | ||
pub type off_t = u64; | ||
#[stable(feature = "raw_ext", since = "1.1.0")] | ||
pub type time_t = i64; | ||
|
||
#[stable(feature = "pthread_t", since = "1.8.0")] | ||
pub type pthread_t = u32; | ||
|
||
#[repr(C)] | ||
#[derive(Clone)] | ||
#[stable(feature = "raw_ext", since = "1.1.0")] | ||
pub struct stat { | ||
#[stable(feature = "raw_ext", since = "1.1.0")] | ||
pub st_dev: dev_t, | ||
#[stable(feature = "raw_ext", since = "1.1.0")] | ||
pub st_ino: ino_t, | ||
#[stable(feature = "raw_ext", since = "1.1.0")] | ||
pub st_mode: mode_t, | ||
#[stable(feature = "raw_ext", since = "1.1.0")] | ||
pub st_nlink: nlink_t, | ||
#[stable(feature = "raw_ext", since = "1.1.0")] | ||
pub st_uid: uid_t, | ||
#[stable(feature = "raw_ext", since = "1.1.0")] | ||
pub st_gid: gid_t, | ||
#[stable(feature = "raw_ext", since = "1.1.0")] | ||
pub st_rdev: dev_t, | ||
#[stable(feature = "raw_ext", since = "1.1.0")] | ||
pub st_size: off_t, | ||
#[stable(feature = "raw_ext", since = "1.1.0")] | ||
pub st_atime: time_t, | ||
#[stable(feature = "raw_ext", since = "1.1.0")] | ||
pub st_atime_nsec: c_long, | ||
#[stable(feature = "raw_ext", since = "1.1.0")] | ||
pub st_mtime: time_t, | ||
#[stable(feature = "raw_ext", since = "1.1.0")] | ||
pub st_mtime_nsec: c_long, | ||
#[stable(feature = "raw_ext", since = "1.1.0")] | ||
pub st_ctime: time_t, | ||
#[stable(feature = "raw_ext", since = "1.1.0")] | ||
pub st_ctime_nsec: c_long, | ||
#[stable(feature = "raw_ext", since = "1.1.0")] | ||
pub st_blksize: blksize_t, | ||
#[stable(feature = "raw_ext", since = "1.1.0")] | ||
pub st_blocks: blkcnt_t, | ||
#[stable(feature = "raw_ext", since = "1.1.0")] | ||
pub __unused: [u8; 16], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.