summaryrefslogtreecommitdiff
path: root/0001-add-loongarch-architecture.patch
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2024-08-15 01:26:33 +0000
committerCoprDistGit <infra@openeuler.org>2024-08-15 01:26:33 +0000
commitcbba0d4bb05510b990d9a939c56e40929c446f21 (patch)
tree8ac53e9388951d449d48a4db8478ff792b65d224 /0001-add-loongarch-architecture.patch
parentddbc897550b59f5f1d2c6137a9e64eb329c844d8 (diff)
automatic import of gc
Diffstat (limited to '0001-add-loongarch-architecture.patch')
-rw-r--r--0001-add-loongarch-architecture.patch96
1 files changed, 96 insertions, 0 deletions
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
+