[Bug 292376] devel/qt6-base: Regression in 6.10.1: qbittorrent crashes after the update

[email protected]
Newsgroups gmane.comp.kde.freebsd
Message-ID <[email protected]/bugzilla/>
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=292376

--- Comment #23 from Jesper Schmitz Mouridsen <[email protected]> ---
Well it fails because lto internalizes the QObject::staticMetaObject..

We can modify Qt code as follows to avoid that and still use
-Bsymbolic-functions in Qt.
qtbase-everywhere-src-6.10.2/src/corelib/kernel/qobjectdefs.h:
    583     template <const QMetaObject &MO> static const QMetaObject
*staticMetaObject()
    584     {
    585         const QMetaObject* ptr = &MO;
    586         asm volatile("" : : "r"(ptr) : "memory"); << avoid lto to
internalize the staticMetaObject                                      
    587         return ptr;
    588     }

work/qtbase-everywhere-src-6.10.2/src/corelib/global/qcompilerdetection.h:
   1413 #elif defined(__has_cpp_attribute) &&
 __has_cpp_attribute(clang::require_constant_initialization)
   1414 # define Q_CONSTINIT/* [[clang::require_constant_initialization]]  */

With LTO the [[clang::require_constant_initialization]] and the template as the
original 
constexpr &QObject::staticMetaData ends up as a copy of the QObject in the
program. Then inherits check fails because is depends on pointer comparison.
Correct me if I am wrong.
Another workaround would be to mark the Q_OBJECT declaration of
staticMetaObject as weak to allow it to resolve to the symbol in QtCore.so but
that is more ugly I think.

-- 
You are receiving this mail because:
You are the assignee for the bug.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.