summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qmutex.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2022-02-09 12:50:36 -0800
committerThiago Macieira <thiago.macieira@intel.com>2022-03-14 18:26:10 -0800
commit40c8bc42026a8cf118ab60920314d84856c397a6 (patch)
tree667cb2c2e9f9f0999c95caf43502e7105481393f /src/corelib/thread/qmutex.cpp
parent13ad42c67988aab09bff0ee83903e1264d6048fe (diff)
qversiontagging: Use C++17 inline variables also on Unix
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>
Diffstat (limited to 'src/corelib/thread/qmutex.cpp')
0 files changed, 0 insertions, 0 deletions