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>
This commit is contained in:
parent
7362b321e5
commit
aa82d295c8
@ -573,23 +573,6 @@ qt_internal_extend_target(Core CONDITION LINUX AND QT_BUILD_SHARED_LIBS
|
|||||||
global/minimum-linux_p.h
|
global/minimum-linux_p.h
|
||||||
)
|
)
|
||||||
|
|
||||||
#### Keys ignored in scope 34:.:global:global/global.pri:precompile_header:
|
|
||||||
# NO_PCH_ASM = "global/minimum-linux.S"
|
|
||||||
# QMAKE_EXTRA_COMPILERS = "no_pch_assembler"
|
|
||||||
# no_pch_assembler.commands = "$$QMAKE_CC" "-c" "$(CFLAGS)" "$(INCPATH)" "${QMAKE_FILE_IN}" "-o" "${QMAKE_FILE_OUT}"
|
|
||||||
# no_pch_assembler.dependency_type = "TYPE_C"
|
|
||||||
# no_pch_assembler.input = "NO_PCH_ASM"
|
|
||||||
# no_pch_assembler.name = "compiling[no_pch]" "${QMAKE_FILE_IN}"
|
|
||||||
# no_pch_assembler.output = "${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${firstQMAKE_EXT_OBJ}"
|
|
||||||
|
|
||||||
#### Keys ignored in scope 35:.:global:global/global.pri:silent:
|
|
||||||
# no_pch_assembler.commands = "@echo" "compiling[no_pch]" "${QMAKE_FILE_IN}" "&&"
|
|
||||||
|
|
||||||
qt_internal_extend_target(Core CONDITION LINUX AND NOT precompile_header AND QT_BUILD_SHARED_LIBS
|
|
||||||
SOURCES
|
|
||||||
global/minimum-linux.S
|
|
||||||
)
|
|
||||||
|
|
||||||
qt_internal_extend_target(Core CONDITION QT_FEATURE_slog2
|
qt_internal_extend_target(Core CONDITION QT_FEATURE_slog2
|
||||||
LIBRARIES
|
LIBRARIES
|
||||||
Slog2::Slog2
|
Slog2::Slog2
|
||||||
|
@ -1,81 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2017 Intel Corporation.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of the QtCore module of the Qt Toolkit.
|
|
||||||
**
|
|
||||||
** $QT_BEGIN_LICENSE:LGPL$
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
|
||||||
** packaging of this file. Please review the following information to
|
|
||||||
** ensure the GNU Lesser General Public License version 3 requirements
|
|
||||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 2.0 or (at your option) the GNU General
|
|
||||||
** Public license version 3 or any later version approved by the KDE Free
|
|
||||||
** Qt Foundation. The licenses are as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
|
||||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
** $QT_END_LICENSE$
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "minimum-linux_p.h"
|
|
||||||
|
|
||||||
/* Copied from #include <elf.h>:
|
|
||||||
*/
|
|
||||||
#define ELF_NOTE_GNU "GNU"
|
|
||||||
#define NT_GNU_ABI_TAG 1
|
|
||||||
#define ELF_NOTE_OS_LINUX 0
|
|
||||||
|
|
||||||
#ifdef __arm__
|
|
||||||
# define progbits %progbits
|
|
||||||
# define note %note
|
|
||||||
#else
|
|
||||||
# define progbits @progbits
|
|
||||||
# define note @note
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Add information for the ELF dynamic linker what the minimum Linux version
|
|
||||||
* required for Qt is.
|
|
||||||
*
|
|
||||||
* The .note.ABI-tag note section is defined at
|
|
||||||
* https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/noteabitag.html
|
|
||||||
*/
|
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", progbits
|
|
||||||
.section ".note.ABI-tag", "a", note
|
|
||||||
.balign 4 /* we have 32-bit data */
|
|
||||||
|
|
||||||
/* * For the format of the note section's contents, see Elf32_Nhdr / Elf64_Nhdr */
|
|
||||||
.long .Lnameend-.Lname /* n_namesz */
|
|
||||||
.long 16 /* n_descsz(16 bytes, normative) */
|
|
||||||
.long NT_GNU_ABI_TAG /* n_type */
|
|
||||||
|
|
||||||
.Lname:
|
|
||||||
.asciz ELF_NOTE_GNU
|
|
||||||
.Lnameend:
|
|
||||||
|
|
||||||
/* Operating systems: */
|
|
||||||
.long ELF_NOTE_OS_LINUX
|
|
||||||
|
|
||||||
.long MINLINUX_MAJOR
|
|
||||||
.long MINLINUX_MINOR
|
|
||||||
.long MINLINUX_PATCH
|
|
@ -83,24 +83,25 @@ QT_BEGIN_NAMESPACE
|
|||||||
// falls back to stat() for us.
|
// falls back to stat() for us.
|
||||||
// (Using QT_CONFIG(glibc) instead of __GLIBC__ because the macros aren't
|
// (Using QT_CONFIG(glibc) instead of __GLIBC__ because the macros aren't
|
||||||
// defined in assembler mode)
|
// defined in assembler mode)
|
||||||
# define MINLINUX_MAJOR 4
|
# define QT_ELF_NOTE_OS_MAJOR 4
|
||||||
# define MINLINUX_MINOR 11
|
# define QT_ELF_NOTE_OS_MINOR 11
|
||||||
# define MINLINUX_PATCH 0
|
# define QT_ELF_NOTE_OS_PATCH 0
|
||||||
#elif QT_CONFIG(getentropy)
|
#elif QT_CONFIG(getentropy)
|
||||||
# define MINLINUX_MAJOR 3
|
# define QT_ELF_NOTE_OS_MAJOR 3
|
||||||
# define MINLINUX_MINOR 17
|
# define QT_ELF_NOTE_OS_MINOR 17
|
||||||
# define MINLINUX_PATCH 0
|
# define QT_ELF_NOTE_OS_PATCH 0
|
||||||
#elif QT_CONFIG(renameat2)
|
#elif QT_CONFIG(renameat2)
|
||||||
# define MINLINUX_MAJOR 3
|
# define QT_ELF_NOTE_OS_MAJOR 3
|
||||||
# define MINLINUX_MINOR 16
|
# define QT_ELF_NOTE_OS_MINOR 16
|
||||||
# define MINLINUX_PATCH 0
|
# define QT_ELF_NOTE_OS_PATCH 0
|
||||||
#else
|
#else
|
||||||
# define MINLINUX_MAJOR 2
|
# define QT_ELF_NOTE_OS_MAJOR 2
|
||||||
# define MINLINUX_MINOR 6
|
# define QT_ELF_NOTE_OS_MINOR 6
|
||||||
# define MINLINUX_PATCH 28
|
# define QT_ELF_NOTE_OS_PATCH 28
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MINIMUM_LINUX_VERSION QT_VERSION_CHECK(MINLINUX_MAJOR, MINLINUX_MINOR, MINLINUX_PATCH)
|
/* you must include <elf.h> */
|
||||||
|
#define QT_ELF_NOTE_OS_TYPE ELF_NOTE_OS_LINUX
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
@ -685,6 +685,7 @@ QStringList QLibraryInfo::platformPluginArguments(const QString &platformName)
|
|||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#if defined(Q_CC_GNU) && defined(ELF_INTERPRETER)
|
#if defined(Q_CC_GNU) && defined(ELF_INTERPRETER)
|
||||||
|
# include <elf.h>
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
|
|
||||||
@ -694,6 +695,35 @@ QT_WARNING_DISABLE_GCC("-Wattributes")
|
|||||||
QT_WARNING_DISABLE_CLANG("-Wattributes")
|
QT_WARNING_DISABLE_CLANG("-Wattributes")
|
||||||
QT_WARNING_DISABLE_INTEL(2621)
|
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")))
|
extern const char qt_core_interpreter[] __attribute__((section(".interp")))
|
||||||
= ELF_INTERPRETER;
|
= ELF_INTERPRETER;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user