From 72ba0079c3967bdfa26acdce78ce6cb98b30c27b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 2 Jun 2015 11:10:22 -0700 Subject: Add a linker version script to Qt libraries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This linker script is only enabled for systems with GCC or GCC-like compilers, though technically it should work on the BSDs too (will enable after testing). For regular modules, this declares one ELF version "Qt_5" and places all QtCore symbols inside, then it declares unused ELF versions "Qt_5.x" for each older minor release. For modules declared "internal_module", all symbols are placed in version Qt_5_PRIVATE_API. The big advantage of an ELF version is that, when we do Qt 6, both versions of QtCore could be loaded in memory without conflicts and all symbols would be resolved to the correct library. No module can talk to both at the same time, but this avoids mistakes of loading them indirectly by plugins. The extra Qt_5.x versions will be used in the next commit. Change-Id: I049a653beeb5454c9539ffff13e3fe6f050fdf31 Reviewed-by: Lisandro Damián Nicanor Pérez Meyer Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- mkspecs/features/qt_module.prf | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'mkspecs/features') diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf index c89b6d2793..5206691a17 100644 --- a/mkspecs/features/qt_module.prf +++ b/mkspecs/features/qt_module.prf @@ -185,6 +185,28 @@ equals(QT_ARCH, i386):contains(QT_CPU_FEATURES.$$QT_ARCH, sse2):compiler_support QMAKE_CXXFLAGS += -mfpmath=sse } +unix:!isEmpty(QMAKE_LFLAGS_VERSION_SCRIPT):!no_linker_version_script:!static { + verscript = $$OUT_PWD/$${TARGET}.version + QMAKE_LFLAGS += $${QMAKE_LFLAGS_VERSION_SCRIPT}$$verscript + + internal_module { + verscript_content = "Qt_$${QT_MAJOR_VERSION}_PRIVATE_API { *; };" + } else { + current = Qt_$$QT_MAJOR_VERSION + verscript_content = "$$current { *; };" + for(i, 0..$$section(VERSION, ., 1, 1)) { + previous = $$current + current = Qt_$${QT_MAJOR_VERSION}.$$i + verscript_content += "$$current {} $$previous;" + } + } + write_file($$verscript, verscript_content)|error("Aborting.") + unset(current) + unset(previous) + unset(verscript) + unset(verscript_content) +} + android: CONFIG += qt_android_deps #install directives -- cgit v1.2.3