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>
This commit is contained in:
parent
b9f7add531
commit
2bfa4b9960
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -94,14 +94,12 @@
|
||||
# define PREFIX "lib"
|
||||
#endif
|
||||
|
||||
// Workaround for missing elf.h in QNX test environment
|
||||
// TODO: this can be removed after QTBUG-97833 has been solved
|
||||
#if defined(Q_OF_ELF) && defined(Q_OS_QNX) && !__has_include(<elf.h>)
|
||||
#undef Q_OF_ELF
|
||||
#if defined(Q_OF_ELF)
|
||||
#if __has_include(<elf.h>)
|
||||
# include <elf.h>
|
||||
#else
|
||||
# include <sys/elf.h>
|
||||
#endif
|
||||
|
||||
#if defined (Q_OF_ELF)
|
||||
# include <elf.h>
|
||||
# include <memory>
|
||||
# include <functional>
|
||||
|
||||
@ -183,7 +181,7 @@ static std::unique_ptr<QTemporaryFile> patchElf(const QString &source, ElfPatche
|
||||
if (QTest::currentTestFailed()) return; \
|
||||
std::move(r); \
|
||||
})
|
||||
#endif
|
||||
#endif // Q_OF_ELF
|
||||
|
||||
static QString sys_qualifiedLibraryName(const QString &fileName)
|
||||
{
|
||||
@ -395,7 +393,8 @@ void tst_QPluginLoader::deleteinstanceOnUnload()
|
||||
}
|
||||
}
|
||||
|
||||
#if defined (Q_OF_ELF)
|
||||
#if defined(Q_OF_ELF)
|
||||
|
||||
void tst_QPluginLoader::loadDebugObj()
|
||||
{
|
||||
#if !defined(QT_SHARED)
|
||||
|
Loading…
Reference in New Issue
Block a user