boehmgc: Add patch for RISC-V support.

This commit is contained in:
Shea Levy 2018-02-18 01:40:29 -05:00
parent a61fdebc25
commit f3f79bd6c6
No known key found for this signature in database
GPG key ID: 5C0BD6957D86FE27
2 changed files with 56 additions and 1 deletions

View file

@ -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" ]

View file

@ -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