summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qlibraryinfo.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2021-10-12 14:25:14 -0700
committerThiago Macieira <thiago.macieira@intel.com>2021-10-21 00:55:48 -0700
commitaa82d295c8954a5d04fd446abc7452f007594422 (patch)
tree00fe338fb0225ac1c5c11b0b0569282ddb821009 /src/corelib/global/qlibraryinfo.cpp
parent7362b321e5cf2053234bb711340cc1603e1ce812 (diff)
Move the ABI tag from minimum-linux.S to qlibraryinfo.cpp
We don't need the assembly file any more. According to a comment to patchsets 2 in the Gerrit code review for commit bb8a61866ec6a6de2426012f8c4219d41b3a414a, the section ended up as SHT_PROGBITS instead of SHT_NOTE. I didn't know then that the section type is not actually important, only whether it's present in the segment pointed by a PT_NOTE is. That isn't recorded in the review. Since we now depend on the linker properly placing the .note.* sections for Qt plugins, we can rely on this working. Change-Id: Icb2516126f674e7b8bb3fffd16ad659149e34a23 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/global/qlibraryinfo.cpp')
-rw-r--r--src/corelib/global/qlibraryinfo.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index b0df718dc5..18a429fb6d 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -685,6 +685,7 @@ QStringList QLibraryInfo::platformPluginArguments(const QString &platformName)
QT_END_NAMESPACE
#if defined(Q_CC_GNU) && defined(ELF_INTERPRETER)
+# include <elf.h>
# include <stdio.h>
# include <stdlib.h>
@@ -694,6 +695,35 @@ QT_WARNING_DISABLE_GCC("-Wattributes")
QT_WARNING_DISABLE_CLANG("-Wattributes")
QT_WARNING_DISABLE_INTEL(2621)
+# if defined(Q_OS_LINUX)
+# include "minimum-linux_p.h"
+# endif
+# ifdef QT_ELF_NOTE_OS_TYPE
+struct ElfNoteAbiTag
+{
+ static_assert(sizeof(Elf32_Nhdr) == sizeof(Elf64_Nhdr),
+ "The size of an ELF note is wrong (should be 12 bytes)");
+ struct Payload {
+ Elf32_Word ostype = QT_ELF_NOTE_OS_TYPE;
+ Elf32_Word major = QT_ELF_NOTE_OS_MAJOR;
+ Elf32_Word minor = QT_ELF_NOTE_OS_MINOR;
+# ifdef QT_ELF_NOTE_OS_PATCH
+ Elf32_Word patch = QT_ELF_NOTE_OS_PATCH;
+# endif
+ };
+
+ Elf32_Nhdr header = {
+ .n_namesz = sizeof(name),
+ .n_descsz = sizeof(Payload),
+ .n_type = NT_GNU_ABI_TAG
+ };
+ char name[sizeof ELF_NOTE_GNU] = ELF_NOTE_GNU; // yes, include the null terminator
+ Payload payload = {};
+};
+__attribute__((section(".note.ABI-tag"), aligned(4), used))
+extern constexpr ElfNoteAbiTag QT_MANGLE_NAMESPACE(qt_abi_tag) = {};
+# endif
+
extern const char qt_core_interpreter[] __attribute__((section(".interp")))
= ELF_INTERPRETER;