add loongarch64 support for firebird

This commit is contained in:
Wenlong Zhang 2024-05-20 03:45:23 +00:00
parent 7a3e93b4bc
commit 427df88aec
2 changed files with 41 additions and 102 deletions

View File

@ -1,112 +1,48 @@
From 10745ac134b19ee035fc4b9836325b9b743d1890 Mon Sep 17 00:00:00 2001
From: Wenlong Zhang <zhangwenlong@loongson.cn>
Date: Sat, 20 May 2023 02:26:48 +0000
Subject: [PATCH] add loongarch64 support for Firebird
From 548dff9c24a92c8da822b593e6302ff7044bc1d5 Mon Sep 17 00:00:00 2001
From: yangxianzhao <yangxianzhao@uniontech.com>
Date: Thu, 18 Jan 2024 16:09:43 +0800
Subject: [PATCH] add loongarch support
---
builds/posix/prefix.linux_loongarch64 | 7 +++++++
configure.ac | 12 ++++++++++++
src/common/classes/DbImplementation.cpp | 7 ++++---
src/common/common.h | 4 ++++
src/jrd/inf_pub.h | 1 +
5 files changed, 28 insertions(+), 3 deletions(-)
create mode 100644 builds/posix/prefix.linux_loongarch64
src/common/classes/DbImplementation.cpp | 1 +
src/common/common.h | 6 +++++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/builds/posix/prefix.linux_loongarch64 b/builds/posix/prefix.linux_loongarch64
new file mode 100644
index 0000000..70532a6
--- /dev/null
+++ b/builds/posix/prefix.linux_loongarch64
@@ -0,0 +1,7 @@
+WARN_FLAGS=-Wall -Wno-switch -Wno-parentheses -Wno-unknown-pragmas -Wno-unused-variable -Wno-invalid-offsetof -Wno-narrowing -Wno-unused-local-typedefs
+
+PROD_FLAGS=-O3 -DLINUX -DRISCV64 -pipe -p -MMD -fPIC -fsigned-char -fmessage-length=0
+DEV_FLAGS=-ggdb -DLINUX -DRISCV64 -pipe -p -MMD -fPIC -Wall -fsigned-char -fmessage-length=0 $(WARN_FLAGS)
+
+CXXFLAGS := $(CXXFLAGS) -std=c++11
+
diff --git a/configure.ac b/configure.ac
index cdc9c3e..c6186fd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -262,6 +262,18 @@ dnl CPU_TYPE=ppc64
STD_ICU=true
libdir=/usr/lib64
;;
+
+ loongarch64*-*-linux*)
+ MAKEFILE_PREFIX=linux_loongarch64
+ INSTALL_PREFIX=linux
+ PLATFORM=LINUX
+ AC_DEFINE(LINUX, 1, [Define this if OS is Linux])
+ EDITLINE_FLG=Y
+ SHRLIB_EXT=so
+ STD_EDITLINE=true
+ STD_ICU=true
+ libdir=/usr/lib64
+ ;;
powerpc64le-*-linux*)
MAKEFILE_PREFIX=linux_powerpc64el
diff --git a/src/common/classes/DbImplementation.cpp b/src/common/classes/DbImplementation.cpp
index 7376b9b..fb68145 100644
index 95b1e33..4f2def6 100644
--- a/src/common/classes/DbImplementation.cpp
+++ b/src/common/classes/DbImplementation.cpp
@@ -91,7 +91,8 @@ const char* hardware[] = {
"ARM64",
"PowerPC64el",
"M68k",
- "RiscV64"
+ "RiscV64",
+ "LoongArch64"
};
const char* operatingSystem[] = {
@@ -118,7 +119,7 @@ const char* compiler[] = {
// This table lists pre-fb3 implementation codes
const UCHAR backwardTable[FB_NELEM(hardware) * FB_NELEM(operatingSystem)] =
{
-// Intel AMD Sparc PPC PPC64 MIPSEL MIPS ARM IA64 s390 s390x SH SHEB HPPA Alpha ARM64 PowerPC64el RiscV64
+// Intel AMD Sparc PPC PPC64 MIPSEL MIPS ARM IA64 s390 s390x SH SHEB HPPA Alpha ARM64 PowerPC64el RiscV64 LoongArch64
/* Windows */ 50, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* Linux */ 60, 66, 65, 69, 86, 71, 72, 75, 76, 79, 78, 80, 81, 82, 83, 84, 85, 88,
/* Darwin */ 70, 73, 0, 63, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -132,7 +133,7 @@ const UCHAR backwardTable[FB_NELEM(hardware) * FB_NELEM(operatingSystem)] =
const UCHAR backEndianess[FB_NELEM(hardware)] =
{
-// Intel AMD Sparc PPC PPC64 MIPSEL MIPS ARM IA64 s390 s390x SH SHEB HPPA Alpha ARM64 PowerPC64el M68k RiscV64
+// Intel AMD Sparc PPC PPC64 MIPSEL MIPS ARM IA64 s390 s390x SH SHEB HPPA Alpha ARM64 PowerPC64el M68k RiscV64 LoongArch64
0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0,
};
@@ -39,6 +39,7 @@ static const UCHAR CpuPowerPc64 = 4;
static const UCHAR CpuMipsel = 5;
static const UCHAR CpuMips = 6;
static const UCHAR CpuArm = 7;
+static const UCHAR CpuLoongarch64 = 19;
static const UCHAR CpuIa64 = 8;
static const UCHAR CpuS390 = 9;
static const UCHAR CpuS390x = 10;
diff --git a/src/common/common.h b/src/common/common.h
index cf9fbe4..f7ead78 100644
index 9fbe954..1a0ef22 100644
--- a/src/common/common.h
+++ b/src/common/common.h
@@ -139,6 +139,10 @@
#define FB_CPU CpuRiscV64
#endif /* RISCV64 */
+#ifdef LOONGARCH64
+#define FB_CPU CpuLoongArch64
+#endif /* LOONGARCH64 */
+
#ifdef sparc
#define FB_CPU CpuUltraSparc
@@ -148,6 +148,10 @@
#define RISC_ALIGNMENT
diff --git a/src/jrd/inf_pub.h b/src/jrd/inf_pub.h
index 04a4061..7aa8693 100644
--- a/src/jrd/inf_pub.h
+++ b/src/jrd/inf_pub.h
@@ -248,6 +248,7 @@ enum info_db_implementations
isc_info_db_impl_linux_ppc64 = 86,
isc_info_db_impl_linux_m68k = 87,
isc_info_db_impl_linux_riscv64 = 88,
+ isc_info_db_impl_linux_loongarch64 = 89,
#endif /* sparc */
isc_info_db_impl_last_value // Leave this LAST!
};
+#ifdef _LOONGARCH_ARCH
+#define FB_CPU CpuLoongarch64
+#endif /* loongarch64 */
+
#ifdef MIPSEL
#define FB_CPU CpuMipsel
#endif /* mipsel */
@@ -918,7 +922,7 @@ void GDS_breakpoint(int);
// ASF: Currently, all little-endian are FB_SWAP_DOUBLE and big-endian aren't.
// AP: Define it for your hardware correctly in case your CPU do not follow mentioned rule.
// The follwoing lines are kept for reference only.
-//#if defined(i386) || defined(I386) || defined(_M_IX86) || defined(AMD64) || defined(ARM) || defined(MIPSEL) || defined(DARWIN64) || defined(IA64)
+//#if defined(i386) || defined(I386) || defined(_M_IX86) || defined(AMD64) || defined(ARM) || defined(_LOONGARCH_ARCH) || defined(MIPSEL) || defined(DARWIN64) || defined(IA64)
//#define FB_SWAP_DOUBLE 1
//#elif defined(sparc) || defined(PowerPC) || defined(PPC) || defined(__ppc__) || defined(HPUX) || defined(MIPS) || defined(__ppc64__)
//#define FB_SWAP_DOUBLE 0
--
2.33.0
2.31.1

View File

@ -3,7 +3,7 @@
Name: firebird
Version: %{ver}.%{rev}
Release: 1
Release: 2
Summary: SQL relational database management system
License: Interbase
@ -24,7 +24,7 @@ Patch0005: autoconf.patch
Patch0006: btyacc-honour-build-flags.patch
Patch0007: firebird-configure-c99.patch
#Patch0008: 0001-Port-to-RISC-V-64-bit-riscv64.patch
#Patch0009: 0001-add-loongarch64-support-for-Firebird.patch
Patch0009: 0001-add-loongarch64-support-for-Firebird.patch
#Patch0010: 0002-Modify-PROD_FLAGS-and-DEV_FLAGS-parameters-for-loongarch64.patch
BuildRequires: autoconf
@ -331,6 +331,9 @@ fi
%{_bindir}/gsplit
%changelog
* Mon May 20 2024 Wenlong Zhang <zhangwenlong@loongson.cn> - 4.0.4.3010-2
- add loongarch64 support for firebird
* Fri Apr 19 2024 xiejing <xiejing@kylinos.cn> - 4.0.4.3010-1
- Update to 4.0.4.3010