summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qversiontagging.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* qversiontagging: merge the qt_version_tag symbolsThiago Macieira2022-03-141-5/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The symbols all still exist, but they all have the same address. For example, in my Linux debug build: $ eu-readelf --dyn-syms lib/libQt6Core.t.so | grep qt_version_tag 4352: 00000000005e3e74 1 OBJECT GLOBAL DEFAULT 18 qt_version_tag_6_0@@Qt_6 4356: 00000000005e3e74 1 OBJECT GLOBAL DEFAULT 18 qt_version_tag_6_1@@Qt_6 4358: 00000000005e3e74 1 OBJECT GLOBAL DEFAULT 18 qt_version_tag_6_2@@Qt_6 4362: 00000000005e3e74 1 OBJECT GLOBAL DEFAULT 18 qt_version_tag_6_3@@Qt_6 4364: 00000000005e3e74 1 OBJECT GLOBAL DEFAULT 18 qt_version_tag_6_4@@Qt_6 6458: 00000000005e3e74 1 OBJECT GLOBAL DEFAULT 18 qt_version_tag@@Qt_6.4 6460: 00000000005e3e74 1 OBJECT GLOBAL DEFAULT 18 qt_version_tag@Qt_6.0 6462: 00000000005e3e74 1 OBJECT GLOBAL DEFAULT 18 qt_version_tag@Qt_6.2 6463: 00000000005e3e74 1 OBJECT GLOBAL DEFAULT 18 qt_version_tag@Qt_6.3 6466: 00000000005e3e74 1 OBJECT GLOBAL DEFAULT 18 qt_version_tag@Qt_6.1 (The part after the @ is the ELF version; two @ indicates the default version) Saves N bytes where N is the Qt minor version number. The exclusion of Darwin (macOS) is because clang says that it has the "alias" attribute, but then fails when you use it. Change-Id: I74249c52dc02478ba93cfffd16d249d77d6f7565 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* qversiontagging: Use C++17 inline variables also on UnixThiago Macieira2022-03-141-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | C++17 inline variables allow us to declare a variable that shall be merged before linking, which replaces the need for the "comdat" part of the inline assembly. The GCC attribute "used" tells the compiler not to discard this variable, like the MinGW case. Additionally, the "retain" attribute (where supported) tells both the compiler and linker not to discard, allowing an intermediary, static library to keep this definition. This enables support for OSes besides FreeBSD and Linux, where it was previously available. For example, on macOS: $ nm libexec/rcc | grep qt_version_tag U _qt_version_tag_6_4 00000001000ec608 s _qt_version_tag_6_4_use On Linux, the assembly output before this change (Clang 13) was: .section .qtversion,"aG",@progbits,qt_version_tag,comdat .p2align 3 .quad qt_version_tag@GOT .long 394240 .p2align 3 After this change: .hidden qt_version_tag_use # @qt_version_tag_use .type qt_version_tag_use,@object .section .qtversion,"aGwR",@progbits,qt_version_tag_use,comdat .weak qt_version_tag_use .p2align 3 qt_version_tag_use: .quad qt_version_tag .quad 394240 # 0x60400 .size qt_version_tag_use, 16 The notable changes here are that there is a symbol and that the section is writable. The latter is required because we store the pointer to the qt_version_tag variable instead of just an offset in the GOT. The total number of relocations in the resulting binary remains the same. We've actually shrunk the binary by one pointer size. Change-Id: I74249c52dc02478ba93cfffd16d23951a6bcd784 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* qversiontagging: Add Windows supportThiago Macieira2022-03-141-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Details in the comment in the header. I haven't recently tested with MSVC, but I designed this originally in 2015 when I did have access to Visual Studio so I know it works (I've confirmed with Godbolt). With MinGW, this produces assembly: .globl qt_version_tag_used .section .qtversion,"dr" .linkonce same_size .align 16 qt_version_tag_used: .quad __imp_qt_version_tag_6_4 .quad 394240 394240 is 0x060400. The DLL import table contains: 0015f03c 0015f294 00000000 00000000 00165478 0016012c DLL Name: Qt6Core.t.dll vma: Hint/Ord Member-Name Bound-To 161318 7 _Z11qt_assert_xPKcS0_S0_i ... 164cf8 6073 qt_version_tag_6_4 Change-Id: I42e7ef1a481840699a8dffff1404f45b13f60ba6 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* CMake: Make LTO build workThiago Macieira2021-10-131-1/+0
| | | | | | | | We don't need to check FEATURE_ltcg, just add -fno-lto unconditionally. That makes QtCore compile with -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON. Change-Id: Icb2516126f674e7b8bb3fffd16ada2c71d7334aa Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Update the Qt version tagging to adapt to expected Qt 5.16Thiago Macieira2018-07-181-1/+10
| | | | | | Change-Id: I61ecce6b1324410bbab4fffd153d5d362d4429bb Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Unbreak the build and add support for Qt 5.12 tooThiago Macieira2017-09-041-0/+10
| | | | | | | | Unlike qdatastream.h, we can be ready for future versions. Current plans say we should do Qt 5.12 and then begin working on 6.0. Change-Id: I38341f8155354cc4a776fffd14e13c2f1362b483 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Updated license headersJani Heikkinen2016-01-211-1/+1
| | | | | | | | | | | | | From Qt 5.7 -> tools & applications are lisenced under GPL v3 with some exceptions, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one (in those files which will be under GPL 3 with exceptions) Change-Id: I42a473ddc97101492a60b9287d90979d9eb35ae1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Updated license headersJani Heikkinen2016-01-151-13/+19
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Workaround: don't create ELF version scripts for AndroidThiago Macieira2015-10-291-1/+1
| | | | | | | | | | | | | Somehow qmake doesn't add the correct rules for the Android makefiles, so the build fails when cross-compiling from Windows. The reason for that is unknown (could be related to that "qt_android_deps" config, but that isn't used anywhere in qmake or the buildsystem). This isn't likely to be a problem, since there are no global installs of Qt on Android. Change-Id: I1d0f78915b5942aab07cffff140f95ce32324030 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update qversiontagging.cpp not to use too much assembler magicThiago Macieira2015-10-201-31/+48
| | | | | | | | | | | | | | | The only reason I had used them in the first place was because C preprocessor macros cannot call themselves recursively. But the magic was too magic and caused issues with some builds, so let's choose the safer option. Anyway, this solution now works for all ELF architectures, independent of the processor, whereas previously it was restricted to x86 and Linux/ FreeBSD. However, this does not apply to the assembly in qversiontagging.h. Change-Id: I42e7ef1a481840699a8dffff1404f032fc5cacb8 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Fix QtCore compilation with clangThiago Macieira2015-09-211-4/+11
| | | | | | | | | | | | | | 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>
* Add a qt_version_tag symbol to QtCore that uses ELF versionsThiago Macieira2015-09-131-0/+62
This symbol will exist with different ELF versions, allowing us to know which version of Qt a given library or application was linked against. When this symbol gets used, automatic packaging tools will extract the dependency. The trick here is that the application uses qt_version_tag without knowing which version is current, but the linker resolves it to the current version and records that. For example, if this were used with Qt 5.5, RPM's find-requires on an application using QtCore would print: libQt5Core.so.5()(64bit) libQt5Core.so.5(Qt_5.5)(64bit) libQt5Core.so.5(Qt_5)(64bit) Whereas find-provides on QtCore would print: libQt5Core.so.5()(64bit) libQt5Core.so.5(libQt5Core.so.5)(64bit) libQt5Core.so.5(Qt_5.0)(64bit) libQt5Core.so.5(Qt_5.1)(64bit) libQt5Core.so.5(Qt_5.2)(64bit) libQt5Core.so.5(Qt_5.3)(64bit) libQt5Core.so.5(Qt_5.4)(64bit) libQt5Core.so.5(Qt_5.5)(64bit) libQt5Core.so.5(Qt_5)(64bit) Therefore, automatic dependency resolution would have the information it needs to conclude that the application requires Qt >= 5.5. Change-Id: I049a653beeb5454c9539ffff13e3fec9aeb50197 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>