From b4fbf5eaeaea181fc0c784c0f73af4bbd9196f08 Mon Sep 17 00:00:00 2001 From: Jingyun Hua Date: Mon, 22 May 2023 12:55:52 +0000 Subject: [PATCH] add loongarch64 support Signed-off-by: Jingyun Hua --- ...-3.0.3.32900-add-loongarch64-support.patch | 150 ++++++++++++++++++ firebird.spec | 6 +- 2 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 0001-Firebird-3.0.3.32900-add-loongarch64-support.patch diff --git a/0001-Firebird-3.0.3.32900-add-loongarch64-support.patch b/0001-Firebird-3.0.3.32900-add-loongarch64-support.patch new file mode 100644 index 0000000..90f3f6d --- /dev/null +++ b/0001-Firebird-3.0.3.32900-add-loongarch64-support.patch @@ -0,0 +1,150 @@ +From df64ccb635fbf431cab1a2ff4aa160445cf16d0c Mon Sep 17 00:00:00 2001 +From: Jingyun Hua +Date: Fri, 19 May 2023 02:12:18 +0000 +Subject: [PATCH] Firebird-3.0.3.32900: add loongarch64 support + +--- + builds/posix/prefix.linux_loongarch64 | 20 ++++++++++++++++++ + configure.ac | 12 +++++++++++ + src/common/classes/DbImplementation.cpp | 28 +++++++++++++------------ + src/common/common.h | 4 ++++ + src/jrd/inf_pub.h | 1 + + 5 files changed, 52 insertions(+), 13 deletions(-) + create mode 100644 builds/posix/prefix.linux_loongarch64 + +diff --git a/builds/posix/prefix.linux_loongarch64 b/builds/posix/prefix.linux_loongarch64 +new file mode 100644 +index 0000000..a9463d2 +--- /dev/null ++++ b/builds/posix/prefix.linux_loongarch64 +@@ -0,0 +1,20 @@ ++# The contents of this file are subject to the Interbase Public ++# License Version 1.0 (the "License"); you may not use this file ++# except in compliance with the License. You may obtain a copy ++# of the License at http://www.Inprise.com/IPL.html ++# ++# Software distributed under the License is distributed on an ++# "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express ++# or implied. See the License for the specific language governing ++# rights and limitations under the License. ++# ++# The Original Code was created by Inprise Corporation ++# and its predecessors. Portions created by Inprise Corporation are ++# Copyright (C) Inprise Corporation. ++# ++# All Rights Reserved. ++# Contributor(s): ______________________________________. ++# Start of file prefix.linux: $(VERSION) $(PLATFORM) ++ ++PROD_FLAGS=-O3 -DLINUX -DLOONGARCH64 -pipe -p -MMD -fPIC -fsigned-char -fmessage-length=0 ++DEV_FLAGS=-ggdb -DLINUX -DLOONGARCH64 -pipe -p -MMD -fPIC -Werror=delete-incomplete -Wall -fsigned-char -fmessage-length=0 -Wno-non-virtual-dtor +diff --git a/configure.ac b/configure.ac +index b74a540..70712a2 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -263,6 +263,18 @@ dnl CPU_TYPE=ppc64 + 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 + INSTALL_PREFIX=linux +diff --git a/src/common/classes/DbImplementation.cpp b/src/common/classes/DbImplementation.cpp +index 3af0eaf..34f48a2 100644 +--- a/src/common/classes/DbImplementation.cpp ++++ b/src/common/classes/DbImplementation.cpp +@@ -50,6 +50,7 @@ static const UCHAR CpuArm64 = 15; + static const UCHAR CpuPowerPc64el = 16; + static const UCHAR CpuM68k = 17; + static const UCHAR CpuRiscV64 = 18; ++static const UCHAR CpuLoongArch64 = 19; + + static const UCHAR OsWindows = 0; + static const UCHAR OsLinux = 1; +@@ -91,7 +92,8 @@ const char* hardware[] = { + "ARM64", + "PowerPC64el", + "M68k", +- "RiscV64" ++ "RiscV64", ++ "LoongArch64" + }; + + const char* operatingSystem[] = { +@@ -118,22 +120,22 @@ 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 +-/* 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, +-/* Solaris */ 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +-/* HPUX */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0, +-/* AIX */ 0, 0, 0, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +-/* MVS */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +-/* FreeBSD */ 61, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +-/* NetBSD */ 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ++// Intel AMD Sparc PPC PPC64 MIPSEL MIPS ARM IA64 s390 s390x SH SHEB HPPA Alpha ARM64 PowerPC64el M68k RiscV64 LoongArch64 ++/* Windows */ 50, 68, 0, 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, 89, ++/* Darwin */ 70, 73, 0, 63, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ++/* Solaris */ 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ++/* HPUX */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, ++/* AIX */ 0, 0, 0, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ++/* MVS */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ++/* FreeBSD */ 61, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ++/* NetBSD */ 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }; + + 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 +- 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, ++// 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, 0, + }; + + } // anonymous namespace +diff --git a/src/common/common.h b/src/common/common.h +index 365b97e..d8c0e24 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 + #define RISC_ALIGNMENT +diff --git a/src/jrd/inf_pub.h b/src/jrd/inf_pub.h +index b45802b..5ca75ea 100644 +--- a/src/jrd/inf_pub.h ++++ b/src/jrd/inf_pub.h +@@ -246,6 +246,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, + + isc_info_db_impl_last_value // Leave this LAST! + }; +-- +2.33.0 + diff --git a/firebird.spec b/firebird.spec index e50ff13..3912b0b 100644 --- a/firebird.spec +++ b/firebird.spec @@ -1,6 +1,6 @@ Name: firebird Version: 3.0.3.32900 -Release: 9 +Release: 10 Summary: SQL relational database management system License: Interbase URL: http://www.firebirdsql.org/ @@ -19,6 +19,7 @@ Patch0005: cloop-honour-build-flags.patch Patch0006: a4cb621bf55ef2101e22b1e7da5c458a1e0cc2ab.patch Patch0007: 0001-Port-to-RISC-V-64-bit-riscv64.patch Patch0008: fix-failed-to-parse-pid-from-pid-file.patch +Patch0009: 0001-Firebird-3.0.3.32900-add-loongarch64-support.patch BuildRequires: autoconf automake libtommath-devel libtool ncurses-devel libicu-devel BuildRequires: libedit-devel gcc-c++ libstdc++-static systemd-units chrpath zlib-devel procmail @@ -204,6 +205,9 @@ systemd-tmpfiles --create %{_tmpfilesdir}/firebird.conf %exclude %{_docdir}/firebird/IPLicense.txt %changelog +* Mon May 22 2023 huajingyun - 3.0.3.32900-10 +- add loongarch64 support + * Mon Mar 7 2022 yaoxin - 3.0.3.32900-9 - Fix failed to parse pid from pid file -- Gitee