[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH rust] Add new target for GNU/Hurd
From: |
Damien Zammit |
Subject: |
[PATCH rust] Add new target for GNU/Hurd |
Date: |
Sun, 09 Jul 2023 10:05:24 +0000 |
This is not quite right for library/std, but applies clean to a 2021 tree
of rust on hash 25ea6be13e3 and allows up to the following stage1 build
until libstd breaks on hurd, (with the other patch for rust-libc).
./x.py build --target x86_64-unknown-linux-gnu \
--target i686-unknown-hurd-gnu
---
compiler/rustc_codegen_llvm/Cargo.toml | 2 +-
compiler/rustc_codegen_ssa/Cargo.toml | 2 +-
compiler/rustc_data_structures/Cargo.toml | 2 +-
compiler/rustc_driver/Cargo.toml | 2 +-
compiler/rustc_interface/Cargo.toml | 2 +-
compiler/rustc_llvm/Cargo.toml | 2 +-
compiler/rustc_metadata/Cargo.toml | 2 +-
compiler/rustc_target/src/spec/hurd_base.rs | 16 ++
.../rustc_target/src/spec/hurd_gnu_base.rs | 5 +
.../src/spec/i686_unknown_hurd_gnu.rs | 19 +++
compiler/rustc_target/src/spec/mod.rs | 4 +
library/panic_abort/Cargo.toml | 2 +-
library/panic_unwind/Cargo.toml | 2 +-
library/std/Cargo.toml | 2 +-
library/std/src/os/hurd/fs.rs | 137 ++++++++++++++++++
library/std/src/os/hurd/mod.rs | 6 +
library/std/src/os/hurd/raw.rs | 83 +++++++++++
library/std/src/os/mod.rs | 2 +
library/std/src/sys/unix/env.rs | 11 ++
library/std/src/sys/unix/ext/mod.rs | 2 +
library/std/src/sys/unix/net.rs | 5 +
library/std/src/sys/unix/thread_local_dtor.rs | 1 +
library/std/src/sys_common/net.rs | 1 +
library/test/Cargo.toml | 2 +-
library/unwind/Cargo.toml | 2 +-
src/bootstrap/Cargo.toml | 2 +-
src/bootstrap/bootstrap.py | 4 +-
src/tools/rustc-workspace-hack/Cargo.toml | 2 +-
28 files changed, 309 insertions(+), 15 deletions(-)
create mode 100644 compiler/rustc_target/src/spec/hurd_base.rs
create mode 100644 compiler/rustc_target/src/spec/hurd_gnu_base.rs
create mode 100644 compiler/rustc_target/src/spec/i686_unknown_hurd_gnu.rs
create mode 100644 library/std/src/os/hurd/fs.rs
create mode 100644 library/std/src/os/hurd/mod.rs
create mode 100644 library/std/src/os/hurd/raw.rs
diff --git a/compiler/rustc_codegen_llvm/Cargo.toml
b/compiler/rustc_codegen_llvm/Cargo.toml
index 4999cb3c7ab..39e09a28692 100644
--- a/compiler/rustc_codegen_llvm/Cargo.toml
+++ b/compiler/rustc_codegen_llvm/Cargo.toml
@@ -11,7 +11,7 @@ doctest = false
[dependencies]
bitflags = "1.0"
cstr = "0.2"
-libc = "0.2"
+libc = { path = "../../../rust-libc" }
measureme = "9.1.0"
snap = "1"
tracing = "0.1"
diff --git a/compiler/rustc_codegen_ssa/Cargo.toml
b/compiler/rustc_codegen_ssa/Cargo.toml
index 7c1aaebb9ab..1911fe812bf 100644
--- a/compiler/rustc_codegen_ssa/Cargo.toml
+++ b/compiler/rustc_codegen_ssa/Cargo.toml
@@ -12,7 +12,7 @@ bitflags = "1.2.1"
cc = "1.0.1"
itertools = "0.9"
tracing = "0.1"
-libc = "0.2.50"
+libc = { path = "../../../rust-libc" }
jobserver = "0.1.11"
tempfile = "3.1"
pathdiff = "0.2.0"
diff --git a/compiler/rustc_data_structures/Cargo.toml
b/compiler/rustc_data_structures/Cargo.toml
index d32598e716e..f1e638a71b2 100644
--- a/compiler/rustc_data_structures/Cargo.toml
+++ b/compiler/rustc_data_structures/Cargo.toml
@@ -26,7 +26,7 @@ smallvec = { version = "1.6.1", features = ["union",
"may_dangle"] }
rustc_index = { path = "../rustc_index", package = "rustc_index" }
bitflags = "1.2.1"
measureme = "9.1.0"
-libc = "0.2"
+libc = { path = "../../../rust-libc" }
stacker = "0.1.12"
tempfile = "3.0.5"
diff --git a/compiler/rustc_driver/Cargo.toml b/compiler/rustc_driver/Cargo.toml
index c521f2041d8..87f7ed60468 100644
--- a/compiler/rustc_driver/Cargo.toml
+++ b/compiler/rustc_driver/Cargo.toml
@@ -8,7 +8,7 @@ edition = "2018"
crate-type = ["dylib"]
[dependencies]
-libc = "0.2"
+libc = { path = "../../../rust-libc" }
atty = "0.2"
tracing = { version = "0.1.25" }
tracing-subscriber = { version = "0.2.16", default-features = false, features
= ["fmt", "env-filter", "smallvec", "parking_lot", "ansi"] }
diff --git a/compiler/rustc_interface/Cargo.toml
b/compiler/rustc_interface/Cargo.toml
index 3bfe8da505f..a4a62fb6942 100644
--- a/compiler/rustc_interface/Cargo.toml
+++ b/compiler/rustc_interface/Cargo.toml
@@ -8,7 +8,7 @@ edition = "2018"
doctest = false
[dependencies]
-libc = "0.2"
+libc = { path = "../../../rust-libc" }
tracing = "0.1"
rustc-rayon-core = "0.3.1"
rayon = { version = "0.3.1", package = "rustc-rayon" }
diff --git a/compiler/rustc_llvm/Cargo.toml b/compiler/rustc_llvm/Cargo.toml
index e29af053289..855692c0c7a 100644
--- a/compiler/rustc_llvm/Cargo.toml
+++ b/compiler/rustc_llvm/Cargo.toml
@@ -9,7 +9,7 @@ static-libstdcpp = []
emscripten = []
[dependencies]
-libc = "0.2.73"
+libc = { path = "../../../rust-libc" }
[build-dependencies]
build_helper = { path = "../../src/build_helper" }
diff --git a/compiler/rustc_metadata/Cargo.toml
b/compiler/rustc_metadata/Cargo.toml
index 29fa0b70069..d820c1780a5 100644
--- a/compiler/rustc_metadata/Cargo.toml
+++ b/compiler/rustc_metadata/Cargo.toml
@@ -8,7 +8,7 @@ edition = "2018"
doctest = false
[dependencies]
-libc = "0.2"
+libc = { path = "../../../rust-libc" }
snap = "1"
tracing = "0.1"
smallvec = { version = "1.6.1", features = ["union", "may_dangle"] }
diff --git a/compiler/rustc_target/src/spec/hurd_base.rs
b/compiler/rustc_target/src/spec/hurd_base.rs
new file mode 100644
index 00000000000..00be0fc263c
--- /dev/null
+++ b/compiler/rustc_target/src/spec/hurd_base.rs
@@ -0,0 +1,16 @@
+use crate::spec::TargetOptions;
+
+pub fn opts() -> TargetOptions {
+ TargetOptions {
+ os: "hurd".to_string(),
+ dynamic_linking: true,
+ executables: true,
+ os_family: Some("unix".to_string()),
+ linker_is_gnu: true,
+ has_rpath: true,
+ position_independent_executables: true,
+ has_elf_tls: true,
+ crt_static_respected: true,
+ ..Default::default()
+ }
+}
diff --git a/compiler/rustc_target/src/spec/hurd_gnu_base.rs
b/compiler/rustc_target/src/spec/hurd_gnu_base.rs
new file mode 100644
index 00000000000..4ab922c643c
--- /dev/null
+++ b/compiler/rustc_target/src/spec/hurd_gnu_base.rs
@@ -0,0 +1,5 @@
+use crate::spec::TargetOptions;
+
+pub fn opts() -> TargetOptions {
+ TargetOptions { env: "gnu".to_string(), ..super::hurd_base::opts() }
+}
diff --git a/compiler/rustc_target/src/spec/i686_unknown_hurd_gnu.rs
b/compiler/rustc_target/src/spec/i686_unknown_hurd_gnu.rs
new file mode 100644
index 00000000000..c48de65ca33
--- /dev/null
+++ b/compiler/rustc_target/src/spec/i686_unknown_hurd_gnu.rs
@@ -0,0 +1,19 @@
+use crate::spec::{LinkerFlavor, StackProbeType, Target};
+
+pub fn target() -> Target {
+ let mut base = super::hurd_gnu_base::opts();
+ base.cpu = "pentium4".to_string();
+ base.max_atomic_width = Some(64);
+
base.pre_link_args.entry(LinkerFlavor::Gcc).or_default().push("-m32".to_string());
+ base.stack_probes = StackProbeType::InlineOrCall {
min_llvm_version_for_inline: (11, 0, 1) };
+
+ Target {
+ llvm_target: "i686-unknown-hurd-gnu".to_string(),
+ pointer_width: 32,
+ data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
+ f64:32:64-f80:32-n8:16:32-S128"
+ .to_string(),
+ arch: "x86".to_string(),
+ options: base,
+ }
+}
diff --git a/compiler/rustc_target/src/spec/mod.rs
b/compiler/rustc_target/src/spec/mod.rs
index 57b0a36e009..bdd41bdd170 100644
--- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs
@@ -63,6 +63,8 @@
mod haiku_base;
mod hermit_base;
mod hermit_kernel_base;
+mod hurd_base;
+mod hurd_gnu_base;
mod illumos_base;
mod l4re_base;
mod linux_base;
@@ -701,6 +703,8 @@ fn $module() {
}
supported_targets! {
+ ("i686-unknown-hurd-gnu", i686_unknown_hurd_gnu),
+
("x86_64-unknown-linux-gnu", x86_64_unknown_linux_gnu),
("x86_64-unknown-linux-gnux32", x86_64_unknown_linux_gnux32),
("i686-unknown-linux-gnu", i686_unknown_linux_gnu),
diff --git a/library/panic_abort/Cargo.toml b/library/panic_abort/Cargo.toml
index caa89aa30d0..098c051057c 100644
--- a/library/panic_abort/Cargo.toml
+++ b/library/panic_abort/Cargo.toml
@@ -15,5 +15,5 @@ doc = false
[dependencies]
cfg-if = { version = "0.1.8", features = ['rustc-dep-of-std'] }
core = { path = "../core" }
-libc = { version = "0.2", default-features = false }
+libc = { path = "../../../rust-libc", default-features = false }
compiler_builtins = "0.1.0"
diff --git a/library/panic_unwind/Cargo.toml b/library/panic_unwind/Cargo.toml
index 533f059a85e..316e0a5b6ed 100644
--- a/library/panic_unwind/Cargo.toml
+++ b/library/panic_unwind/Cargo.toml
@@ -15,7 +15,7 @@ doc = false
[dependencies]
alloc = { path = "../alloc" }
core = { path = "../core" }
-libc = { version = "0.2", default-features = false }
+libc = { path = "../../../rust-libc", default-features = false }
unwind = { path = "../unwind" }
compiler_builtins = "0.1.0"
cfg-if = "0.1.8"
diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml
index 22ca7ed09b4..3831177b529 100644
--- a/library/std/Cargo.toml
+++ b/library/std/Cargo.toml
@@ -16,7 +16,7 @@ cfg-if = { version = "0.1.8", features = ['rustc-dep-of-std']
}
panic_unwind = { path = "../panic_unwind", optional = true }
panic_abort = { path = "../panic_abort" }
core = { path = "../core" }
-libc = { version = "0.2.88", default-features = false, features =
['rustc-dep-of-std'] }
+libc = { path = "../../../rust-libc", default-features = false, features =
['rustc-dep-of-std'] }
compiler_builtins = { version = "0.1.39" }
profiler_builtins = { path = "../profiler_builtins", optional = true }
unwind = { path = "../unwind" }
diff --git a/library/std/src/os/hurd/fs.rs b/library/std/src/os/hurd/fs.rs
new file mode 100644
index 00000000000..464f7174982
--- /dev/null
+++ b/library/std/src/os/hurd/fs.rs
@@ -0,0 +1,137 @@
+#![stable(feature = "metadata_ext", since = "1.1.0")]
+
+use crate::fs::Metadata;
+use crate::sys_common::AsInner;
+
+#[allow(deprecated)]
+use crate::os::hurd::raw;
+
+/// OS-specific extensions to [`fs::Metadata`].
+///
+/// [`fs::Metadata`]: crate::fs::Metadata
+#[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_birthtime(&self) -> i64;
+ #[stable(feature = "metadata_ext2", since = "1.8.0")]
+ fn st_birthtime_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_ext2", since = "1.8.0")]
+ fn st_flags(&self) -> u32;
+ #[stable(feature = "metadata_ext2", since = "1.8.0")]
+ fn st_gen(&self) -> u32;
+}
+
+#[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_atimensec 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_mtimensec 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_ctimensec as i64
+ }
+ fn st_birthtime(&self) -> i64 {
+ self.as_inner().as_inner().st_birthtime as i64
+ }
+ fn st_birthtime_nsec(&self) -> i64 {
+ self.as_inner().as_inner().st_birthtimensec 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
+ }
+ fn st_gen(&self) -> u32 {
+ self.as_inner().as_inner().st_gen as u32
+ }
+ fn st_flags(&self) -> u32 {
+ self.as_inner().as_inner().st_flags as u32
+ }
+}
diff --git a/library/std/src/os/hurd/mod.rs b/library/std/src/os/hurd/mod.rs
new file mode 100644
index 00000000000..497a51a1df6
--- /dev/null
+++ b/library/std/src/os/hurd/mod.rs
@@ -0,0 +1,6 @@
+//! OpenBSD-specific definitions
+
+#![stable(feature = "raw_ext", since = "1.1.0")]
+
+pub mod fs;
+pub mod raw;
diff --git a/library/std/src/os/hurd/raw.rs b/library/std/src/os/hurd/raw.rs
new file mode 100644
index 00000000000..475fcdcc4aa
--- /dev/null
+++ b/library/std/src/os/hurd/raw.rs
@@ -0,0 +1,83 @@
+//! NetBSD-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 = usize;
+
+#[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: u64,
+ #[stable(feature = "raw_ext", since = "1.1.0")]
+ pub st_mode: u32,
+ #[stable(feature = "raw_ext", since = "1.1.0")]
+ pub st_ino: u64,
+ #[stable(feature = "raw_ext", since = "1.1.0")]
+ pub st_nlink: u32,
+ #[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: u64,
+ #[stable(feature = "raw_ext", since = "1.1.0")]
+ pub st_atime: i64,
+ #[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: i64,
+ #[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: i64,
+ #[stable(feature = "raw_ext", since = "1.1.0")]
+ pub st_ctime_nsec: c_long,
+ #[stable(feature = "raw_ext", since = "1.1.0")]
+ pub st_birthtime: i64,
+ #[stable(feature = "raw_ext", since = "1.1.0")]
+ pub st_birthtime_nsec: c_long,
+ #[stable(feature = "raw_ext", since = "1.1.0")]
+ pub st_size: i64,
+ #[stable(feature = "raw_ext", since = "1.1.0")]
+ pub st_blocks: i64,
+ #[stable(feature = "raw_ext", since = "1.1.0")]
+ pub st_blksize: i32,
+ #[stable(feature = "raw_ext", since = "1.1.0")]
+ pub st_flags: u32,
+ #[stable(feature = "raw_ext", since = "1.1.0")]
+ pub st_gen: u32,
+ st_spare: [u32; 2],
+}
diff --git a/library/std/src/os/mod.rs b/library/std/src/os/mod.rs
index b95511e43d8..4ec808a5d51 100644
--- a/library/std/src/os/mod.rs
+++ b/library/std/src/os/mod.rs
@@ -76,5 +76,7 @@
pub mod solaris;
#[cfg(target_os = "vxworks")]
pub mod vxworks;
+#[cfg(target_os = "hurd")]
+pub mod hurd;
pub mod raw;
diff --git a/library/std/src/sys/unix/env.rs b/library/std/src/sys/unix/env.rs
index 7f5e9b04dba..298b746e28c 100644
--- a/library/std/src/sys/unix/env.rs
+++ b/library/std/src/sys/unix/env.rs
@@ -173,3 +173,14 @@ pub mod os {
pub const EXE_SUFFIX: &str = "";
pub const EXE_EXTENSION: &str = "";
}
+
+#[cfg(target_os = "hurd")]
+pub mod os {
+ pub const FAMILY: &str = "unix";
+ pub const OS: &str = "hurd";
+ pub const DLL_PREFIX: &str = "lib";
+ pub const DLL_SUFFIX: &str = ".so";
+ pub const DLL_EXTENSION: &str = "so";
+ pub const EXE_SUFFIX: &str = "";
+ pub const EXE_EXTENSION: &str = "";
+}
diff --git a/library/std/src/sys/unix/ext/mod.rs
b/library/std/src/sys/unix/ext/mod.rs
index e5048f7e545..c95563bbaac 100644
--- a/library/std/src/sys/unix/ext/mod.rs
+++ b/library/std/src/sys/unix/ext/mod.rs
@@ -62,6 +62,8 @@
use crate::os::redox as platform;
#[cfg(target_os = "solaris")]
use crate::os::solaris as platform;
+ #[cfg(target_os = "hurd")]
+ use crate::os::hurd as platform;
}
}
diff --git a/library/std/src/sys/unix/net.rs b/library/std/src/sys/unix/net.rs
index e6b61062d15..2b5f5b917e9 100644
--- a/library/std/src/sys/unix/net.rs
+++ b/library/std/src/sys/unix/net.rs
@@ -61,6 +61,7 @@ pub fn new_raw(fam: c_int, ty: c_int) -> io::Result<Socket> {
target_os = "freebsd",
target_os = "illumos",
target_os = "linux",
+ target_os = "hurd",
target_os = "netbsd",
target_os = "opensbd",
))] {
@@ -98,6 +99,7 @@ pub fn new_pair(fam: c_int, ty: c_int) -> io::Result<(Socket,
Socket)> {
target_os = "freebsd",
target_os = "illumos",
target_os = "linux",
+ target_os = "hurd",
target_os = "netbsd",
target_os = "opensbd",
))] {
@@ -203,6 +205,7 @@ pub fn accept(&self, storage: *mut sockaddr, len: *mut
socklen_t) -> io::Result<
target_os = "freebsd",
target_os = "illumos",
target_os = "linux",
+ target_os = "hurd",
target_os = "netbsd",
target_os = "opensbd",
))] {
@@ -278,6 +281,7 @@ pub fn recv_from(&self, buf: &mut [u8]) ->
io::Result<(usize, SocketAddr)> {
target_os = "emscripten",
target_os = "freebsd",
target_os = "linux",
+ target_os = "hurd",
target_os = "netbsd",
target_os = "openbsd",
))]
@@ -309,6 +313,7 @@ pub fn is_write_vectored(&self) -> bool {
target_os = "emscripten",
target_os = "freebsd",
target_os = "linux",
+ target_os = "hurd",
target_os = "netbsd",
target_os = "openbsd",
))]
diff --git a/library/std/src/sys/unix/thread_local_dtor.rs
b/library/std/src/sys/unix/thread_local_dtor.rs
index c3275eb6f0e..c60d4c5dca0 100644
--- a/library/std/src/sys/unix/thread_local_dtor.rs
+++ b/library/std/src/sys/unix/thread_local_dtor.rs
@@ -13,6 +13,7 @@
// fallback implementation to use as well.
#[cfg(any(
target_os = "linux",
+ target_os = "hurd",
target_os = "fuchsia",
target_os = "redox",
target_os = "emscripten"
diff --git a/library/std/src/sys_common/net.rs
b/library/std/src/sys_common/net.rs
index d5f29c4a439..0959010e81b 100644
--- a/library/std/src/sys_common/net.rs
+++ b/library/std/src/sys_common/net.rs
@@ -33,6 +33,7 @@
cfg_if::cfg_if! {
if #[cfg(any(
target_os = "linux", target_os = "android",
+ target_os = "hurd",
target_os = "dragonfly", target_os = "freebsd",
target_os = "openbsd", target_os = "netbsd",
target_os = "haiku"))] {
diff --git a/library/test/Cargo.toml b/library/test/Cargo.toml
index 226557430df..c3119899560 100644
--- a/library/test/Cargo.toml
+++ b/library/test/Cargo.toml
@@ -13,7 +13,7 @@ getopts = { version = "0.2.21", features =
['rustc-dep-of-std'] }
term = { path = "../term" }
std = { path = "../std" }
core = { path = "../core" }
-libc = { version = "0.2", default-features = false }
+libc = { path = "../../../rust-libc", default-features = false }
panic_unwind = { path = "../panic_unwind" }
panic_abort = { path = "../panic_abort" }
diff --git a/library/unwind/Cargo.toml b/library/unwind/Cargo.toml
index 69128591e06..2ff632a07d5 100644
--- a/library/unwind/Cargo.toml
+++ b/library/unwind/Cargo.toml
@@ -16,7 +16,7 @@ doc = false
[dependencies]
core = { path = "../core" }
-libc = { version = "0.2.79", features = ['rustc-dep-of-std'], default-features
= false }
+libc = { path = "../../../rust-libc", features = ['rustc-dep-of-std'],
default-features = false }
compiler_builtins = "0.1.0"
cfg-if = "0.1.8"
diff --git a/src/bootstrap/Cargo.toml b/src/bootstrap/Cargo.toml
index c14ad6fa5ff..9879c5f1051 100644
--- a/src/bootstrap/Cargo.toml
+++ b/src/bootstrap/Cargo.toml
@@ -41,7 +41,7 @@ filetime = "0.2"
num_cpus = "1.0"
getopts = "0.2.19"
cc = "1.0.35"
-libc = "0.2"
+libc = { path = "../../../rust-libc" }
serde = { version = "1.0.8", features = ["derive"] }
serde_json = "1.0.2"
toml = "0.5"
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index 23af00d6293..4a5bec04edd 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -226,7 +226,8 @@ def default_build_triple(verbose):
'FreeBSD': 'unknown-freebsd',
'Haiku': 'unknown-haiku',
'NetBSD': 'unknown-netbsd',
- 'OpenBSD': 'unknown-openbsd'
+ 'OpenBSD': 'unknown-openbsd',
+ 'GNU': 'unknown-hurd'
}
# Consider the direct transformation first and then the special cases
@@ -287,6 +288,7 @@ def default_build_triple(verbose):
'i386': 'i686',
'i486': 'i686',
'i686': 'i686',
+ 'i686-AT386': 'i686',
'i786': 'i686',
'powerpc': 'powerpc',
'powerpc64': 'powerpc64',
diff --git a/src/tools/rustc-workspace-hack/Cargo.toml
b/src/tools/rustc-workspace-hack/Cargo.toml
index 8da7db2dfdd..699afb4e926 100644
--- a/src/tools/rustc-workspace-hack/Cargo.toml
+++ b/src/tools/rustc-workspace-hack/Cargo.toml
@@ -64,7 +64,7 @@ features = [
byteorder = { version = "1", features = ['default', 'std'] }
curl-sys = { version = "0.4.13", features = ["http2", "libnghttp2-sys"],
optional = true }
crossbeam-utils = { version = "0.7.2", features = ["nightly"] }
-libc = { version = "0.2.79", features = ["align"] }
+libc = { path = "../../../../rust-libc", features = ["align"] }
# Ensure default features of libz-sys, which are disabled in some scenarios.
libz-sys = { version = "1.1.2" }
proc-macro2 = { version = "1", features = ["default"] }
--
2.39.0
[PATCH rust-libc] i386-gnu: Add GNU/Hurd os, Damien Zammit, 2023/07/09