fix build error for loongarch64

This commit is contained in:
Wenlong Zhang 2023-05-20 10:28:05 +08:00
parent c821ffb24f
commit c8dd911467
2 changed files with 117 additions and 1 deletions

View File

@ -0,0 +1,112 @@
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
---
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
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
--- 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,
};
diff --git a/src/common/common.h b/src/common/common.h
index cf9fbe4..f7ead78 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 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,
isc_info_db_impl_last_value // Leave this LAST!
};
--
2.33.0

View File

@ -3,7 +3,7 @@
Name: firebird
Version: %{ver}.%{rev}
Release: 2
Release: 3
Summary: SQL relational database management system
License: Interbase
URL: http://www.firebirdsql.org/
@ -20,6 +20,7 @@ Patch0003: honour-buildflags.patch
Patch0004: no-copy-from-icu.patch
Patch0005: cloop-honour-build-flags.patch
Patch0007: 0001-Port-to-RISC-V-64-bit-riscv64.patch
Patch0008: 0001-add-loongarch64-support-for-Firebird.patch
BuildRequires: autoconf automake libtommath-devel libtool ncurses-devel libicu-devel
BuildRequires: libedit-devel gcc-c++ libstdc++-static systemd-units chrpath zlib-devel procmail
@ -205,6 +206,9 @@ systemd-tmpfiles --create %{_tmpfilesdir}/firebird.conf
%exclude %{_docdir}/firebird/IPLicense.txt
%changelog
* Mon May 8 2023 Wenlong Zhang <zhangwenlong@loongson.cn> - 3.0.10.33601-3
- add loongarch64 support
* Thu Mar 2 2023 dillon chen <dillon.chen@gmail.com> - 3.0.10.33601-2
- add -fPIE in honour-buildflags.patch