From 0ef31dd5d7be9cad8230ca77d6825cf8eb12e1e8 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 27 Feb 2018 09:31:18 +0000 Subject: [PATCH] Add upstream patches for RISC-V support. --- 0001-Add-initial-RISC-V-support.patch | 52 +++++++++++++++++ ...-32-64-bit-configurations-definition.patch | 56 +++++++++++++++++++ gc.spec | 11 +++- 3 files changed, 117 insertions(+), 2 deletions(-) create mode 100644 0001-Add-initial-RISC-V-support.patch create mode 100644 0001-Merge-RISCV-32-64-bit-configurations-definition.patch diff --git a/0001-Add-initial-RISC-V-support.patch b/0001-Add-initial-RISC-V-support.patch new file mode 100644 index 0000000..798bba4 --- /dev/null +++ b/0001-Add-initial-RISC-V-support.patch @@ -0,0 +1,52 @@ +diff -ur gc-7.6.4.old/include/private/gcconfig.h gc-7.6.4.new/include/private/gcconfig.h +--- gc-7.6.4.old/include/private/gcconfig.h 2018-01-26 13:16:17.000000000 +0000 ++++ gc-7.6.4.new/include/private/gcconfig.h 2018-02-27 09:33:05.840680540 +0000 +@@ -602,6 +602,15 @@ + # define I386 + # 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 + + /* Feel free to add more clauses here */ + +@@ -2650,6 +2659,32 @@ + # endif + # endif + ++# ifdef RISCV32 ++# define CPP_WORDSZ 32 ++# define MACH_TYPE "RISC-V32" ++# 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 /* RISCV32 */ ++ ++# ifdef RISCV64 ++# define CPP_WORDSZ 64 ++# define MACH_TYPE "RISC-V64" ++# 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 /* RISCV64 */ ++ + #if defined(__GLIBC__) && !defined(DONT_USE_LIBC_PRIVATES) + /* Use glibc's stack-end marker. */ + # define USE_LIBC_PRIVATES diff --git a/0001-Merge-RISCV-32-64-bit-configurations-definition.patch b/0001-Merge-RISCV-32-64-bit-configurations-definition.patch new file mode 100644 index 0000000..2236872 --- /dev/null +++ b/0001-Merge-RISCV-32-64-bit-configurations-definition.patch @@ -0,0 +1,56 @@ +diff -ur gc-7.6.4.old/include/private/gcconfig.h gc-7.6.4/include/private/gcconfig.h +--- gc-7.6.4.old/include/private/gcconfig.h 2018-02-27 09:35:01.074561443 +0000 ++++ gc-7.6.4/include/private/gcconfig.h 2018-02-27 09:35:38.571522689 +0000 +@@ -603,13 +603,8 @@ + # 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 ++# define RISCV ++# define mach_type_known + # endif + + /* Feel free to add more clauses here */ +@@ -2659,23 +2654,10 @@ + # endif + # endif + +-# ifdef RISCV32 +-# define CPP_WORDSZ 32 +-# define MACH_TYPE "RISC-V32" +-# 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 /* RISCV32 */ +- +-# ifdef RISCV64 +-# define CPP_WORDSZ 64 +-# define MACH_TYPE "RISC-V64" +-# define ALIGNMENT 8 ++# ifdef RISCV ++# define MACH_TYPE "RISC-V" ++# define CPP_WORDSZ __riscv_xlen /* 32 or 64 */ ++# define ALIGNMENT (CPP_WORDSZ/8) + # ifdef LINUX + # define OS_TYPE "LINUX" + extern int __data_start[]; +@@ -2683,7 +2665,7 @@ + # define LINUX_STACKBOTTOM + # define DYNAMIC_LOADING + # endif +-# endif /* RISCV64 */ ++# endif /* RISCV */ + + #if defined(__GLIBC__) && !defined(DONT_USE_LIBC_PRIVATES) + /* Use glibc's stack-end marker. */ diff --git a/gc.spec b/gc.spec index 689602f..f930750 100644 --- a/gc.spec +++ b/gc.spec @@ -2,7 +2,7 @@ Summary: A garbage collector for C and C++ Name: gc Version: 7.6.4 -Release: 1%{?dist} +Release: 2%{?dist} License: BSD Url: http://www.hboehm.info/gc/ @@ -11,6 +11,10 @@ Source0: http://www.hboehm.info/gc/gc_source/gc-%{version}%{?pre}.tar.gz ## upstreamable patches ## upstream patches +# Upstream commit 4f7f0eebd24dcde9f2b3ec2cb98913fc39bbdda3. +Patch1: 0001-Add-initial-RISC-V-support.patch +# Upstream commit 3b008f79ee29dbd0d61cf163d20eee21412df95b. +Patch2: 0001-Merge-RISCV-32-64-bit-configurations-definition.patch BuildRequires: automake libtool BuildRequires: gcc-c++ @@ -35,7 +39,7 @@ Provides: libgc-devel = %{version}-%{release} %prep -%autosetup -n gc-%{version}%{?pre} +%autosetup -n gc-%{version}%{?pre} -p1 # refresh auto*/libtool to purge rpaths rm -f libtool libtool.m4 @@ -102,6 +106,9 @@ make check %{?arch_ignore} %changelog +* Tue Feb 27 2018 Richard W.M. Jones - 7.6.4-2 +- Add upstream patches for RISC-V support. + * Tue Feb 20 2018 Rex Dieter - 7.6.4-1 - 7.6.4, reverts abi bump, compat-gc no longer needed