From 60616fb36c4948bbc1db83bc289db92979289d79 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Thu, 6 Oct 2022 23:17:57 +0200 Subject: [PATCH] [PATCH] Add M68k detection - 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 Gbp-Pq: Name upstream_Add-M68k-detection.patch --- src/corelib/global/archdetect.cpp | 2 ++ src/corelib/global/qglobal.cpp | 9 +++++++++ src/corelib/global/qprocessordetection.h | 9 +++++++++ src/corelib/plugin/qelfparser_p.cpp | 3 +++ 4 files changed, 23 insertions(+) diff --git a/src/corelib/global/archdetect.cpp b/src/corelib/global/archdetect.cpp index 0bb6853f..188ec2d1 100644 --- a/src/corelib/global/archdetect.cpp +++ b/src/corelib/global/archdetect.cpp @@ -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) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 7f0e0104..f17b0492 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1809,6 +1809,15 @@ bool qSharedBuild() noexcept \sa QSysInfo::buildCpuArchitecture() */ +/*! + \macro Q_PROCESSOR_M68K + \relates + + Defined if the application is compiled for Motorola 68000 processors. + + \sa QSysInfo::buildCpuArchitecture() +*/ + /*! \macro Q_PROCESSOR_MIPS \relates diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h index 1ded4583..0600c453 100644 --- a/src/corelib/global/qprocessordetection.h +++ b/src/corelib/global/qprocessordetection.h @@ -196,6 +196,15 @@ # 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 diff --git a/src/corelib/plugin/qelfparser_p.cpp b/src/corelib/plugin/qelfparser_p.cpp index 62fae0d7..4388c6ba 100644 --- a/src/corelib/plugin/qelfparser_p.cpp +++ b/src/corelib/plugin/qelfparser_p.cpp @@ -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 -- 2.30.2