Created attachment 579506 [details, diff] spidermonkey-1.8.5-r7-fix-lto-attribute-used.patch Linking libmozjs185.so fails when the compiler flags include -flto: /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/portage/dev-lang/spidermonkey-1.8.5-r7/temp/ccqyQfob.ltrans0.ltrans.o: in function `JaegerTrampoline': <artificial>:(.text+0x33): undefined reference to `SetVMFrameRegs' /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: <artificial>:(.text+0x3b): undefined reference to `PushActiveVMFrame' /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/portage/dev-lang/spidermonkey-1.8.5-r7/temp/ccqyQfob.ltrans0.ltrans.o: in function `JaegerTrampolineReturn': <artificial>:(.text+0x4d): undefined reference to `PopActiveVMFrame' /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/portage/dev-lang/spidermonkey-1.8.5-r7/temp/ccqyQfob.ltrans0.ltrans.o: in function `JaegerThrowpoline': <artificial>:(.text+0x6b): undefined reference to `js_InternalThrow' /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/portage/dev-lang/spidermonkey-1.8.5-r7/temp/ccqyQfob.ltrans0.ltrans.o: in function `throwpoline_exit': <artificial>:(.text+0x7a): undefined reference to `PopActiveVMFrame' collect2: error: ld returned 1 exit status make[1]: *** [config/rules.mk:1292: libmozjs185.so] Error 1 The callers are defined in global asm statements, so gcc doesn't see the calls and the callees get optimized out. This can be fixed by adding the "used" attribute to the missing functions. The attached patch works for me.
Created attachment 579586 [details, diff] Same patch just in git diff Please update name of who created the patch and add a signed off and I will be more then happy to land it on the tree.
Created attachment 579636 [details, diff] same patch with authorship info I wrote the patch myself. Added requested info to patch.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e4ccde83a06c4e028a420347cb3e617b054b57d9 commit e4ccde83a06c4e028a420347cb3e617b054b57d9 Author: Jory Pratt <anarchy@gentoo.org> AuthorDate: 2019-06-18 12:19:10 +0000 Commit: Jory Pratt <anarchy@gentoo.org> CommitDate: 2019-06-18 12:19:10 +0000 dev-lang/spidermonkey: Fix LTO compilations Thanks-to: Alexander Miller <alex.miller@gmx.de> Closes: https://bugs.gentoo.org/687812 Package-Manager: Portage-2.3.67, Repoman-2.3.14 Signed-off-by: Jory Pratt <anarchy@gentoo.org> .../files/spidermonkey-1.8.5-LTO.patch | 58 ++++++++ dev-lang/spidermonkey/spidermonkey-1.8.5-r8.ebuild | 148 +++++++++++++++++++++ 2 files changed, 206 insertions(+)