me
/
guix
Archived
1
0
Fork 0
This repository has been archived on 2024-08-07. You can view files and clone it, but cannot push or open issues/pull-requests.
guix/gnu/packages/patches/rustc-1.39.0-src.patch

100 lines
4.0 KiB
Diff
Raw Normal View History

gnu: rust: Bootstrap rust from 1.39.0 and optimize build time. Only stage 1 (rather than stage 2) rustc and cargo are built and the installation phase rewritten to not invoke the build tool, which helps to shorten the build time to about 10 minutes per Rust on a fast machine. The total build time should take less than 4h30, down from the current 8 hours on a Ryzen 3900X CPU. * gnu/packages/patches/rust-reproducible-builds.patch: Delete file. * gnu/packages/patches/rustc-1.39.0-src.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it, and un-register rust-reproducible-builds.patch. * gnu/packages/rust.scm (%mrustc-commit): New variable. (%mrustc-source): Update to latest commit. (rust-1.29): Morph into... (rust-1.39): ... this. [source]: Adjust the snippet, patches and patch-flags fields. [inputs]: Replace llvm-7 by llvm (9). [make-flags]: Add the RUSTC_VERSION, MRUSTC_TARGET_VER and OUTDIR_SUF make variables. Remove the RUSTCSRC make variable. [phases]{copy-mrustc-and-patch}: Rename to... {setup-mrustc-sources}: ... this. A symbolic link is created inside the mrustc directory, pointing to the Rust 1.39.0 sources. {patch-makefiles}: Adjust directory. Patch date and git definitions. Edit out the RUSTC_SRC_DL prerequisite. Adjust the patching of a shebang. {patch-cargo-checksums}: Adjust. {configure-cargo-home}: New phase. {configure}: Create and add a 'cc' shim to PATH. {build}: Do not invoke make in parallel mode inside the run_rustc directory. (rust-1.30): Morph into... (rust-1.40): ... this, integrating the changes introduced between 1.30 and 1.40. [modules]: Properly import (guix build cargo-utils). [phases]{add-cc-shim-to-path}: New phase. {configure}: Increase the codegen-units value to 256. {build}: Only build stage 1 rustc and cargo, and group the commands into one invocation. {install}: Manually install the stage 1 build artifacts. {patch-cargo-checksums}: Remove the ad-hoc use-modules, no longer needed. [source]: Adjust. [arguments]: Set validate-runpath? to #f. [phases]{patch-cargo-checksums}: Remove phase. {configure}: Repatriate the jemalloc configuration changes from 1.40. [native-inputs]: Replace the rust-1.29 inputs by rust-1.39. Use regular jemalloc and llvm versions. (rust-1.41)[phases]: Add the patch-cargo-checksums phase. (rust-1.31, rust-1.32, rust-1.33, rust-1.34, rust-1.35, rust-1.36, rust-1.37) (rust-1.38, rust-1.39, rust-1.40): Delete variables. (rust-1.46)[phases]{install}: Group build, test and install commands. (rust-1.47)[phases]{build}: Override to adjust for the relocation of the standard library source directory.
2021-08-21 05:01:23 +00:00
# This modified patch is to disable the hunk applying to LLVM, unbundled in Guix.
# Add mrustc slice length intrinsics
--- src/libcore/intrinsics.rs
+++ src/libcore/intrinsics.rs
@@ -685,4 +685,8 @@
pub fn min_align_of_val<T: ?Sized>(_: &T) -> usize;
+ /// Obtain the length of a slice pointer
+ #[cfg(rust_compiler="mrustc")]
+ pub fn mrustc_slice_len<T>(pointer: *const [T]) -> usize;
+
/// Gets a static string slice containing the name of a type.
pub fn type_name<T: ?Sized>() -> &'static str;
--- src/libcore/slice/mod.rs
+++ src/libcore/slice/mod.rs
@@ -68,5 +68,8 @@
pub const fn len(&self) -> usize {
- unsafe {
- crate::ptr::Repr { rust: self }.raw.len
- }
+ #[cfg(not(rust_compiler="mrustc"))]
+ #[cfg_attr(not(bootstrap), allow_internal_unstable(const_fn_union))]
+ const fn len_inner<T>(s: &[T]) -> usize { unsafe { crate::ptr::Repr { rust: s }.raw.len } };
+ #[cfg(rust_compiler="mrustc")]
+ const fn len_inner<T>(s: &[T]) -> usize { unsafe { crate::intrinsics::mrustc_slice_len(s) } }
+ len_inner(self)
}
#
# Static-link rustc_codegen_llvm so the generated rustc is standalone
# > Note: Interacts with `rustc-1.39.0-overrides.toml`
#
--- src/librustc_interface/util.rs
+++ src/librustc_interface/util.rs
@@ -421,2 +421,4 @@
pub fn get_codegen_sysroot(backend_name: &str) -> fn() -> Box<dyn CodegenBackend> {
+ #[cfg(rust_compiler="mrustc")]
+ { if(backend_name == "llvm") { extern "Rust" { fn __rustc_codegen_backend() -> Box<dyn CodegenBackend>; } return || unsafe { __rustc_codegen_backend() } } }
// For now we only allow this function to be called once as it'll dlopen a
# Disable most architecture intrinsics
--- src/stdarch/crates/std_detect/src/detect/mod.rs
+++ src/stdarch/crates/std_detect/src/detect/mod.rs
@@ -74,4 +74,7 @@
// this run-time detection logic is never called.
#[path = "os/other.rs"]
mod os;
+ } else if #[cfg(rust_compiler="mrustc")] {
+ #[path = "os/other.rs"]
+ mod os;
} else if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
--- vendor/ppv-lite86/src/lib.rs
+++ vendor/ppv-lite86/src/lib.rs
@@ -12,10 +12,10 @@
-#[cfg(all(feature = "simd", target_arch = "x86_64", not(miri)))]
+#[cfg(all(feature = "simd", target_arch = "x86_64", not(miri), not(rust_compiler="mrustc")))]
pub mod x86_64;
-#[cfg(all(feature = "simd", target_arch = "x86_64", not(miri)))]
+#[cfg(all(feature = "simd", target_arch = "x86_64", not(miri), not(rust_compiler="mrustc")))]
use self::x86_64 as arch;
-#[cfg(any(miri, not(all(feature = "simd", any(target_arch = "x86_64")))))]
+#[cfg(any(miri, rust_compiler="mrustc", not(all(feature = "simd", any(target_arch = "x86_64")))))]
pub mod generic;
-#[cfg(any(miri, not(all(feature = "simd", any(target_arch = "x86_64")))))]
+#[cfg(any(miri, rust_compiler="mrustc", not(all(feature = "simd", any(target_arch = "x86_64")))))]
use self::generic as arch;
# diff --git a/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h b/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h
# index da9d9d5bfdc0..3d47471f0ef0 100644
# --- src/llvm-project/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h
# +++ src/llvm-project/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h
# @@ -16,6 +16,8 @@
# #include "llvm/Demangle/DemangleConfig.h"
# #include "llvm/Demangle/StringView.h"
# #include <array>
# +#include <cstdint>
# +#include <string>
# namespace llvm {
# namespace itanium_demangle {
##
## gcc (used by mrustc) has 16-byte uint128_t alignment, while rustc uses 8
##
#--- src/libsyntax/ast.rs
#+++ src/libsyntax/ast.rs
#@@ -986,2 +986,2 @@
#-#[cfg(target_arch = "x86_64")]
#-static_assert_size!(Expr, 96);
#+//#[cfg(target_arch = "x86_64")]
#+//static_assert_size!(Expr, 96);
#--- src/librustc/ty/sty.rs
#+++ src/librustc/ty/sty.rs
#@@ -2258,2 +2258,2 @@
#-#[cfg(target_arch = "x86_64")]
#-static_assert_size!(Const<'_>, 40);
#+//#[cfg(target_arch = "x86_64")]
#+//static_assert_size!(Const<'_>, 40);