summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--0001-add-loongarch-architecture.patch96
-rwxr-xr-xgc-8.0.6-sw.patch207
-rw-r--r--gc.spec134
-rw-r--r--sources1
5 files changed, 439 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..552b24e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/gc-8.2.6.tar.gz
diff --git a/0001-add-loongarch-architecture.patch b/0001-add-loongarch-architecture.patch
new file mode 100644
index 0000000..efaa7e0
--- /dev/null
+++ b/0001-add-loongarch-architecture.patch
@@ -0,0 +1,96 @@
+From 6ade473e440b2da11e6ecf6a69c4f1b309ab7624 Mon Sep 17 00:00:00 2001
+From: wang--ge <wang__ge@126.com>
+Date: Tue, 12 Apr 2022 19:47:14 +0800
+Subject: [PATCH] add loongarch architecture
+
+---
+ configure.ac | 2 +-
+ include/private/gcconfig.h | 31 +++++++++++++++++++++++++++++++
+ os_dep.c | 2 +-
+ 3 files changed, 33 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 2bc1282..7cc02a9 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -208,7 +208,7 @@ case "$THREADS" in
+ *-*-aix* | *-*-android* | *-*-cygwin* | *-*-darwin* | *-*-dragonfly* | \
+ *-*-freebsd* | *-*-haiku* | *-*-hpux11* | *-*-irix* | \
+ *-*-kfreebsd*-gnu | *-*-gnu* | *-*-*linux* | *-*-msys* | *-*-nacl* | \
+- *-*-netbsd* | *-*-openbsd* | *-*-osf* | *-*-solaris*)
++ *-*-netbsd* | *-*-openbsd* | *-*-osf* | *-*-solaris* | loongarch*)
+ AC_DEFINE(GC_THREADS)
+ AC_DEFINE([_REENTRANT], [1],
+ [Required define if using POSIX threads.])
+diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h
+index b4457c1..5826ad5 100644
+--- a/include/private/gcconfig.h
++++ b/include/private/gcconfig.h
+@@ -226,6 +226,14 @@ EXTERN_C_BEGIN
+ # define VAX
+ # define mach_type_known
+ # endif
++# if defined(__loongarch64)
++# define LOONGARCH64
++# define mach_type_known
++# endif
++# if defined(__loongarch64)
++# define LOONGARCH64
++# define mach_type_known
++# endif
+ # if (defined(mips) || defined(__mips) || defined(_mips)) && !defined(__TANDEM)
+ # define MIPS
+ # if defined(nec_ews) || defined(_nec_ews)
+@@ -518,6 +526,10 @@ EXTERN_C_BEGIN
+ # define AARCH64
+ # define mach_type_known
+ # endif
++# if defined(FREEBSD) && (defined(__loongarch64) )
++# define LOONGARCH64
++# define mach_type_known
++# endif
+ # if defined(FREEBSD) && (defined(mips) || defined(__mips) || defined(_mips))
+ # define MIPS
+ # define mach_type_known
+@@ -1702,6 +1714,25 @@ EXTERN_C_BEGIN
+ # define STACKBOTTOM ((ptr_t)0xfffff000) /* for Encore */
+ # endif
+
++# ifdef LOONGARCH64
++# define MACH_TYPE "LOONGARCH64"
++# ifdef LINUX
++# define OS_TYPE "LINUX"
++# define DYNAMIC_LOADING
++ extern int _end[];
++# pragma weak __data_start
++ extern int __data_start[];
++# define DATASTART ((ptr_t)(__data_start))
++# define DATAEND ((ptr_t)(_end))
++# define CPP_WORDSZ 64
++# define ALIGNMENT (64/8)
++# ifndef HBLKSIZE
++# define HBLKSIZE 4096
++# endif
++# define LINUX_STACKBOTTOM
++# endif
++# endif
++
+ # ifdef LOONGARCH
+ # define MACH_TYPE "LoongArch"
+ # ifdef LINUX
+diff --git a/os_dep.c b/os_dep.c
+index e116ad0..947ac7f 100644
+--- a/os_dep.c
++++ b/os_dep.c
+@@ -3239,7 +3239,7 @@ GC_API GC_push_other_roots_proc GC_CALL GC_get_push_other_roots(void)
+ # ifndef SEGV_ACCERR
+ # define SEGV_ACCERR 2
+ # endif
+-# if defined(AARCH64) || defined(ARM32) || defined(MIPS) \
++# if defined(AARCH64) || defined(ARM32) || defined(MIPS) || defined(LOONGARCH64) \
+ || __FreeBSD__ >= 7
+ # define CODE_OK (si -> si_code == SEGV_ACCERR)
+ # elif defined(POWERPC)
+--
+2.27.0
+
diff --git a/gc-8.0.6-sw.patch b/gc-8.0.6-sw.patch
new file mode 100755
index 0000000..35883ef
--- /dev/null
+++ b/gc-8.0.6-sw.patch
@@ -0,0 +1,207 @@
+diff -Naur gc-8.0.6.org/config.guess gc-8.0.6.sw/config.guess
+--- gc-8.0.6.org/config.guess 2022-02-14 09:01:19.450000000 +0000
++++ gc-8.0.6.sw/config.guess 2022-02-15 02:27:24.780000000 +0000
+@@ -973,6 +973,14 @@ EOF
+ UNAME_MACHINE=aarch64_be
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
++ sw_64:Linux:*:*)
++ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
++ sw) UNAME_MACHINE=sw_64 ;;
++ esac
++ objdump --private-headers /bin/sh | grep -q ld.so.1
++ if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
++ GUESS=${UNAME_MACHINE}-sunway-linux-${LIBC}
++ ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+diff -Naur gc-8.0.6.org/config.sub gc-8.0.6.sw/config.sub
+--- gc-8.0.6.org/config.sub 2022-02-14 09:01:19.450000000 +0000
++++ gc-8.0.6.sw/config.sub 2022-02-15 02:25:05.350000000 +0000
+@@ -1175,6 +1175,7 @@ case $cpu-$vendor in
+ case $cpu in
+ 1750a | 580 \
+ | a29k \
++ | sw_64 \
+ | aarch64 | aarch64_be \
+ | abacus \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
+diff -Naur gc-8.0.6.org/extra/msvc_dbg.c gc-8.0.6.sw/extra/msvc_dbg.c
+--- gc-8.0.6.org/extra/msvc_dbg.c 2022-02-14 09:01:19.470000000 +0000
++++ gc-8.0.6.sw/extra/msvc_dbg.c 2022-02-15 02:32:56.220000000 +0000
+@@ -156,6 +156,9 @@ size_t GetStackFramesFromContext(HANDLE hProcess, HANDLE hThread,
+ #elif defined(_M_MRX000)
+ machineType = IMAGE_FILE_MACHINE_R4000;
+ stackFrame.AddrPC.Offset = context->Fir;
++#elif defined(_M_SW_64)
++ machineType = IMAGE_FILE_MACHINE_SW_64;
++ stackFrame.AddrPC.Offset = (unsigned long)context->Fir;
+ #elif defined(_M_ALPHA)
+ machineType = IMAGE_FILE_MACHINE_ALPHA;
+ stackFrame.AddrPC.Offset = (unsigned long)context->Fir;
+@@ -165,6 +168,9 @@ size_t GetStackFramesFromContext(HANDLE hProcess, HANDLE hThread,
+ #elif defined(_M_IA64)
+ machineType = IMAGE_FILE_MACHINE_IA64;
+ stackFrame.AddrPC.Offset = context->StIIP;
++#elif defined(_M_SW_6464)
++ machineType = IMAGE_FILE_MACHINE_SW_6464;
++ stackFrame.AddrPC.Offset = context->Fir;
+ #elif defined(_M_ALPHA64)
+ machineType = IMAGE_FILE_MACHINE_ALPHA64;
+ stackFrame.AddrPC.Offset = context->Fir;
+diff -Naur gc-8.0.6.org/include/gc_config_macros.h gc-8.0.6.sw/include/gc_config_macros.h
+--- gc-8.0.6.org/include/gc_config_macros.h 2022-02-14 09:01:19.450000000 +0000
++++ gc-8.0.6.sw/include/gc_config_macros.h 2022-02-15 02:37:26.990000000 +0000
+@@ -96,7 +96,7 @@
+ # define GC_FREEBSD_THREADS
+ # elif defined(__NetBSD__)
+ # define GC_NETBSD_THREADS
+-# elif defined(__alpha) || defined(__alpha__) /* && !Linux && !xBSD */
++# elif defined(__alpha) || defined(__alpha__) || defined(__sw_64) || defined(__sw_64__) /* && !Linux && !xBSD */
+ # define GC_OSF1_THREADS
+ # elif (defined(mips) || defined(__mips) || defined(_mips)) \
+ && !(defined(nec_ews) || defined(_nec_ews) \
+diff -Naur gc-8.0.6.org/include/gc_tiny_fl.h gc-8.0.6.sw/include/gc_tiny_fl.h
+--- gc-8.0.6.org/include/gc_tiny_fl.h 2022-02-14 09:01:19.440000000 +0000
++++ gc-8.0.6.sw/include/gc_tiny_fl.h 2022-02-15 02:38:20.270000000 +0000
+@@ -49,7 +49,7 @@
+ # if defined(__LP64__) || defined (_LP64) || defined(_WIN64) \
+ || defined(__s390x__) \
+ || (defined(__x86_64__) && !defined(__ILP32__)) \
+- || defined(__alpha__) || defined(__powerpc64__) \
++ || defined(__alpha__) || defined(__sw_64__) || defined(__powerpc64__) \
+ || defined(__arch64__)
+ # define GC_GRANULE_BYTES 16
+ # define GC_GRANULE_WORDS 2
+diff -Naur gc-8.0.6.org/include/private/gc_priv.h gc-8.0.6.sw/include/private/gc_priv.h
+--- gc-8.0.6.org/include/private/gc_priv.h 2022-02-14 09:01:19.440000000 +0000
++++ gc-8.0.6.sw/include/private/gc_priv.h 2022-02-15 02:40:15.270000000 +0000
+@@ -925,7 +925,7 @@ EXTERN_C_BEGIN
+ /* SMALL_CONFIG: Want less block-level fragmentation. */
+ #ifndef HBLKSIZE
+ # if defined(LARGE_CONFIG) || !defined(SMALL_CONFIG)
+-# ifdef ALPHA
++# if defined ALPHA || defined SW_64
+ # define CPP_LOG_HBLKSIZE 13
+ # elif defined(SN_TARGET_PSP2)
+ # define CPP_LOG_HBLKSIZE 16 /* page size is set to 64 KB */
+diff -Naur gc-8.0.6.org/include/private/gcconfig.h gc-8.0.6.sw/include/private/gcconfig.h
+--- gc-8.0.6.org/include/private/gcconfig.h 2022-02-14 09:01:19.440000000 +0000
++++ gc-8.0.6.sw/include/private/gcconfig.h 2022-02-15 02:45:28.230000000 +0000
+@@ -418,6 +418,14 @@ EXTERN_C_BEGIN
+ # define M32R
+ # define mach_type_known
+ # endif
++# if defined(__sw_64) || defined(__sw_64__)
++# define SW_64
++# if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD) \
++ && !defined(FREEBSD)
++# define OSF1 /* a.k.a Digital Unix */
++# endif
++# define mach_type_known
++# endif
+ # if defined(__alpha) || defined(__alpha__)
+ # define ALPHA
+ # if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD) \
+@@ -1924,6 +1932,100 @@ EXTERN_C_BEGIN
+ # endif
+ # endif /* HP_PA */
+
++# ifdef SW_64
++# define MACH_TYPE "SW_64"
++# define ALIGNMENT 8
++# define CPP_WORDSZ 64
++# ifdef NETBSD
++# define OS_TYPE "NETBSD"
++# define HEURISTIC2
++ extern ptr_t GC_data_start;
++# define DATASTART GC_data_start
++# define ELFCLASS32 32
++# define ELFCLASS64 64
++# define ELF_CLASS ELFCLASS64
++# define DYNAMIC_LOADING
++# endif
++# ifdef OPENBSD
++# define OS_TYPE "OPENBSD"
++# define ELF_CLASS ELFCLASS64
++# ifndef GC_OPENBSD_THREADS
++# define HEURISTIC2
++# endif
++ extern int __data_start[];
++# define DATASTART ((ptr_t)__data_start)
++ extern int _end[];
++# define DATAEND ((ptr_t)(&_end))
++# define DYNAMIC_LOADING
++# endif
++# ifdef FREEBSD
++# define OS_TYPE "FREEBSD"
++/* MPROTECT_VDB is not yet supported at all on FreeBSD/sw_64. */
++# define SIG_SUSPEND SIGUSR1
++# define SIG_THR_RESTART SIGUSR2
++ /* SIGTSTP and SIGCONT could be used alternatively. */
++# define FREEBSD_STACKBOTTOM
++# ifdef __ELF__
++# define DYNAMIC_LOADING
++# endif
++/* Handle unmapped hole sw_64*-*-freebsd[45]* puts between etext and edata. */
++ extern char etext[];
++ extern char edata[];
++# if !defined(CPPCHECK)
++ extern char end[];
++# endif
++# define NEED_FIND_LIMIT
++# define DATASTART ((ptr_t)(&etext))
++ void * GC_find_limit(void *, int);
++# define DATAEND (ptr_t)GC_find_limit(DATASTART, TRUE)
++# define DATAEND_IS_FUNC
++# define GC_HAVE_DATAREGION2
++# define DATASTART2 ((ptr_t)(&edata))
++# define DATAEND2 ((ptr_t)(&end))
++# endif
++# ifdef OSF1
++# define OS_TYPE "OSF1"
++# define DATASTART ((ptr_t)0x140000000)
++ extern int _end[];
++# define DATAEND ((ptr_t)(&_end))
++ extern char ** environ;
++ /* round up from the value of environ to the nearest page boundary */
++ /* Probably breaks if putenv is called before collector */
++ /* initialization. */
++# define STACKBOTTOM ((ptr_t)(((word)(environ) | (getpagesize()-1))+1))
++/* # define HEURISTIC2 */
++ /* Normally HEURISTIC2 is too conservative, since */
++ /* the text segment immediately follows the stack. */
++ /* Hence we give an upper pound. */
++ /* This is currently unused, since we disabled HEURISTIC2 */
++ extern int __start[];
++# define HEURISTIC2_LIMIT ((ptr_t)((word)(__start) & ~(getpagesize()-1)))
++# ifndef GC_OSF1_THREADS
++ /* Unresolved signal issues with threads. */
++# define MPROTECT_VDB
++# endif
++# define DYNAMIC_LOADING
++# endif
++# ifdef LINUX
++# define OS_TYPE "LINUX"
++# define LINUX_STACKBOTTOM
++# define COUNT_UNMAPPED_REGIONS
++# ifdef __ELF__
++# define SEARCH_FOR_DATA_START
++# define DYNAMIC_LOADING
++# else
++# define DATASTART ((ptr_t)0x140000000)
++# endif
++ extern int _end[];
++# define DATAEND ((ptr_t)(_end))
++# if !defined(REDIRECT_MALLOC)
++# define MPROTECT_VDB
++ /* Has only been superficially tested. May not */
++ /* work on all versions. */
++# endif
++# endif
++# endif
++
+ # ifdef ALPHA
+ # define MACH_TYPE "ALPHA"
+ # define ALIGNMENT 8
diff --git a/gc.spec b/gc.spec
new file mode 100644
index 0000000..99a7176
--- /dev/null
+++ b/gc.spec
@@ -0,0 +1,134 @@
+Name: gc
+Version: 8.2.6
+Release: 2
+Summary: A garbage collector for C and C++
+License: BSD-3-Clause
+Url: http://www.hboehm.info/gc/
+Source0: https://github.com/ivmai/bdwgc/releases/download/v%{version}/gc-%{version}.tar.gz
+Patch1: gc-8.0.6-sw.patch
+Patch2: 0001-add-loongarch-architecture.patch
+
+BuildRequires: gcc-c++
+BuildRequires: pkgconfig(atomic_ops)
+
+%description
+The Boehm-Demers-Weiser conservative garbage collector can be
+used as a garbage collecting replacement for C malloc or C++ new.
+
+%package devel
+Summary: Libraries and header files for %{name} development
+Requires: %{name}%{?_isa} = %{version}-%{release}
+%description devel
+%{summary}.
+
+%prep
+%autosetup -n %{name}-%{version} -p1
+
+
+%build
+# refresh auto*/libtool to purge rpaths
+rm -f libtool libtool.m4
+autoreconf -i -f
+
+# See https://bugzilla.redhat.com/show_bug.cgi?id=689877
+CPPFLAGS="-DUSE_GET_STACKBASE_FOR_MAIN"; export CPPFLAGS
+
+%configure \
+ --disable-static \
+ --disable-docs \
+ --enable-cplusplus \
+ --enable-large-config \
+ --enable-threads=posix
+
+%{make_build}
+
+
+%install
+%{make_install}
+%delete_la
+install -p -D -m644 doc/gc.man %{buildroot}%{_mandir}/man3/gc.3
+
+## Delete unpackaged files
+rm -rfv %{buildroot}%{_datadir}/gc/
+
+
+%check
+%make_build check
+
+%files
+%doc AUTHORS ChangeLog README.md
+%{_libdir}/libcord.so.1*
+%{_libdir}/libgc.so.1*
+%{_libdir}/libgccpp.so.1*
+%{_libdir}/libgctba.so.1*
+
+%files devel
+%doc doc/README.environment doc/README.linux
+%{_includedir}/gc.h
+%{_includedir}/gc_cpp.h
+%{_includedir}/gc
+%{_libdir}/libcord.so
+%{_libdir}/libgc.so
+%{_libdir}/libgccpp.so
+%{_libdir}/libgctba.so
+%{_libdir}/pkgconfig/bdw-gc.pc
+%{_mandir}/man3/gc.3*
+
+%changelog
+* Thu Aug 15 2024 Funda Wang <fundawang@yeah.net> - 8.2.6-2
+- move libgctba.so into devel package
+- build against system atomic_ops
+
+* Wed Jul 24 2024 dillon chen <dillon.chen@gmail.com> - 8.2.6-1
+- Updade to 8.2.6
+
+* Sun Oct 8 2023 huyubiao <huyubiao@huawei.com> - 8.2.4-1
+- Update gc to 8.2.4
+
+* Thu Feb 2 2023 huyubiao <huyubiao@huawei.com> - 8.2.2-1
+- Update gc to 8.2.2
+
+* Mon Nov 21 2022 doupengda <doupengda@loongson.cn> - 8.0.6-4
+- add loongarch64 support
+
+* Mon Nov 14 2022 wuzx<wuzx1226@qq.com> - 8.0.6-3
+- Type:feature
+- CVE:NA
+- SUG:NA
+- DESC:Add sw64 architecture
+
+* Tue Oct 18 2022 Liu Zixian <liuzixian4@huawei.com> - 8.0.6-2
+- Type:cleancode
+- ID:NA
+- SUG:NA
+- DESC:Remove unused BuildRequires
+
+* Thu Dec 2 2021 wangjie <wangjie375@huawei.com> - 8.0.6-1
+- Type:enhancement
+- ID:NA
+- SUG:NA
+- DESC:Update gc to 8.0.6
+
+* Thu Jul 22 2021 wangchen<wangchen137@huawei.com> - 8.0.4-4
+- Deleta unnecessary gdb from BuildRequires
+
+* Fri Jun 4 2021 panxiaohe<panxiaohe@huawei.com> - 8.0.4-3
+- add gcc-c++ to BuildRequires to use c++ command
+
+* Sat Mar 14 2020 shenyangyang<shenyangyang4@huawei.com> - 8.0.4-2
+- Type:bugfix
+- ID:NA
+- SUG:NA
+- DESC:add build requires of gdb
+
+* Tue Nov 5 2019 shenyangyang<shenyangyang4@huawei.com> - 8.0.4-1
+- Type:bugfix
+- ID:NA
+- SUG:NA
+- DESC:update gc to 8.0.4 to solve build problem of guile
+
+* Wed Sep 25 2019 openEuler Buildteam <buildteam@openeuler.org> - 7.6.12-2
+- Modify license
+
+* Thu Aug 29 2019 openEuler Buildteam <buildteam@openeuler.org> - 7.6.12-1
+- Package init
diff --git a/sources b/sources
new file mode 100644
index 0000000..95f5128
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+fc5351214bc2e854070ee3319181a467 gc-8.2.6.tar.gz