On Wednesday, 3 December 2025 23:59:37 Pacific Standard Time Stephan Bergmann 
wrote:
> So, if I get you right, you claim that my executable should be built in
> a way that it does not export _ZN16QCoreApplication4selfE and rather
> have that as undefined (so that the executable and all the other Qt
> shared libraries bind to the copy exported by QtCore)?  But I fail to
> find a way how to build the executable that way.

Correct. The executable having a copy of the variable and enforcing the PLT 
for functions it doesn't have is a wart that needs to be burned out of the ELF 
ecosystem.

The solution is -mno-direct-extern-access.
https://gcc.godbolt.org/z/xxczffPrx

I will start enforcing this for Qt come 7.0 at least for Linux. I think 
FreeBSD was broken for some reason, so I'll probably just enforce there too 
and let FreeBSD developers fix their toolchain, instead of gracefully 
degrading.

GCC diff: https://diff.godbolt.org/z/e4e7Tcnaj
Clang diff: https://diff.godbolt.org/z/q9chhdPnE or lack thereof
(Clang appears to emit the correct way either way)

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Principal Engineer - Intel DCG - Platform & Sys. Eng.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

-- 
Development mailing list
[email protected]
https://lists.qt-project.org/listinfo/development

Reply via email to