Bug 411425

Summary: The link ordering is correct by chance only and init of gdrive.so fails when linking with LTO enabled
Product: [Frameworks and Libraries] libkgapi Reporter: Hans-Peter Jansen <hpj>
Component: driveAssignee: Daniel Vrátil <dvratil>
Status: REPORTED ---    
Severity: normal CC: david, noel.curray, wbauer1, zawertun
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: patch to provoke failure, even if LTO is disabled

Description Hans-Peter Jansen 2019-08-29 15:45:01 UTC
Created attachment 122413 [details]
patch to provoke failure, even if LTO is disabled

SUMMARY
The linking is ordered alphabetically in src/drive/CMakeLists.txt, and fails
with a segfault, if LTO is used, because LTO doesn't stick to the supplied linking order, if it sees a chance to optimize module locality.

See:
https://bugzilla.opensuse.org/show_bug.cgi?id=1148217
Specifically:
https://bugzilla.opensuse.org/show_bug.cgi?id=1148217#c19
and
https://bugzilla.opensuse.org/show_bug.cgi?id=1148217#c21

STEPS TO REPRODUCE
apply attached patch, compile, install, and run "kioclient5 exec gdrive:/"

OBSERVED RESULT
Failure: The process for the protocol gdrive failed unexpectedly. (translated)

EXPECTED RESULT
No failure

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Tumbleweed 20190824
(available in About System)
KDE Plasma Version:  5.16.4
KDE Frameworks Version: 5.61.0
Qt Version: 5.13.0

ADDITIONAL INFORMATION
Linking with LTO disabled fixed the problem, but the correct initialization order should be addressed in some future version.
Comment 1 Antonio Rojas 2022-01-30 13:37:22 UTC
*** Bug 428826 has been marked as a duplicate of this bug. ***
Comment 2 Antonio Rojas 2022-01-30 13:39:46 UTC
*** Bug 449113 has been marked as a duplicate of this bug. ***