Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 652158 - dev-qt/qtscript-5.9.4 with -flto - .../temp/ccKpdSnw.ltrans0.ltrans.o: In function `ctiVMThrowTrampoline': <artificial>:(.text+0x4c): undefined reference to `cti_vm_throw'
Summary: dev-qt/qtscript-5.9.4 with -flto - .../temp/ccKpdSnw.ltrans0.ltrans.o: In fun...
Status: CONFIRMED
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:
Whiteboard:
Keywords:
Depends on:
Blocks: lto
  Show dependency tree
 
Reported: 2018-04-01 21:32 UTC by Alexander Miller
Modified: 2019-11-10 22:17 UTC (History)
1 user (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 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)