diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2017-06-16 22:47:49 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2017-06-30 17:15:52 +0000 |
commit | bb8a61866ec6a6de2426012f8c4219d41b3a414a (patch) | |
tree | eef8c7307422c869e30a06ae0637ddbaf6c744cf /src/corelib | |
parent | 919b12d969ded1d004f0ba2f7bf303c034bdd204 (diff) |
Linux: add a note to the ELF binary what minimum Linux is needed
Change-Id: Ia53158e207a94bf49489fffd14c8d2a1f173ff97
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/global/global.pri | 16 | ||||
-rw-r--r-- | src/corelib/global/minimum-linux.S | 92 |
2 files changed, 108 insertions, 0 deletions
diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri index efc7f3cd22..78b37755a4 100644 --- a/src/corelib/global/global.pri +++ b/src/corelib/global/global.pri @@ -59,6 +59,22 @@ if(linux*|hurd*):!cross_compile:!static:!*-armcc* { DEFINES += ELF_INTERPRETER=\\\"$$system(LC_ALL=C readelf -l /bin/ls | perl -n -e \'$$prog\')\\\" } +linux:!static { + precompile_header { + # we'll get an error if we just use SOURCES += + 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.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} + no_pch_assembler.input = NO_PCH_ASM + no_pch_assembler.name = compiling[no_pch] ${QMAKE_FILE_IN} + silent: no_pch_assembler.commands = @echo compiling[no_pch] ${QMAKE_FILE_IN} && $$no_pch_assembler.commands + QMAKE_EXTRA_COMPILERS += no_pch_assembler + NO_PCH_ASM += global/minimum-linux.S + } else { + SOURCES += global/minimum-linux.S + } +} + qtConfig(slog2): \ LIBS_PRIVATE += -lslog2 diff --git a/src/corelib/global/minimum-linux.S b/src/corelib/global/minimum-linux.S new file mode 100644 index 0000000000..3c0fa09a0a --- /dev/null +++ b/src/corelib/global/minimum-linux.S @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +/* 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 + .align 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 + +/* Minimum Linux kernel version: + * We require the following features in Qt (unconditional, no fallback): + * Feature Added in version + * - inotify_init1 before 2.6.12-rc12 + * - futex(2) before 2.6.12-rc12 + * - FUTEX_PRIVATE_FLAG 2.6.22 + * - O_CLOEXEC 2.6.23 + * - eventfd 2.6.23 + * - pipe2 & dup3 2.6.27 + * - accept4 2.6.28 + */ + + .long 2 + .long 6 + .long 28 + |