diff --git a/.gitmodules b/.gitmodules index f9bd42edab3f4529c0a32fc56fb92499830e27d2..8598166fc16810ae602a7d419e9ca4918825b123 100644 --- a/.gitmodules +++ b/.gitmodules @@ -28,8 +28,8 @@ shallow = true [submodule "src/llvm-project"] path = src/llvm-project - url = https://github.com/rust-lang/llvm-project.git - branch = rustc/19.1-2024-12-03 + url = https://gitlab.redox-os.org/redox-os/llvm-project.git + branch = redox-2025-01-12 shallow = true [submodule "src/doc/embedded-book"] path = src/doc/embedded-book diff --git a/compiler/rustc_driver/Cargo.toml b/compiler/rustc_driver/Cargo.toml index ae9712ad66d83a6212cfb3cbcaeff8aca64b97c0..eddb8b20947cb3ac44e9e259f54e6b4403c5705a 100644 --- a/compiler/rustc_driver/Cargo.toml +++ b/compiler/rustc_driver/Cargo.toml @@ -4,7 +4,7 @@ version = "0.0.0" edition = "2021" [lib] -crate-type = ["dylib"] +crate-type = ["dylib", "rlib"] [dependencies] # tidy-alphabetical-start diff --git a/compiler/rustc_session/src/filesearch.rs b/compiler/rustc_session/src/filesearch.rs index 4be013fd6fd9c5b4c45ee43dd219bf4c7dc54e99..5229b6e8f5b9b47d89e12484a112513509c9eeef 100644 --- a/compiler/rustc_session/src/filesearch.rs +++ b/compiler/rustc_session/src/filesearch.rs @@ -280,5 +280,5 @@ fn from_env_args_next() -> Option<PathBuf> { } } - Ok(from_env_args_next().unwrap_or(default_from_rustc_driver_dll()?)) + Ok(from_env_args_next().unwrap_or(default_from_rustc_driver_dll().unwrap_or(PathBuf::from("/")))) } diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index a149f682c560e22a3be5f00b434389bf89b30589..39f577f8b1265e1f1af1313baf95662ffdb09756 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -1773,6 +1773,7 @@ fn $module() { ("aarch64-unknown-redox", aarch64_unknown_redox), ("i686-unknown-redox", i686_unknown_redox), ("x86_64-unknown-redox", x86_64_unknown_redox), + ("riscv64gc-unknown-redox", riscv64gc_unknown_redox), ("i386-apple-ios", i386_apple_ios), ("x86_64-apple-ios", x86_64_apple_ios), diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_redox.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_redox.rs new file mode 100644 index 0000000000000000000000000000000000000000..359cb0fc159d8d0c2da4f33cf953106067771621 --- /dev/null +++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_redox.rs @@ -0,0 +1,25 @@ +use crate::spec::{base, CodeModel, Target}; + +pub fn target() -> Target { + let mut base = base::redox::opts(); + base.code_model = Some(CodeModel::Medium); + base.cpu = "generic-rv64".into(); + base.features = "+m,+a,+f,+d,+c".into(); + base.llvm_abiname = "lp64d".into(); + base.plt_by_default = false; + base.max_atomic_width = Some(64); + + Target { + llvm_target: "riscv64-unknown-redox".into(), + metadata: crate::spec::TargetMetadata { + description: None, + tier: None, + host_tools: None, + std: None, + }, + pointer_width: 64, + data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(), + arch: "riscv64".into(), + options: base + } +} diff --git a/library/alloc/Cargo.toml b/library/alloc/Cargo.toml index 07596fa16f9829a4d3557f7adf5dd7578a157bb7..6ed8c7051e23bb33432a2ed24188e7b304bb6904 100644 --- a/library/alloc/Cargo.toml +++ b/library/alloc/Cargo.toml @@ -10,7 +10,7 @@ edition = "2021" [dependencies] core = { path = "../core" } -compiler_builtins = { version = "=0.1.140", features = ['rustc-dep-of-std'] } +compiler_builtins = { version = "=0.1.140", features = ['rustc-dep-of-std', 'no-f16-f128'] } [dev-dependencies] rand = { version = "0.8.5", default-features = false, features = ["alloc"] } diff --git a/library/std/src/path.rs b/library/std/src/path.rs index 35e920ab34476c387e3be2cdf19bb1c01acb67a8..ae7f490b5e69060ec0883e629d856429bdfdafd5 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -183,6 +183,10 @@ pub enum Prefix<'a> { /// Prefix `C:` for the given disk drive. #[stable(feature = "rust1", since = "1.0.0")] Disk(#[stable(feature = "rust1", since = "1.0.0")] u8), + + /// Scheme `file:` used on Redox + #[stable(feature = "rust1", since = "1.0.0")] + Scheme(#[stable(feature = "rust1", since = "1.0.0")] &'a OsStr), } impl<'a> Prefix<'a> { @@ -201,6 +205,7 @@ fn os_str_len(s: &OsStr) -> usize { UNC(x, y) => 2 + os_str_len(x) + if os_str_len(y) > 0 { 1 + os_str_len(y) } else { 0 }, DeviceNS(x) => 4 + os_str_len(x), Disk(_) => 2, + Scheme(x) => os_str_len(x) + 1, } } @@ -2844,8 +2849,7 @@ pub fn components(&self) -> Components<'_> { Components { path: self.as_u8_slice(), prefix, - has_physical_root: has_physical_root(self.as_u8_slice(), prefix) - || has_redox_scheme(self.as_u8_slice()), + has_physical_root: has_physical_root(self.as_u8_slice(), prefix), front: State::Prefix, back: State::Body, } diff --git a/library/std/src/sys/path/unix.rs b/library/std/src/sys/path/unix.rs index 2a7c025c3c46a8a7332b0bb3284a01dd758a6e64..271271708e53680eda89680c03e070a6986aedcc 100644 --- a/library/std/src/sys/path/unix.rs +++ b/library/std/src/sys/path/unix.rs @@ -12,8 +12,14 @@ pub fn is_verbatim_sep(b: u8) -> bool { b == b'/' } -#[inline] -pub fn parse_prefix(_: &OsStr) -> Option<Prefix<'_>> { +pub fn parse_prefix(path: &OsStr) -> Option<Prefix<'_>> { + if cfg!(target_os = "redox") { + if let Some(path_str) = path.to_str() { + if let Some(i) = path_str.find(':') { + return Some(Prefix::Scheme(OsStr::new(&path_str[..i]))); + } + } + } None } diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py index a86c20d46bda59d6dec200ca4d527d8cbd48cea6..b2004ccbe0b63360f8d312e44aee53084ca6cf1c 100755 --- a/src/bootstrap/configure.py +++ b/src/bootstrap/configure.py @@ -102,6 +102,7 @@ o( "whether patch binaries for usage with Nix toolchains", ) o("new-symbol-mangling", "rust.new-symbol-mangling", "use symbol-mangling-version v0") +o("download-ci-llvm", "llvm.download-ci-llvm", "download pre-built LLVM") v("llvm-cflags", "llvm.cflags", "build LLVM with these extra compiler flags") v("llvm-cxxflags", "llvm.cxxflags", "build LLVM with these extra compiler flags") diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs index 6f7f84428000822711b84f7e884ba2741cb8efd1..69bc6b8e858ab9f5e6a6d8afb194fc07db0bc8ce 100644 --- a/src/bootstrap/src/core/build_steps/dist.rs +++ b/src/bootstrap/src/core/build_steps/dist.rs @@ -405,7 +405,7 @@ fn prepare_image(builder: &Builder<'_>, compiler: Compiler, image: &Path) { t!(fs::create_dir_all(image.join("bin"))); builder.cp_link_r(&src.join("bin"), &image.join("bin")); - // If enabled, copy rustdoc binary + /*TODO: Broken on Redox if builder .config .tools @@ -429,6 +429,7 @@ fn prepare_image(builder: &Builder<'_>, compiler: Compiler, image: &Path) { ) { builder.install(&ra_proc_macro_srv, &image.join("libexec"), 0o755); } + */ let libdir_relative = builder.libdir_relative(compiler); diff --git a/src/bootstrap/src/core/sanity.rs b/src/bootstrap/src/core/sanity.rs index ed0155622c2261c7534ce97f0548e9790684029c..189660e6c451848c7da77000711dd885873e86b4 100644 --- a/src/bootstrap/src/core/sanity.rs +++ b/src/bootstrap/src/core/sanity.rs @@ -34,6 +34,8 @@ pub struct Finder { // Targets can be removed from this list once they are present in the stage0 compiler (usually by updating the beta compiler of the bootstrap). const STAGE0_MISSING_TARGETS: &[&str] = &[ // just a dummy comment so the list doesn't get onelined + "i686-unknown-redox", + "riscv64gc-unknown-redox", ]; /// Minimum version threshold for libstdc++ required when using prebuilt LLVM diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs index 4cc812829f9b60abf6a78bcd909ea498611491a5..98746358bb390b3e0f178f0e9866e6f0b17da2a9 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs @@ -1274,7 +1274,7 @@ fn is_lld_direct_linker(&self, target: TargetSelection) -> bool { /// Returns if this target should statically link the C runtime, if specified fn crt_static(&self, target: TargetSelection) -> Option<bool> { - if target.contains("pc-windows-msvc") { + if target.contains("pc-windows-msvc") || target.contains("redox") { Some(true) } else { self.config.target_config.get(&target).and_then(|t| t.crt_static) diff --git a/src/llvm-project b/src/llvm-project index 59512b00273829823da74050d373b8d46dbca558..5d20c8f543e9d65a3acf1a9be0688a7ee3390728 160000 --- a/src/llvm-project +++ b/src/llvm-project @@ -1 +1 @@ -Subproject commit 59512b00273829823da74050d373b8d46dbca558 +Subproject commit 5d20c8f543e9d65a3acf1a9be0688a7ee3390728