8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 16:43:03 +01:00

Add LoongArch support

This commit is contained in:
loongson 2023-03-31 15:13:48 +08:00 committed by Alexander Peshkov
parent 54b1c5a698
commit fcc471e420
9 changed files with 74 additions and 13 deletions

View File

@ -0,0 +1,28 @@
# 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)
# 14 Apr 2008 Alan Barclay alan AT escribe.co.uk
# 2018, "Manuel A. Fernandez Montecelo" <manuel.montezelo@gmail.com>
#LD=@CXX@
#PROD_FLAGS=-ggdb -O3 -fno-omit-frame-pointer -DLINUX -pipe -MMD -fPIC
#DEV_FLAGS=-ggdb -DLINUX -DDEBUG_GDS_ALLOC -pipe -MMD -p -fPIC -Werror=delete-incomplete -Wall -Wno-switch
PROD_FLAGS=-O3 -DLINUX -DLOONGARCH -pipe -p -MMD -fPIC -fsigned-char -fmessage-length=0 -std=gnu++03 -fno-delete-null-pointer-checks
DEV_FLAGS=-ggdb -DLINUX -DLOONGARCH -pipe -p -MMD -fPIC -Werror=delete-incomplete -Wall -fsigned-char -fmessage-length=0 -Wno-non-virtual-dtor

View File

@ -325,6 +325,18 @@ dnl CPU_TYPE=ppc64
libdir=/usr/lib64
;;
loongarch*-*-linux*)
MAKEFILE_PREFIX=linux_loongarch
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
;;
riscv64*-*-linux*)
MAKEFILE_PREFIX=linux_riscv64
INSTALL_PREFIX=linux

View File

@ -944,6 +944,9 @@ EOF
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
loongarch32:Linux:*:* | loongarch64:Linux:*:*)
echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;;
m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;

View File

@ -268,6 +268,7 @@ case $basic_machine in
| k1om \
| le32 | le64 \
| lm32 \
| loongarch32 | loongarch64 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \

View File

@ -127,6 +127,11 @@
# else
# define CDS_BUILD_BITS 32
# endif
#elif defined(__loongarch__)
# define CDS_PROCESSOR_ARCH CDS_PROCESSOR_LOONGARCH
# define CDS_PROCESSOR__NAME "LOONGARCH"
# define CDS_PROCESSOR__NICK "loongarch"
# define CDS_BUILD_BITS 64
#else
# if defined(CDS_USE_LIBCDS_ATOMIC)
# error "Libcds does not support atomic implementation for the processor architecture. Try to use C++11-compatible compiler and remove CDS_USE_LIBCDS_ATOMIC flag from compiler command line"

View File

@ -222,6 +222,7 @@ namespace cds {}
- CDS_PROCESSOR_PPC64 PowerPC64
- CDS_PROCESSOR_ARM7 ARM v7
- CDS_PROCESSOR_ARM8 ARM v8
- CDS_PROCESSOR_LOONGARCH LoongArch
- CDS_PROCESSOR_UNKNOWN undefined processor architecture
CDS_PROCESSOR__NAME The name (string) of processor architecture
@ -278,6 +279,7 @@ namespace cds {}
#define CDS_PROCESSOR_PPC64 5 // PowerPC 64bit
#define CDS_PROCESSOR_ARM7 7
#define CDS_PROCESSOR_ARM8 8
#define CDS_PROCESSOR_LOONGARCH 9
#define CDS_PROCESSOR_UNKNOWN -1
// Supported OS interfaces

View File

@ -51,6 +51,7 @@ static const UCHAR CpuPowerPc64el = 16;
static const UCHAR CpuM68k = 17;
static const UCHAR CpuRiscV64 = 18;
static const UCHAR CpuMips64el = 19;
static const UCHAR CpuLoongArch = 20;
static const UCHAR OsWindows = 0;
static const UCHAR OsLinux = 1;
@ -93,7 +94,8 @@ const char* hardware[] = {
"PowerPC64el",
"M68k",
"RiscV64",
"MIPS64EL"
"MIPS64EL",
"LOONGARCH"
};
const char* operatingSystem[] = {
@ -120,23 +122,23 @@ 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 PPC64el M68k RiscV64 MIPS64EL
/* Windows */ 50, 68, 0, 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, 87, 88, 90,
/* Darwin */ 70, 73, 0, 63, 77, 0, 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, 0,
/* HPUX */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 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, 0,
/* MVS */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* FreeBSD */ 61, 67, 0, 92, 91, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 0, 0, 0,
/* NetBSD */ 62, 0, 0, 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 PPC64el M68k RiscV64 MIPS64EL LoongArch
/* Windows */ 50, 68, 0, 0, 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, 87, 88, 90, 93,
/* Darwin */ 70, 73, 0, 63, 77, 0, 0, 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, 0, 0,
/* HPUX */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 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, 0, 0,
/* MVS */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* FreeBSD */ 61, 67, 0, 92, 91, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 0, 0, 0, 0,
/* NetBSD */ 62, 0, 0, 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 PPC64el M68k RiscV64 MIPS64EL
0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0,
// Intel AMD Sparc PPC PPC64 MIPSEL MIPS ARM IA64 s390 s390x SH SHEB HPPA Alpha ARM64 PPC64el M68k RiscV64 MIPS64EL LoongArch
0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0,
};
} // anonymous namespace

View File

@ -143,6 +143,10 @@
#define FB_CPU CpuRiscV64
#endif /* RISCV64 */
#ifdef LOONGARCH
#define FB_CPU CpuLoongArch
#endif /* LOONGARCH */
#ifdef sparc
#define FB_CPU CpuUltraSparc
#define RISC_ALIGNMENT

View File

@ -107,8 +107,12 @@
#endif
#ifdef LINUX
#if defined(__loongarch__)
#define FB_PLATFORM "LL" // Linux/LoongArch
#else
#define FB_PLATFORM "LI" // Linux on Intel
#endif
#endif
#ifdef FREEBSD
#define FB_PLATFORM "FB" // FreeBSD/i386