From: Debian Qt/KDE Maintainers Date: Sun, 3 Mar 2024 09:03:16 +0000 (+0000) Subject: add support for LoongArch X-Git-Tag: archive/raspbian/5.15.13+dfsg-2+rpi1~1^2^2~14 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c740403536ca0b5d4f7690d775b27c61e6c2f8b4;p=qtbase-opensource-src.git add support for LoongArch Origin: upstream, commits https://code.qt.io/cgit/qt/qtbase.git/commit/?id=bdc16f086f1664b5 https://code.qt.io/cgit/qt/qtbase.git/commit/?id=0ab51dcc3c0cca0d Last-Update: 2023-11-05 Gbp-Pq: Name loongarch.diff --- diff --git a/src/3rdparty/forkfd/forkfd_linux.c b/src/3rdparty/forkfd/forkfd_linux.c index ffe0e9a5e..b1f5408d1 100644 --- a/src/3rdparty/forkfd/forkfd_linux.c +++ b/src/3rdparty/forkfd/forkfd_linux.c @@ -82,7 +82,8 @@ static int sys_clone(unsigned long cloneflags, int *ptid) return syscall(__NR_clone, cloneflags, child_stack, stack_size, ptid, newtls, ctid); #elif defined(__arc__) || defined(__arm__) || defined(__aarch64__) || defined(__mips__) || \ defined(__nds32__) || defined(__hppa__) || defined(__powerpc__) || defined(__i386__) || \ - defined(__x86_64__) || defined(__xtensa__) || defined(__alpha__) || defined(__riscv) + defined(__x86_64__) || defined(__xtensa__) || defined(__alpha__) || defined(__riscv) || \ + defined(__loongarch__) /* ctid and newtls are inverted on CONFIG_CLONE_BACKWARDS architectures, * but since both values are 0, there's no harm. */ return syscall(__NR_clone, cloneflags, child_stack, ptid, ctid, newtls); diff --git a/src/corelib/global/archdetect.cpp b/src/corelib/global/archdetect.cpp index 1d00b7f5a..281e84df6 100644 --- a/src/corelib/global/archdetect.cpp +++ b/src/corelib/global/archdetect.cpp @@ -59,6 +59,10 @@ # define ARCH_PROCESSOR "x86_64" #elif defined(Q_PROCESSOR_IA64) # define ARCH_PROCESSOR "ia64" +#elif defined(Q_PROCESSOR_LOONGARCH_32) +# define ARCH_PROCESSOR "loongarch32" +#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/qglobal.cpp b/src/corelib/global/qglobal.cpp index ac2e85c51..d337c34c6 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1815,6 +1815,37 @@ bool qSharedBuild() noexcept \sa QSysInfo::buildCpuArchitecture() */ +/*! + \macro Q_PROCESSOR_LOONGARCH + \relates + + Defined if the application is compiled for LoongArch processors. + + \sa QSysInfo::buildCpuArchitecture() +*/ + +/*! + \macro Q_PROCESSOR_LOONGARCH_32 + \relates + + Defined if the application is compiled for 32-bit LoongArch processors. + The \l Q_PROCESSOR_LOONGARCH macro is also defined when + Q_PROCESSOR_LOONGARCH_32 is defined. + + \sa QSysInfo::buildCpuArchitecture() +*/ + +/*! + \macro Q_PROCESSOR_LOONGARCH_64 + \relates + + Defined if the application is compiled for 64-bit LoongArch processors. + The \l Q_PROCESSOR_LOONGARCH macro is also defined when + Q_PROCESSOR_LOONGARCH_64 is defined. + + \sa QSysInfo::buildCpuArchitecture() +*/ + /*! \macro Q_PROCESSOR_MIPS \relates diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h index 8d6572085..7b32b919f 100644 --- a/src/corelib/global/qprocessordetection.h +++ b/src/corelib/global/qprocessordetection.h @@ -223,6 +223,20 @@ # define Q_PROCESSOR_WORDSIZE 8 // Q_BYTE_ORDER not defined, use endianness auto-detection +/* + LoongArch family, known variants: 32- and 64-bit + + LoongArch is little-endian. +*/ +#elif defined(__loongarch__) +# define Q_PROCESSOR_LOONGARCH +# if __loongarch_grlen == 64 +# define Q_PROCESSOR_LOONGARCH_64 +# else +# define Q_PROCESSOR_LOONGARCH_32 +# endif +# define Q_BYTE_ORDER Q_LITTLE_ENDIAN + /* MIPS family, known revisions: I, II, III, IV, 32, 64