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: RESOLVED DUPLICATE    
Severity: normal CC: david, elvis.angelaccio, gilberto.nunes32, noel.curray, wbauer1, zawertun
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
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. ***
Comment 3 Elvis Angelaccio 2024-10-09 21:51:01 UTC
*** Bug 479839 has been marked as a duplicate of this bug. ***
Comment 4 Elvis Angelaccio 2024-10-09 22:11:50 UTC
By looking at the analysis done in the linked opensuse ticket, this should now be fixed by https://invent.kde.org/pim/libkgapi/-/commit/6305de6caf85e1ed33448820b0a3dc14b61a60b0

Marking as resolved then. Please reopen if this is not the case!

*** This bug has been marked as a duplicate of bug 480063 ***