summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qversiontagging.h
Commit message (Collapse)AuthorAgeFilesLines
* Make version_tagging the full-functional featureAlexey Edelev2024-05-071-0/+2
| | | | | | | | | | This feature allows to explicitly disable the version tagging for Qt libraries and have the precise feature-based guarding in C++ code. Task-number: QTBUG-124346 Change-Id: If109adb2f6a998c58825a2449cfb936ea278b2ad Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Avoid including qversiontagging.h in QtCore module headerAlexey Edelev2024-04-261-0/+4
| | | | | | | | The header is already included in qglobal.h Task-number: QTBUG-124346 Change-Id: Id713cdecd4c3221edc32402cb874ab0d98a86f82 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Break cyclic includes in qglobal.h [2/3]Ahmad Samir2023-05-261-3/+5
| | | | | | Task-number: QTBUG-106722 Change-Id: I6cf2b3fcd419659cc8a0633892393febd26e505b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix clang-cl compiler warningsPeter Varga2022-12-151-1/+1
| | | | | | | | | | | | - known but unsupported action 'shared' for '#pragma section' [-Wignored-pragmas] - #include resolved using non-portable Microsoft search rules [-Wmicrosoft-include] - variable is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized] Change-Id: I466352ff97a2bcf07e706c045568e581dd08a94e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix redefine of QT_NO_VERSION_TAGGING warningsNiclas Rosenvik2022-11-021-1/+1
| | | | | | | | | | | | | If a user requests no version tagging by defining QT_NO_VERSION_TAGGING a lot of redefine warnings will be output from the compiler when building corelib. So only define QT_NO_VERSION_TAGGING if it is not already defined. Pick-to: 6.4 Change-Id: I56609b3589184bda7bec52d168d9fd11e2f14a2c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* 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.h: remove the attempt to use the "retain" attributeThiago Macieira2022-03-211-5/+1
| | | | | | | | | | | GCC 11 knows about it, meaning __has_attribute(retain) = 1 regardless of whether GCC can emit code for it. Clang has a similar limitation. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99587 Fixes: QTBUG-101753 Change-Id: Ic30914a4448d4bc28974fffd16dce9a78cdefe5b Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* qversiontagging: Fix the imp prefix for 32 bit armMartin Storsjö2022-03-191-5/+5
| | | | | | | | The underscore symbol prefix is only used on 32 bit x86, not on other 32 bit architectures such as arm. Change-Id: Iac82f2d70c8b0c811faa7af5b59805b388b0a00c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix qt version tagging on windows with namespacesMårten Nordheim2022-03-161-1/+1
| | | | | | | | | The libraries linking to QtCore were looking for __imp_qt_version_tag_6_4 but the exported symbol was __imp_qt_version_tag_NAMESPACE_6_4 (with the mangled namespace) Change-Id: Ida7b18bea4b5e7dab9c0efb63279779d1af898cb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* qversiontagging: remove the old inline assembly contentThiago Macieira2022-03-141-20/+6
| | | | | | | | No longer used, since GCC and Clang always have __attribute__((used)). Change-Id: I74249c52dc02478ba93cfffd16d2494fa632ea10 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-11/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-12/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Use the namespace-mangled symbol for the qt_version_tag group nameThiago Macieira2017-07-071-1/+1
| | | | | | | | | | Doesn't affect our current builds since it's just a marker for the linker on what sections should be merged. Unless you're mixing namespaced and non-namespaced static builds into one executable. Change-Id: Ia53158e207a94bf49489fffd14c7bc294fccf8f9 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-10-271-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/ios/ios.pro src/plugins/platforms/ios/kernel.pro src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.h src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileenginefactory.h src/plugins/platforms/ios/qiosintegration.h src/widgets/widgets/qcombobox.cpp tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp Change-Id: Ibaee7cbbba99e7c4b1d8926e55932ffa6030ce45
| * qversiontagging.h: Don't tag binaries in static modeThiago Macieira2016-10-251-1/+1
| | | | | | | | | | | | | | | | | | Though there should have been no ill-effects, they happen. Task-number: QTBUG-52605 Change-Id: I9093948278414644a416fffd147444078edc3183 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-04-251-2/+2
|\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: config.tests/unix/compile.test configure src/android/jar/src/org/qtproject/qt5/android/QtMessageDialogHelper.java src/corelib/global/qglobal.cpp src/widgets/kernel/qapplication.cpp src/widgets/styles/qwindowsvistastyle.cpp tests/auto/corelib/kernel/qobject/tst_qobject.cpp Change-Id: I067083f34e5290aa5f7565e40c30a069cc37b83a
| * Fix build on Linux/x32 systems (x86-64 ILP32)Thiago Macieira2016-04-191-2/+2
| | | | | | | | | | | | | | | | | | | | When I tested this, it compiled, but either I wasn't using the same compiler or the problem happens during linking: we can't use .quad (64-bit) with a relocation on x32. So instead, let's use .long (32-bit). Task-number: QTBUG-52658 Change-Id: Ifea6e497f11a461db432ffff14468d1a16f49c67 Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-02-181-5/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also reverts commit 018e670a26ff5a61b949100ae080f5e654e7bee8. The change was introduced in 5.6. After the refactoring, 14960f52, in 5.7 branch and a merge, it is not needed any more. Conflicts: .qmake.conf src/corelib/io/qstandardpaths_mac.mm src/corelib/tools/qsharedpointer_impl.h tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp Change-Id: If4fdff0ebf2b9b5df9f9db93ea0022d5ee3da2a4
| * Work around Clang < 3.7 integrated assembler bug PC-relative relocsThiago Macieira2016-02-021-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The qversiontagging.h inline assembly expands to: .long qt_version_tag@GOTPCREL Which, with GCC, Clang >= 3.7 and with the option -no-integrated-as in previous versions, produces the proper relocation (a R_X86_64_GOTPCREL). With Clang < 3.7, it instead produces a R_X86_64_32, which is unsuitable for use in shared libraries: 32-bit displacement is insufficiently wide and would produce linker errors like obj/qftp.o: requires dynamic R_X86_64_32 reloc against 'qt_version_tag' which may overflow at runtime; recompile with -fPIC Instead, force a 64-bit relocation (an R_X86_64_GOT64), which like the 32-bit version is simply an offset into the GOT of where the address of the symbol is stored. Task-number: QTBUG-50749 Change-Id: I7a9e11d7b64a4cc78e24ffff142e039c172b802c Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-01-261-5/+7
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java src/dbus/qdbusconnection_p.h src/dbus/qdbusintegrator.cpp src/dbus/qdbusintegrator_p.h tests/auto/corelib/io/qdir/qdir.pro tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp Change-Id: I3d3fd07aed015c74b1f545f1327aa73d5f365fcc
| * Fix the use of R_X86_64_GOTPCREL on a 64-bit field: it should be 32-bitThiago Macieira2016-01-211-5/+7
| | | | | | | | | | | | | | | | | | | | | | The ABI says that PC-relative displacements should be on 32-bit fields, even on 64-bit builds. For -mcmodel=large, it should use R_X86_64_GOT64 relocations, like 32-bit. Task-number: QTBUG-50537 Change-Id: I1041122c530b4f5bbaabffff142ade5b3cbfc4c5 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | 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 part 2: don't use the version tagging symbols on AndroidThiago Macieira2015-11-041-1/+1
| | | | | | | | | | | | | | Commit d020e0781cf8647d87f7088350e40adf4f0cf8fe added a workaround to the QtCore build due to a qmake bug in handling the extra target on a Windows host. The workaround removed the tagging symbols from QtCore. This commit removes the using of those symbols from everywhere else. Task-number: QTBUG-49208 Change-Id: Idba8c29717f34c70a58fffff14133399f9f0b7f2 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com> Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Add an automatic use of the ELF-versioned QtCore symbolThiago Macieira2015-10-201-0/+86
See the comment in the header for an explanation of what it does. This trick is enabled for every single .o that is compiled, unless QT_NO_VERSION_TAGGING is defined. The assembly expands to a COMDAT section, which is mergeable by the linker, so only one copy of the output is present in the ELF module. This is enabled only for Linux and x86 / x86-64 / x32 due to the requirement of writing assembly and relocations, so it needs to be tested on each platform, which I have not done. It might work on Solaris/x86, but again it requires testing. Support for other architectures requires different assembly output and relocations and can be added as needed, but they are not as important since this trick is has most value on desktop systems. Change-Id: I049a653beeb5454c9539ffff13e3ff5782a8cb86 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Rex Dieter <rdieter@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>