From f3f79bd6c6027277b123921edd4064a396358cd3 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Sun, 18 Feb 2018 01:40:29 -0500 Subject: [PATCH] boehmgc: Add patch for RISC-V support. --- .../libraries/boehm-gc/default.nix | 4 +- .../libraries/boehm-gc/riscv.patch | 53 +++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/libraries/boehm-gc/riscv.patch diff --git a/pkgs/development/libraries/boehm-gc/default.nix b/pkgs/development/libraries/boehm-gc/default.nix index c1bcb46bae6e..d4e91deb7449 100644 --- a/pkgs/development/libraries/boehm-gc/default.nix +++ b/pkgs/development/libraries/boehm-gc/default.nix @@ -27,7 +27,9 @@ stdenv.mkDerivation rec { patches = [ (fetchpatch { url = "https://raw.githubusercontent.com/gentoo/musl/85b6a600996bdd71162b357e9ba93d8559342432/dev-libs/boehm-gc/files/boehm-gc-7.6.0-sys_select.patch"; sha256 = "1gydwlklvci30f5dpp5ccw2p2qpph5y41r55wx9idamjlq66fbb3"; - }) ]; + }) ] ++ + # https://github.com/ivmai/bdwgc/pull/208 + lib.optional hostPlatform.isRiscV ./riscv.patch; configureFlags = [ "--enable-cplusplus" ] diff --git a/pkgs/development/libraries/boehm-gc/riscv.patch b/pkgs/development/libraries/boehm-gc/riscv.patch new file mode 100644 index 000000000000..249137d0a0dc --- /dev/null +++ b/pkgs/development/libraries/boehm-gc/riscv.patch @@ -0,0 +1,53 @@ +diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h +index a8e55dd2..439cc88d 100644 +--- a/include/private/gcconfig.h ++++ b/include/private/gcconfig.h +@@ -650,6 +650,15 @@ + # endif + # define mach_type_known + # endif ++# if defined(__riscv) && defined(LINUX) ++# if __riscv_xlen == 32 ++# define RISCV32 ++# define mach_type_known ++# elif __riscv_xlen == 64 ++# define RISCV64 ++# define mach_type_known ++# endif ++# endif + + # if defined(SN_TARGET_PSP2) + # define mach_type_known +@@ -2970,6 +2979,32 @@ + # endif + # endif + ++# ifdef RISCV32 ++# define CPP_WORDSZ 32 ++# define MACH_TYPE "RISC-V 32" ++# define ALIGNMENT 4 ++# ifdef LINUX ++# define OS_TYPE "LINUX" ++ extern int __data_start[]; ++# define DATASTART ((ptr_t)__data_start) ++# define LINUX_STACKBOTTOM ++# define DYNAMIC_LOADING ++# endif ++# endif ++ ++# ifdef RISCV64 ++# define CPP_WORDSZ 64 ++# define MACH_TYPE "RISC-V 64" ++# define ALIGNMENT 8 ++# ifdef LINUX ++# define OS_TYPE "LINUX" ++ extern int __data_start[]; ++# define DATASTART ((ptr_t)__data_start) ++# define LINUX_STACKBOTTOM ++# define DYNAMIC_LOADING ++# endif ++# endif ++ + #if defined(__GLIBC__) && !defined(DONT_USE_LIBC_PRIVATES) + /* Use glibc's stack-end marker. */ + # define USE_LIBC_PRIVATES