diff options
author | Janne Juntunen <janne.juntunen@qt.io> | 2021-11-03 13:04:07 +0200 |
---|---|---|
committer | Janne Juntunen <janne.juntunen@qt.io> | 2021-11-30 14:37:52 +0200 |
commit | 2bfa4b9960f283396427828deac6f194893cc811 (patch) | |
tree | 20b0a98726e000cb8ff8a82da246eb985a6e1c61 /src | |
parent | b9f7add531ceab2590e2b24dec7b495950f9870a (diff) |
QNX: check and use elf.h from alternative location
In QNX, instead of #include <elf.h>, we have to use #include <sys/elf.h>
since that file is placed in a subdirectory.
Also removed the previous workaround.
Fixes: QTBUG-97833
Change-Id: Id932a5eeb618a42c8778459cdfd8bb5bf903523c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/plugin/qelfparser_p.cpp | 14 | ||||
-rw-r--r-- | src/corelib/plugin/qelfparser_p.h | 4 | ||||
-rw-r--r-- | src/corelib/plugin/qlibrary.cpp | 2 | ||||
-rw-r--r-- | src/corelib/plugin/qmachparser_p.h | 2 |
4 files changed, 15 insertions, 7 deletions
diff --git a/src/corelib/plugin/qelfparser_p.cpp b/src/corelib/plugin/qelfparser_p.cpp index 6a83c94e20..ed973e4323 100644 --- a/src/corelib/plugin/qelfparser_p.cpp +++ b/src/corelib/plugin/qelfparser_p.cpp @@ -40,7 +40,7 @@ #include "qelfparser_p.h" -#if defined (Q_OF_ELF) && __has_include(<elf.h>) +#ifdef Q_OF_ELF #include "qlibrary_p.h" @@ -48,7 +48,13 @@ #include <qnumeric.h> #include <qsysinfo.h> -#include <elf.h> +#if __has_include(<elf.h>) +# include <elf.h> +#elif __has_include(<sys/elf.h>) +# include <sys/elf.h> +#else +# error "Need ELF header to parse plugins." +#endif QT_BEGIN_NAMESPACE @@ -408,7 +414,9 @@ Q_DECL_UNUSED Q_DECL_COLD_FUNCTION static QDebug &operator<<(QDebug &d, ElfHeade case EM_MIPS: d << ", MIPS"; break; case EM_PPC: d << ", PowerPC"; break; case EM_PPC64: d << ", PowerPC 64-bit"; break; +#ifdef EM_RISCV case EM_RISCV: d << ", RISC-V"; break; +#endif case EM_S390: d << ", S/390"; break; case EM_SH: d << ", SuperH"; break; case EM_SPARC: d << ", SPARC"; break; @@ -790,4 +798,4 @@ QLibraryScanResult QElfParser::parse(QByteArrayView data, QString *errMsg) QT_END_NAMESPACE -#endif // defined(Q_OF_ELF) && defined(Q_CC_GNU) +#endif // Q_OF_ELF diff --git a/src/corelib/plugin/qelfparser_p.h b/src/corelib/plugin/qelfparser_p.h index 42eb212ee1..5c8a0b700f 100644 --- a/src/corelib/plugin/qelfparser_p.h +++ b/src/corelib/plugin/qelfparser_p.h @@ -56,7 +56,7 @@ QT_REQUIRE_CONFIG(library); -#if defined(Q_OF_ELF) && __has_include(<elf.h>) +#ifdef Q_OF_ELF QT_BEGIN_NAMESPACE @@ -67,6 +67,6 @@ struct QElfParser QT_END_NAMESPACE -#endif // defined(Q_OF_ELF) && defined(Q_CC_GNU) +#endif // Q_OF_ELF #endif // QELFPARSER_P_H diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index d4ee833554..9f89abdf01 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -203,7 +203,7 @@ static QLibraryScanResult qt_find_pattern(const char *s, qsizetype s_len, QStrin More importantly, the pattern string may exist in the debug information due to it being used in the plugin in the first place. */ -#if defined (Q_OF_ELF) && __has_include(<elf.h>) +#if defined(Q_OF_ELF) return QElfParser::parse({s, s_len}, errMsg); #elif defined(Q_OF_MACH_O) return QMachOParser::parse(s, s_len, errMsg); diff --git a/src/corelib/plugin/qmachparser_p.h b/src/corelib/plugin/qmachparser_p.h index 9e0375c6cb..216f4c3bb9 100644 --- a/src/corelib/plugin/qmachparser_p.h +++ b/src/corelib/plugin/qmachparser_p.h @@ -70,6 +70,6 @@ public: QT_END_NAMESPACE -#endif // defined(Q_OF_ELF) && defined(Q_CC_GNU) +#endif // defined(Q_OF_MACH_O) #endif // QMACHPARSER_P_H |