1
0
forked from pool/libqt5-qtbase
libqt5-qtbase/Fix-QtCore-compilation-with-clang.patch

103 lines
4.3 KiB
Diff

From 4c738356ee4f20b6414e43a1cd73817f7eb28dd1 Mon Sep 17 00:00:00 2001
From: Thiago Macieira <thiago.macieira@intel.com>
Date: Thu, 17 Sep 2015 11:35:36 -0700
Subject: [PATCH 3/5] Fix QtCore compilation with clang
The .altmacro is not supported with Clang's integrated assembly.
The worst part is that I had this fixed, but apparently I never pushed
the update to Gerrit and then we staged the old version. This commit
brings back the fixes.
Incidentally, it also makes things work with freebsd-clang.
Change-Id: Id2a5d90d07d7ee470fcb9ad9696a9a0f9ced7ea7
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
(cherry picked from commit 05d401104ee6b10699b7288ead044d6765b19c4d)
---
src/corelib/global/global.pri | 28 ++++++++++++++++++++++++++--
src/corelib/global/qversiontagging.cpp | 15 +++++++++++----
2 files changed, 37 insertions(+), 6 deletions(-)
diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri
index 7ca0734f1face0d4517fdb1257dbb9812f04d0d2..2165a6c22e86948655c0074d50f8669c8a192d40 100644
--- a/src/corelib/global/global.pri
+++ b/src/corelib/global/global.pri
@@ -27,8 +27,7 @@ SOURCES += \
global/qmalloc.cpp \
global/qnumeric.cpp \
global/qlogging.cpp \
- global/qhooks.cpp \
- global/qversiontagging.cpp
+ global/qhooks.cpp
# qlibraryinfo.cpp includes qconfig.cpp
INCLUDEPATH += $$QT_BUILD_TREE/src/corelib/global
@@ -55,3 +54,28 @@ journald {
PKGCONFIG_PRIVATE += libsystemd-journal
DEFINES += QT_USE_JOURNALD
}
+
+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/qversiontagging.cpp b/src/corelib/global/qversiontagging.cpp
index e3d9efa16b7677a29963020660bc9c4b4a143356..66d3f8d00f7297d98c08cfa7aa359874e2e0aa8f 100644
--- a/src/corelib/global/qversiontagging.cpp
+++ b/src/corelib/global/qversiontagging.cpp
@@ -33,18 +33,25 @@
#include "qglobal.h"
-#if defined(Q_CC_GNU) && defined(Q_OS_LINUX) && defined(Q_PROCESSOR_X86) && !defined(QT_STATIC)
+#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)
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"
-".globl " SSYM "_\\major\\()_\\minor\n" // make the symbol global
-SSYM "_\\major\\()_\\minor:\n" // declare it
-" .symver " SSYM "_\\major\\()_\\minor, " SSYM "\\sep\\()Qt_\\major\\().\\minor\n"
+" make_versioned_symbol " SSYM "_\\major\\()_\\minor, " SSYM "\\sep\\()Qt_\\major\\().\\minor\n"
".endm\n"
".altmacro\n"
--
2.6.0