Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 652158 - dev-qt/qtscript-5.15.5 with -flto - .../temp/ccKpdSnw.ltrans0.ltrans.o: In function `ctiVMThrowTrampoline': <artificial>:(.text+0x4c): undefined reference to `cti_vm_throw'
Summary: dev-qt/qtscript-5.15.5 with -flto - .../temp/ccKpdSnw.ltrans0.ltrans.o: In fu...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Qt Bug Alias
URL: https://bugreports.qt.io/browse/QTBUG...
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: lto
  Show dependency tree
 
Reported: 2018-04-01 21:32 UTC by Alexander Miller
Modified: 2023-12-12 13:07 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Miller 2018-04-01 21:32:56 UTC
When CXXFLAGS contains -flto, the compile phase fails when linking libQt5Script.so.5.9.4 with the following error:
  /tmp/portage/dev-qt/qtscript-5.9.4/temp/ccKpdSnw.ltrans0.ltrans.o: In function `ctiVMThrowTrampoline':
  <artificial>:(.text+0x4c): undefined reference to `cti_vm_throw'
  collect2: error: ld returned 1 exit status
(using sys-devel/gcc-7.3.0-r1, sys-devel/binutils-2.29.1-r1)

The reason is that src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp (-> src/script/obj/release/JITStubs.o) defines functions in global asm statements, which gcc can't handle properly in lto mode. After manually recompiling that file with -fno-lto added, I can resume the build and it completes successfully.

I don't have a good solution for this package since I don't know how to pass extra flags just for the affected file with the qmake based build system. If that's possible, then just add -flto for that file; I didn't find such an option and the hacks I can think of are definitely not suitable for public deployment. We can always disable lto for the whole package, but I'd prefer a less drastic solution. Any ideas?
Comment 1 Steffen Hau 2018-04-03 08:01:02 UTC
Hi,

there is a patch out there for the issue:
--- a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.h.orig    2016-02-03 13:46:12.000000000 +0100
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.h 2016-04-24 14:24:42.396004500 +0200
@@ -316,7 +316,7 @@
     EncodedJSValue JIT_STUB cti_op_to_primitive(STUB_ARGS_DECLARATION);
     EncodedJSValue JIT_STUB cti_op_typeof(STUB_ARGS_DECLARATION);
     EncodedJSValue JIT_STUB cti_op_urshift(STUB_ARGS_DECLARATION);
-    EncodedJSValue JIT_STUB cti_vm_throw(STUB_ARGS_DECLARATION);
+    EncodedJSValue JIT_STUB cti_vm_throw(STUB_ARGS_DECLARATION) __attribute__((used));
     EncodedJSValue JIT_STUB cti_to_object(STUB_ARGS_DECLARATION);
     JSObject* JIT_STUB cti_op_construct_JSConstruct(STUB_ARGS_DECLARATION);
     JSObject* JIT_STUB cti_op_new_array(STUB_ARGS_DECLARATION);


See also:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48056
Comment 2 Markus 2019-06-22 06:37:33 UTC
Why it was neither integrated in portage nor upstream?
Comment 3 Iade Gesso 2019-11-10 13:00:39 UTC
Still present in 5.13.2...

Why the patch is not used in mainstream repository?


Iade Gesso, PhD (in Computer Science)
Comment 4 Andreas Sturmlechner gentoo-dev 2019-11-10 19:24:51 UTC
Please submit it upstream.
Comment 5 Davide Pesavento (RETIRED) gentoo-dev 2019-11-10 22:17:56 UTC
This has been fixed in JavaScriptCore years ago https://trac.webkit.org/changeset/118344/webkit

Someone needs to backport it to the copy of JSC bundled in qtscript and submit it upstream (Qt upstream)
Comment 6 Agostino Sarubbo gentoo-dev 2022-07-09 06:41:03 UTC
lto_tinderbox has reproduced this issue with version 5.15.5 - Updating summary.
Comment 8 Arsen Arsenović gentoo-dev 2023-10-14 12:04:35 UTC
seems reasonable to backport
Comment 9 Larry the Git Cow gentoo-dev 2023-12-12 13:04:19 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2d51131e1ec7aa03f22a2f2864237fdc3d4dc146

commit 2d51131e1ec7aa03f22a2f2864237fdc3d4dc146
Author:     Andreas Sturmlechner <asturm@gentoo.org>
AuthorDate: 2023-12-07 17:56:50 +0000
Commit:     Andreas Sturmlechner <asturm@gentoo.org>
CommitDate: 2023-12-12 12:56:01 +0000

    qt5-build.eclass: filter-lto
    
    Closes: https://bugs.gentoo.org/650488
    Closes: https://bugs.gentoo.org/692078
    Closes: https://bugs.gentoo.org/713850
    Closes: https://bugs.gentoo.org/908419
    Closes: https://bugs.gentoo.org/652158
    Closes: https://bugs.gentoo.org/919043
    Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>

 eclass/qt5-build.eclass | 3 +++
 1 file changed, 3 insertions(+)