From b269ad80a2f20bce31171dda255efd8288568d8b Mon Sep 17 00:00:00 2001 From: Alexey Sheplyakov Date: Tue, 30 May 2023 06:21:34 +0000 Subject: [PATCH] Support LoongArch architecture (lp64d ABI) --- alt-loongarch64-support.patch | 47 +++++++++++++++++++++++++++++++++++ qtbase.spec | 2 ++ 2 files changed, 49 insertions(+) create mode 100644 alt-loongarch64-support.patch diff --git a/alt-loongarch64-support.patch b/alt-loongarch64-support.patch new file mode 100644 index 0000000000..4668de6423 --- /dev/null +++ b/alt-loongarch64-support.patch @@ -0,0 +1,47 @@ +diff --git a/src/3rdparty/double-conversion/include/double-conversion/utils.h b/src/3rdparty/double-conversion/include/double-conversion/utils.h +index 70e697ca00..9be294a2d0 100644 +--- a/src/3rdparty/double-conversion/include/double-conversion/utils.h ++++ b/src/3rdparty/double-conversion/include/double-conversion/utils.h +@@ -102,6 +102,7 @@ int main(int argc, char** argv) { + defined(__AARCH64EL__) || defined(__aarch64__) || defined(__AARCH64EB__) || \ + defined(__riscv) || \ + defined(__or1k__) || defined(__arc__) || \ ++ defined(__loongarch64) || \ + defined(__EMSCRIPTEN__) + #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1 + #elif defined(__mc68000__) || \ +diff --git a/src/corelib/global/archdetect.cpp b/src/corelib/global/archdetect.cpp +index 1d00b7f5a5..74f3c8fc86 100644 +--- a/src/corelib/global/archdetect.cpp ++++ b/src/corelib/global/archdetect.cpp +@@ -59,6 +59,8 @@ + # define ARCH_PROCESSOR "x86_64" + #elif defined(Q_PROCESSOR_IA64) + # define ARCH_PROCESSOR "ia64" ++#elif defined(Q_PROCESSOR_LOONGARCH_64) ++# define ARCH_PROCESSOR "loongarch64" + #elif defined(Q_PROCESSOR_MIPS_64) + # define ARCH_PROCESSOR "mips64" + #elif defined(Q_PROCESSOR_MIPS) +diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h +index 8d65720850..3a4271e82f 100644 +--- a/src/corelib/global/qprocessordetection.h ++++ b/src/corelib/global/qprocessordetection.h +@@ -223,6 +223,17 @@ + # define Q_PROCESSOR_WORDSIZE 8 + // Q_BYTE_ORDER not defined, use endianness auto-detection + ++/* ++ LoongArch family, supported variant: lp64d ABI ++ ++ LoongArch is little-endian. ++*/ ++ ++#elif defined(__loongarch64) ++ #define Q_PROCESSOR_LOONGARCH ++ #define Q_PROCESSOR_LOONGARCH_64 ++ #define Q_BYTE_ORDER Q_LITTLE_ENDIAN ++ + /* + MIPS family, known revisions: I, II, III, IV, 32, 64 + diff --git a/qtbase.spec b/qtbase.spec index e5636cac3b..7de1a8fe1b 100644 --- a/qtbase.spec +++ b/qtbase.spec @@ -81,6 +81,7 @@ Patch1010: alt-zonetab.patch Patch1011: alt-kernel-requires.patch Patch1012: alt-fix-paths.patch Patch1013: alt-QTBUG-88599.patch +Patch1014: alt-loongarch64-support.patch # macros %define _qt5 %gname @@ -421,6 +422,7 @@ done %patch1011 -p1 %patch1012 -p1 %patch1013 -p1 +%patch1014 -p1 bin/syncqt.pl -version %version # install optflags -- 2.33.3