diff options
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r-- | gnu/packages/patches/freeglut-gcc-compat.patch | 53 | ||||
-rw-r--r-- | gnu/packages/patches/mrustc-riscv64-support.patch | 48 | ||||
-rw-r--r-- | gnu/packages/patches/postgresql-riscv-spinlocks.patch | 41 | ||||
-rw-r--r-- | gnu/packages/patches/rustc-1.39.0-src.patch | 99 | ||||
-rw-r--r-- | gnu/packages/patches/rustc-1.54.0-src.patch | 117 |
5 files changed, 165 insertions, 193 deletions
diff --git a/gnu/packages/patches/freeglut-gcc-compat.patch b/gnu/packages/patches/freeglut-gcc-compat.patch deleted file mode 100644 index 126bbd89f4..0000000000 --- a/gnu/packages/patches/freeglut-gcc-compat.patch +++ /dev/null @@ -1,53 +0,0 @@ -Fix build failure with GCC 10. - -Taken from upstream: -https://github.com/dcnieho/FreeGLUT/commit/b9998bbc1e1c329f6bf69c24606a2be7a4973b8c - -diff --git a/src/fg_gl2.c b/src/fg_gl2.c ---- a/src/fg_gl2.c -+++ b/src/fg_gl2.c -@@ -27,6 +27,20 @@ - #include "fg_internal.h" - #include "fg_gl2.h" - -+#ifndef GL_ES_VERSION_2_0 -+/* GLES2 has the corresponding entry points built-in, and these fgh-prefixed -+ * names are defined in fg_gl2.h header to reference them, for any other case, -+ * define them as function pointers here. -+ */ -+FGH_PFNGLGENBUFFERSPROC fghGenBuffers; -+FGH_PFNGLDELETEBUFFERSPROC fghDeleteBuffers; -+FGH_PFNGLBINDBUFFERPROC fghBindBuffer; -+FGH_PFNGLBUFFERDATAPROC fghBufferData; -+FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC fghEnableVertexAttribArray; -+FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC fghDisableVertexAttribArray; -+FGH_PFNGLVERTEXATTRIBPOINTERPROC fghVertexAttribPointer; -+#endif -+ - void FGAPIENTRY glutSetVertexAttribCoord3(GLint attrib) { - if (fgStructure.CurrentWindow != NULL) - fgStructure.CurrentWindow->Window.attribute_v_coord = attrib; -diff --git a/src/fg_gl2.h b/src/fg_gl2.h ---- a/src/fg_gl2.h -+++ b/src/fg_gl2.h -@@ -67,13 +67,13 @@ typedef void (APIENTRY *FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); - typedef void (APIENTRY *FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint); - typedef void (APIENTRY *FGH_PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); - --FGH_PFNGLGENBUFFERSPROC fghGenBuffers; --FGH_PFNGLDELETEBUFFERSPROC fghDeleteBuffers; --FGH_PFNGLBINDBUFFERPROC fghBindBuffer; --FGH_PFNGLBUFFERDATAPROC fghBufferData; --FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC fghEnableVertexAttribArray; --FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC fghDisableVertexAttribArray; --FGH_PFNGLVERTEXATTRIBPOINTERPROC fghVertexAttribPointer; -+extern FGH_PFNGLGENBUFFERSPROC fghGenBuffers; -+extern FGH_PFNGLDELETEBUFFERSPROC fghDeleteBuffers; -+extern FGH_PFNGLBINDBUFFERPROC fghBindBuffer; -+extern FGH_PFNGLBUFFERDATAPROC fghBufferData; -+extern FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC fghEnableVertexAttribArray; -+extern FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC fghDisableVertexAttribArray; -+extern FGH_PFNGLVERTEXATTRIBPOINTERPROC fghVertexAttribPointer; - - # endif - diff --git a/gnu/packages/patches/mrustc-riscv64-support.patch b/gnu/packages/patches/mrustc-riscv64-support.patch new file mode 100644 index 0000000000..6312116585 --- /dev/null +++ b/gnu/packages/patches/mrustc-riscv64-support.patch @@ -0,0 +1,48 @@ +Patch sent upstream for review: +https://github.com/thepowersgang/mrustc/pull/276 + +diff --git a/src/trans/target.cpp b/src/trans/target.cpp +index 420a2870..4d5eefb3 100644 +--- a/src/trans/target.cpp ++++ b/src/trans/target.cpp +@@ -65,6 +65,13 @@ const TargetArch ARCH_POWERPC64LE = { + { /*atomic(u8)=*/true, true, true, true, true }, + TargetArch::Alignments(2, 4, 8, 16, 4, 8, 8) + }; ++// This is a guess ++const TargetArch ARCH_RISCV64 = { ++ "riscv64", ++ 64, false, ++ { /*atomic(u8)=*/true, true, true, true, true }, ++ TargetArch::Alignments(2, 4, 8, 16, 4, 8, 8) ++}; + TargetSpec g_target; + + +@@ -455,6 +462,13 @@ namespace + ARCH_POWERPC64LE + }; + } ++ else if(target_name == "riscv64-unknown-linux-gnu") ++ { ++ return TargetSpec { ++ "unix", "linux", "gnu", {CodegenMode::Gnu11, false, "riscv64-unknown-linux-gnu", BACKEND_C_OPTS_GNU}, ++ ARCH_RISCV64 ++ }; ++ } + else if(target_name == "i586-pc-windows-gnu") + { + return TargetSpec { +diff --git a/tools/common/target_detect.h b/tools/common/target_detect.h +index a052da6b..42fea91a 100644 +--- a/tools/common/target_detect.h ++++ b/tools/common/target_detect.h +@@ -34,6 +34,8 @@ + # define DEFAULT_TARGET_NAME "powerpc64-unknown-linux-gnu" + # elif defined(__powerpc64__) && defined(__LITTLE_ENDIAN__) + # define DEFAULT_TARGET_NAME "powerpc64le-unknown-linux-gnu" ++# elif defined(__riscv) && __riscv_xlen == 64 ++# define DEFAULT_TARGET_NAME "riscv64-unknown-linux-gnu" + # else + # warning "Unable to detect a suitable default target (linux-gnu)" + # endif diff --git a/gnu/packages/patches/postgresql-riscv-spinlocks.patch b/gnu/packages/patches/postgresql-riscv-spinlocks.patch deleted file mode 100644 index 984a573642..0000000000 --- a/gnu/packages/patches/postgresql-riscv-spinlocks.patch +++ /dev/null @@ -1,41 +0,0 @@ -https://www.postgresql.org/message-id/dea97b6d-f55f-1f6d-9109-504aa7dfa421@gentoo.org - -The attached patch adds native spinlock support to PostgreSQL on RISC-V -systems. As suspected by Richard W.M. Jones of Red Hat back in 2016, the -__sync_lock_test_and_set() approach applied on arm and arm64 works here -as well. - - -Tested against PostgreSQL 13.3 on a physical rv64gc system (BeagleV -Starlight beta board) - builds and installs fine, all tests pass. From -what I can see in gcc documentation this should in theory work on rv32 -(and possibly rv128) as well, therefore the patch as it stands covers -all RISC-V systems (i.e. doesn't check the value of __risc_xlen) - but I -haven't confirmed this experimentally. - ---- a/src/include/storage/s_lock.h -+++ b/src/include/storage/s_lock.h -@@ -315,12 +315,12 @@ - #endif /* __ia64__ || __ia64 */ - - /* -- * On ARM and ARM64, we use __sync_lock_test_and_set(int *, int) if available. -+ * On ARM, ARM64 and RISC-V, we use __sync_lock_test_and_set(int *, int) if available. - * - * We use the int-width variant of the builtin because it works on more chips - * than other widths. - */ --#if defined(__arm__) || defined(__arm) || defined(__aarch64__) || defined(__aarch64) -+#if defined(__arm__) || defined(__arm) || defined(__aarch64__) || defined(__aarch64) || defined(__riscv) - #ifdef HAVE_GCC__SYNC_INT32_TAS - #define HAS_TEST_AND_SET - -@@ -337,7 +337,7 @@ - #define S_UNLOCK(lock) __sync_lock_release(lock) - - #endif /* HAVE_GCC__SYNC_INT32_TAS */ --#endif /* __arm__ || __arm || __aarch64__ || __aarch64 */ -+#endif /* __arm__ || __arm || __aarch64__ || __aarch64 || __riscv */ - - - /* S/390 and S/390x Linux (32- and 64-bit zSeries) */ diff --git a/gnu/packages/patches/rustc-1.39.0-src.patch b/gnu/packages/patches/rustc-1.39.0-src.patch deleted file mode 100644 index 7859bd44d5..0000000000 --- a/gnu/packages/patches/rustc-1.39.0-src.patch +++ /dev/null @@ -1,99 +0,0 @@ -# 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); - diff --git a/gnu/packages/patches/rustc-1.54.0-src.patch b/gnu/packages/patches/rustc-1.54.0-src.patch new file mode 100644 index 0000000000..d075dce39b --- /dev/null +++ b/gnu/packages/patches/rustc-1.54.0-src.patch @@ -0,0 +1,117 @@ +# mrustc is much better at enum packing, so causes almost all of these to be smaller by one pointer +--- compiler/rustc_ast/src/ast.rs ++++ compiler/rustc_ast/src/ast.rs +@@ -1075,7 +1075,7 @@ pub struct Expr { + } + + // `Expr` is used a lot. Make sure it doesn't unintentionally get bigger. +-#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] ++#[cfg(all(not(rust_compiler = "mrustc"), target_arch = "x86_64", target_pointer_width = "64"))] + rustc_data_structures::static_assert_size!(Expr, 104); + + impl Expr { +@@ -2779,7 +2779,7 @@ pub enum AssocItemKind { + MacCall(MacCall), + } + +-#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] ++#[cfg(all(not(rust_compiler = "mrustc"), target_arch = "x86_64", target_pointer_width = "64"))] + rustc_data_structures::static_assert_size!(AssocItemKind, 72); + + impl AssocItemKind { +@@ -2831,7 +2831,7 @@ pub enum ForeignItemKind { + MacCall(MacCall), + } + +-#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] ++#[cfg(all(not(rust_compiler="mrustc"),target_arch = "x86_64", target_pointer_width = "64"))] + rustc_data_structures::static_assert_size!(ForeignItemKind, 72); + + impl From<ForeignItemKind> for ItemKind { +--- compiler/rustc_hir/src/hir.rs ++++ compiler/rustc_hir/src/hir.rs +@@ -3050,3 +3050,3 @@ + // Some nodes are used a lot. Make sure they don't unintentionally get bigger. +-#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] ++#[cfg(all(not(rust_compiler="mrustc"),target_arch = "x86_64", target_pointer_width = "64"))] + mod size_asserts { +--- compiler/rustc_middle/src/mir/interpret/error.rs ++++ compiler/rustc_middle/src/mir/interpret/error.rs +@@ -452,2 +452,2 @@ +-#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] ++#[cfg(all(not(rust_compiler="mrustc"), target_arch = "x86_64", target_pointer_width = "64"))] + static_assert_size!(InterpError<'_>, 64); +--- compiler/rustc_middle/src/mir/mod.rs ++++ compiler/rustc_middle/src/mir/mod.rs +@@ -2203,2 +2203,2 @@ +-#[cfg(target_arch = "x86_64")] ++#[cfg(all(not(rust_compiler="mrustc"), target_arch = "x86_64"))] + static_assert_size!(AggregateKind<'_>, 48); +--- compiler/rustc_middle/src/thir.rs ++++ compiler/rustc_middle/src/thir.rs +@@ -147,2 +147,2 @@ +-#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] ++#[cfg(all(not(rust_compiler="mrustc"), target_arch = "x86_64", target_pointer_width = "64"))] + rustc_data_structures::static_assert_size!(Expr<'_>, 144); +--- compiler/rustc_mir/src/interpret/place.rs ++++ compiler/rustc_mir/src/interpret/place.rs +@@ -91,2 +91,2 @@ +-#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] ++#[cfg(all(not(rust_compiler = "mrustc"), target_arch = "x86_64", target_pointer_width = "64"))] + rustc_data_structures::static_assert_size!(Place, 64); +@@ -100,2 +100,2 @@ +-#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] ++#[cfg(all(not(rust_compiler = "mrustc"), target_arch = "x86_64", target_pointer_width = "64"))] + rustc_data_structures::static_assert_size!(PlaceTy<'_>, 80); +--- compiler/rustc_mir/src/interpret/operand.rs ++++ compiler/rustc_mir/src/interpret/operand.rs +@@ -35,2 +35,2 @@ +-#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] ++#[cfg(all(not(rust_compiler = "mrustc"), target_arch = "x86_64", target_pointer_width = "64"))] + rustc_data_structures::static_assert_size!(Immediate, 56); +@@ -90,2 +90,2 @@ +-#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] ++#[cfg(all(not(rust_compiler = "mrustc"), target_arch = "x86_64", target_pointer_width = "64"))] + rustc_data_structures::static_assert_size!(ImmTy<'_>, 72); + +# +# Disable crc32fast's use of stdarch +# +--- vendor/crc32fast/src/specialized/mod.rs ++++ vendor/crc32fast/src/specialized/mod.rs +@@ -1,5 +1,6 @@ + cfg_if! { + if #[cfg(all( ++ not(rust_compiler = "mrustc"), + crc32fast_stdarchx86, + any(target_arch = "x86", target_arch = "x86_64") + ))] { + +# +# Disable std_detect's detection logic (use the same logic as miri) +# +--- library/stdarch/crates/std_detect/src/detect/mod.rs ++++ library/stdarch/crates/std_detect/src/detect/mod.rs +@@ -88,2 +88,2 @@ + cfg_if! { +- if #[cfg(miri)] { ++ if #[cfg(any(miri, rust_compiler = "mrustc"))] { + +# PPV-Lite also needs to know that we're pretending to be miri +--- vendor/ppv-lite86/src/lib.rs ++++ vendor/ppv-lite86/src/lib.rs +@@ -12,9 +12,9 @@ +-#[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; + |