[PATCH] Add M68k detection
authorPino Toscano <toscano.pino@tiscali.it>
Thu, 6 Oct 2022 21:17:57 +0000 (23:17 +0200)
committerRaspbian forward porter <root@raspbian.org>
Wed, 7 Feb 2024 11:12:42 +0000 (11:12 +0000)
- detect the M68k architecture (Motorola 68000) and define
  Q_PROCESSOR_M68K
- set the right machine type in QElfParser for M68k ELF files

Change-Id: Ie5694abbe1ae2bfeb5692defba0ca6062c1d60ac
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Gbp-Pq: Name upstream_Add-M68k-detection.patch

src/corelib/global/archdetect.cpp
src/corelib/global/qglobal.cpp
src/corelib/global/qprocessordetection.h
src/corelib/plugin/qelfparser_p.cpp

index 0bb6853fea41c0cd7f4b77f5363929f3dc6dad8d..188ec2d1763de1aeb45d436d3dcd27193bd5e2bb 100644 (file)
@@ -25,6 +25,8 @@
 #  define ARCH_PROCESSOR "x86_64"
 #elif defined(Q_PROCESSOR_IA64)
 #  define ARCH_PROCESSOR "ia64"
+#elif defined(Q_PROCESSOR_M68K)
+#  define ARCH_PROCESSOR "m68k"
 #elif defined(Q_PROCESSOR_MIPS_64)
 #  define ARCH_PROCESSOR "mips64"
 #elif defined(Q_PROCESSOR_MIPS)
index 7f0e0104ac7a70c5a50a1da5e9ee4981ce2e3167..f17b049211b100cbd880dea5ce49ebb7b2cd026d 100644 (file)
@@ -1809,6 +1809,15 @@ bool qSharedBuild() noexcept
     \sa QSysInfo::buildCpuArchitecture()
 */
 
+/*!
+    \macro Q_PROCESSOR_M68K
+    \relates <QtGlobal>
+
+    Defined if the application is compiled for Motorola 68000 processors.
+
+    \sa QSysInfo::buildCpuArchitecture()
+*/
+
 /*!
     \macro Q_PROCESSOR_MIPS
     \relates <QtGlobal>
index 1ded4583aac9b1f2209edb43b5c42f251c71e059..0600c45358cc69ed63f2402015400151d3e23377 100644 (file)
 #  define Q_PROCESSOR_WORDSIZE   8
 // Q_BYTE_ORDER not defined, use endianness auto-detection
 
+/*
+    Motorola 68000 family, no revisions or variants
+
+    M68K is big-endian.
+*/
+#elif defined(__m68k__)
+#  define Q_PROCESSOR_M68K
+#  define Q_BYTE_ORDER Q_BIG_ENDIAN
+
 /*
     MIPS family, known revisions: I, II, III, IV, 32, 64
 
index 62fae0d7934269505e498e783722c31e697bc1ce..4388c6babeff60810d11e4770c20e2676dba3a68 100644 (file)
@@ -122,6 +122,8 @@ struct ElfMachineCheck
             EM_PARISC
 #elif defined(Q_PROCESSOR_IA64)
             EM_IA_64
+#elif defined(Q_PROCESSOR_M68K)
+            EM_68K
 #elif defined(Q_PROCESSOR_MIPS)
             EM_MIPS
 #elif defined(Q_PROCESSOR_POWER_32)
@@ -378,6 +380,7 @@ Q_DECL_UNUSED Q_DECL_COLD_FUNCTION static QDebug &operator<<(QDebug &d, ElfHeade
     switch (r.machine) {
     // list definitely not exhaustive!
     case EM_NONE:       d << ", no machine"; break;
+    case EM_68K:        d << ", MC68000"; break;
     case EM_ARM:        d << ", ARM"; break;
     case EM_AARCH64:    d << ", AArch64"; break;
 #ifdef EM_BLACKFIN