Fabian Vogt changed bug 1175278
What Removed Added
CC   matz@suse.com, schwab@suse.de
Component KDE Applications Development
Assignee opensuse-kde-bugs@opensuse.org martin.liska@suse.com

Comment # 3 on bug 1175278 from
The crashing code is from extra-cmake-modules, which is built into
kgendesignerplugin:
https://github.com/KDE/extra-cmake-modules/blob/110f62d69b9529a901889c3998817eb406a22c8f/modules/ECMQmLoader.cpp.in

if (QThread::currentThread() == QCoreApplication::instance()->thread()) {

The evaluation of the RHS segfaults, because QObject::thread is given nullptr
as "this".
The call to QCoreApplication::instance() got inlined:
    static QCoreApplication *instance() { return self; }
    static QCoreApplication *self;

���B+ 0x555555558e1c <(anonymous namespace)::loadOnMainThread()+12>   mov   
0x6505(%rip),%rdi        # 0x55555555f328 <_ZN16QCoreApplication4selfE>
���  >0x555555558e23 <(anonymous namespace)::loadOnMainThread()+19>   mov   
%rax,%rbp
���   0x555555558e26 <(anonymous namespace)::loadOnMainThread()+22>   callq 
0x555555557570 <_ZNK7QObject6threadEv@plt>

(gdb) p/x $rip+0x6505
$14 = 0x55555555f328
(gdb) p/x &QCoreApplication::self
$15 = 0x7ffff7ed66a8
(gdb) p/x *$15
$16 = 0x7fffffffe6d0

readelf -rW /usr/bin/kgendesignerplugin | grep self
000000000000b328  0000007500000005 R_X86_64_COPY          000000000000b328
_ZN16QCoreApplication4selfE@Qt_5 + 0

So there appear to be two things going wrong:
- %rip+0x6505 = 0xb328 should contain the address of QCoreApplication::self,
but it's 0. 0xb328 is in the middle of .bss, which seems odd.
- Even if it did contain the address, there is still a dereference missing.

So this looks like a severe miscompilation/mislinking.

It works fine if kdesignerplugin is built without LTO. In that case,
QCoreApplication::instance is not inlined and we have this:

0000000000008979 <_ZN16QCoreApplication8instanceEv>:
    8979:       55                      push   %rbp
    897a:       48 89 e5                mov    %rsp,%rbp
    897d:       48 8b 05 64 66 00 00    mov    0x6664(%rip),%rax        # efe8
<_ZN16QCoreApplication4selfE@Qt_5>
    8984:       48 8b 00                mov    (%rax),%rax
    8987:       5d                      pop    %rbp
    8988:       c3                      retq   
    8989:       90                      nop

000000000000efe8  0000004d00000006 R_X86_64_GLOB_DAT      0000000000000000
_ZN16QCoreApplication4selfE@Qt_5 + 0

Not sure whether this is a linker or compiler issue, but I'm leaning towards
the latter.
There is an updated binutils in the same staging, which might play a role as
well.

Reassigning to gcc, adding binutils maintainer.


You are receiving this mail because: