summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-10-23 14:01:35 +0200
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-10-23 14:45:03 +0200
commit790aef362fd195adf97d8c780a7cbbbade27d51f (patch)
tree8be464687ab21806cfe9f7ada27098b563aa41b2 /src/corelib/global
parent9720efbd1035c2e939b0581163e6d804c713dd96 (diff)
parent07475c662eb73c833da2d461b8ef2702ca1e2cfb (diff)
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts: .qmake.conf configure src/corelib/global/qglobal.h src/tools/qdoc/node.cpp src/tools/qdoc/qdocdatabase.cpp tests/auto/corelib/io/qsettings/tst_qsettings.cpp tools/configure/configureapp.cpp Change-Id: I66028ae5e441a06b73ee85ba72a03a3af3e8593f
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/global.pri31
-rw-r--r--src/corelib/global/qglobal.h5
-rw-r--r--src/corelib/global/qsystemdetection.h2
-rw-r--r--src/corelib/global/qversiontagging.cpp79
-rw-r--r--src/corelib/global/qversiontagging.h86
5 files changed, 142 insertions, 61 deletions
diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri
index eb8600f796..aa4945f90e 100644
--- a/src/corelib/global/global.pri
+++ b/src/corelib/global/global.pri
@@ -17,7 +17,8 @@ HEADERS += \
global/qisenum.h \
global/qtypetraits.h \
global/qflags.h \
- global/qhooks_p.h
+ global/qhooks_p.h \
+ global/qversiontagging.h
SOURCES += \
global/archdetect.cpp \
@@ -27,7 +28,8 @@ SOURCES += \
global/qmalloc.cpp \
global/qnumeric.cpp \
global/qlogging.cpp \
- global/qhooks.cpp
+ global/qhooks.cpp \
+ global/qversiontagging.cpp
# qlibraryinfo.cpp includes qconfig.cpp
INCLUDEPATH += $$QT_BUILD_TREE/src/corelib/global
@@ -58,28 +60,3 @@ journald {
syslog {
DEFINES += QT_USE_SYSLOG
}
-
-linux|freebsd {
- VERSIONTAGGING_SOURCES = global/qversiontagging.cpp
- ltcg|clang {
- versiontagging_compiler.commands = $$QMAKE_CXX -c $(CXXFLAGS) $(INCPATH)
-
- # Disable LTO, as the global inline assembly may not get processed
- versiontagging_compiler.commands += -fno-lto
-
- # Disable the integrated assembler for Clang, since it can't parse with
- # the alternate macro syntax in use in qversiontagging.cpp
- clang: versiontagging_compiler.commands += -no-integrated-as
-
- versiontagging_compiler.commands += -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN}
- versiontagging_compiler.dependency_type = TYPE_C
- versiontagging_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)}
- versiontagging_compiler.input = VERSIONTAGGING_SOURCES
- versiontagging_compiler.variable_out = OBJECTS
- versiontagging_compiler.name = compiling[versiontagging] ${QMAKE_FILE_IN}
- silent: versiontagging_compiler.commands = @echo compiling[versiontagging] ${QMAKE_FILE_IN} && $$versiontagging_compiler.commands
- QMAKE_EXTRA_COMPILERS += versiontagging_compiler
- } else {
- SOURCES += $$VERSIONTAGGING_SOURCES
- }
-}
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index d4bbbe833c..d86e410194 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -41,11 +41,10 @@
#include <stddef.h>
-#define QT_VERSION_STR "5.7.0"
/*
QT_VERSION is (major << 16) + (minor << 8) + patch.
*/
-#define QT_VERSION 0x050700
+#define QT_VERSION QT_VERSION_CHECK(QT_VERSION_MAJOR, QT_VERSION_MINOR, QT_VERSION_PATCH)
/*
can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0))
*/
@@ -55,6 +54,7 @@
#include <QtCore/qconfig.h>
#include <QtCore/qfeatures.h>
#endif
+
#ifdef _MSC_VER
# define QT_SUPPORTS(FEATURE) (!defined QT_NO_##FEATURE)
#else
@@ -1126,6 +1126,7 @@ QT_END_NAMESPACE
#include <QtCore/qatomic.h>
#include <QtCore/qglobalstatic.h>
#include <QtCore/qnumeric.h>
+#include <QtCore/qversiontagging.h>
#endif /* __cplusplus */
diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h
index f043f6c5c9..9ca376b84a 100644
--- a/src/corelib/global/qsystemdetection.h
+++ b/src/corelib/global/qsystemdetection.h
@@ -130,7 +130,7 @@
# if defined(WINAPI_FAMILY_PHONE_APP) && WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP
# define Q_OS_WINPHONE
# define Q_OS_WINRT
-# elif WINAPI_FAMILY==WINAPI_FAMILY_APP
+# elif WINAPI_FAMILY==WINAPI_FAMILY_PC_APP
# define Q_OS_WINRT
# else
# define Q_OS_WIN32
diff --git a/src/corelib/global/qversiontagging.cpp b/src/corelib/global/qversiontagging.cpp
index 66d3f8d00f..fc81d9bb93 100644
--- a/src/corelib/global/qversiontagging.cpp
+++ b/src/corelib/global/qversiontagging.cpp
@@ -33,37 +33,54 @@
#include "qglobal.h"
-#if defined(Q_CC_GNU) && (defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)) && defined(Q_PROCESSOR_X86) && !defined(QT_STATIC)
-# define SYM QT_MANGLE_NAMESPACE(qt_version_tag)
-# define SSYM QT_STRINGIFY(SYM)
+#define SYM QT_MANGLE_NAMESPACE(qt_version_tag)
+//#define SSYM QT_STRINGIFY(SYM)
-asm(
-// ASM macro that makes one ELF versioned symbol
-".macro make_versioned_symbol plainsym versionedsym\n"
-".globl plainsym\n"
-".type plainsym, @object\n"
-".size plainsym, 1\n"
-".symver plainsym, versionedsym\n"
-"plainsym :\n"
-".endm\n"
-
-// ASM macro that makes one ELF versioned symbol qt_version_tag{sep}Qt_{major}.{minor}
-// that is an alias to qt_version_tag_{major}_{minor}.
-// The {sep} parameter must be @ for all old versions and @@ for the current version.
-".macro make_one_tag major minor sep\n"
-" make_versioned_symbol " SSYM "_\\major\\()_\\minor, " SSYM "\\sep\\()Qt_\\major\\().\\minor\n"
-".endm\n"
-
-".altmacro\n"
-".bss\n"
-".set qt_version_major, " QT_STRINGIFY(QT_VERSION) " >> 16\n" // set qt_version_major
-".set qt_version_minor, 0\n" // set qt_version_minor to 0 (it will grow to the current)
-".rept (" QT_STRINGIFY(QT_VERSION) " >> 8) & 0xff\n" // repeat minor version times (0 to N-1)
-" make_one_tag %qt_version_major, %qt_version_minor, @\n"
-" .set qt_version_minor, (qt_version_minor + 1)\n"
-".endr\n"
-" make_one_tag %qt_version_major, %qt_version_minor, @@\n" // call the macro for the current version
-" .space 1\n" // variable is 1 byte, value 0
-);
+#if defined(Q_CC_GNU) && defined(Q_OF_ELF)
+# define make_versioned_symbol2(sym, m, n, separator) \
+ Q_CORE_EXPORT extern const char sym ## _ ## m ## _ ## n = 0; \
+ asm(".symver " QT_STRINGIFY(sym) "_" QT_STRINGIFY(m) "_" QT_STRINGIFY(n) ", " \
+ QT_STRINGIFY(sym) separator "Qt_" QT_STRINGIFY(m) "." QT_STRINGIFY(n))
+#else
+# define make_versioned_symbol2(sym, m, n, separator)
+#endif
+#define make_versioned_symbol(sym, m, n, separator) make_versioned_symbol2(sym, m, n, separator)
+extern "C" {
+#if QT_VERSION_MINOR > 0
+make_versioned_symbol(SYM, QT_VERSION_MAJOR, 0, "@");
+#endif
+#if QT_VERSION_MINOR > 1
+make_versioned_symbol(SYM, QT_VERSION_MAJOR, 1, "@");
+#endif
+#if QT_VERSION_MINOR > 2
+make_versioned_symbol(SYM, QT_VERSION_MAJOR, 2, "@");
+#endif
+#if QT_VERSION_MINOR > 3
+make_versioned_symbol(SYM, QT_VERSION_MAJOR, 3, "@");
+#endif
+#if QT_VERSION_MINOR > 4
+make_versioned_symbol(SYM, QT_VERSION_MAJOR, 4, "@");
#endif
+#if QT_VERSION_MINOR > 5
+make_versioned_symbol(SYM, QT_VERSION_MAJOR, 5, "@");
+#endif
+#if QT_VERSION_MINOR > 6
+make_versioned_symbol(SYM, QT_VERSION_MAJOR, 6, "@");
+#endif
+#if QT_VERSION_MINOR > 7
+make_versioned_symbol(SYM, QT_VERSION_MAJOR, 7, "@");
+#endif
+#if QT_VERSION_MINOR > 8
+make_versioned_symbol(SYM, QT_VERSION_MAJOR, 8, "@");
+#endif
+#if QT_VERSION_MINOR > 9
+make_versioned_symbol(SYM, QT_VERSION_MAJOR, 9, "@");
+#endif
+#if QT_VERSION_MINOR > 10
+# error "Please update this file with more Qt versions."
+#endif
+
+// the default version:
+make_versioned_symbol(SYM, QT_VERSION_MAJOR, QT_VERSION_MINOR, "@@");
+}
diff --git a/src/corelib/global/qversiontagging.h b/src/corelib/global/qversiontagging.h
new file mode 100644
index 0000000000..22e6e82a58
--- /dev/null
+++ b/src/corelib/global/qversiontagging.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Intel Corporation.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// qglobal.h includes this header, so keep it outside of our include guards
+#include <QtCore/qglobal.h>
+
+#if !defined(QVERSIONTAGGING_H)
+#define QVERSIONTAGGING_H
+
+QT_BEGIN_NAMESPACE
+
+/*
+ * Ugly hack warning and explanation:
+ *
+ * This file causes all ELF modules, be they libraries or applications, to use the
+ * qt_version_tag symbol that is present in QtCore. Such symbol is versioned,
+ * so the linker will automatically pull the current Qt version and add it to
+ * the ELF header of the library/application. The assembly produces one section
+ * called ".qtversion" containing two pointer-sized values. The first is a
+ * relocation to the qt_version_tag symbol (which is what causes the ELF
+ * version to get used). The second value is the current Qt version at the time
+ * of compilation.
+ *
+ * There will only be one copy of the section in the output library or application.
+ */
+
+#if defined(QT_BUILD_CORE_LIB) || defined(QT_BOOTSTRAPPED) || defined(QT_NO_VERSION_TAGGING)
+// don't make tags in QtCore, bootstrapped systems or if the user asked not to
+#elif defined(Q_CC_GNU)
+# if defined(Q_PROCESSOR_X86) && (defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD_KERNEL))
+# ifdef __LP64__
+# define QT_VERSION_TAG_RELOC(sym) ".quad " QT_STRINGIFY(QT_MANGLE_NAMESPACE(sym)) "@GOTPCREL\n"
+# elif defined(Q_PROCESSOR_X86_64) // x32
+# define QT_VERSION_TAG_RELOC(sym) ".long " QT_STRINGIFY(QT_MANGLE_NAMESPACE(sym)) "@GOTPCREL\n"
+# else // x86
+# define QT_VERSION_TAG_RELOC(sym) ".long " QT_STRINGIFY(QT_MANGLE_NAMESPACE(sym)) "@GOT\n"
+# endif
+# define QT_VERSION_TAG(sym) \
+ asm ( \
+ ".section .qtversion, \"aG\", @progbits, qt_version_tag, comdat\n" \
+ ".align 8\n" \
+ QT_VERSION_TAG_RELOC(sym) \
+ ".long " QT_STRINGIFY(QT_VERSION) "\n" \
+ ".align 8\n" \
+ ".previous" \
+ )
+# endif
+#endif
+
+#if defined(QT_VERSION_TAG)
+QT_VERSION_TAG(qt_version_tag);
+#endif
+
+QT_END_NAMESPACE
+
+#endif // QVERSIONTAGGING_H