Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 687812 - dev-lang/spidermonkey-1.8.5-r7 with LTO fails to link: undefined reference to `SetVMFrameRegs' etc.
Summary: dev-lang/spidermonkey-1.8.5-r7 with LTO fails to link: undefined reference to...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Mozilla Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-10 16:58 UTC by Alexander Miller
Modified: 2019-06-18 12:19 UTC (History)
0 users

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


Attachments
spidermonkey-1.8.5-r7-fix-lto-attribute-used.patch (fix-lto.patch,1.13 KB, patch)
2019-06-10 16:58 UTC, Alexander Miller
Details | Diff
Same patch just in git diff (0001-Fix-breakage-with-lto-builds.patch,1.78 KB, patch)
2019-06-12 05:32 UTC, Jory A. Pratt
Details | Diff
same patch with authorship info (updated.patch,1.84 KB, patch)
2019-06-12 15:55 UTC, Alexander Miller
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Miller 2019-06-10 16:58:36 UTC
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.
Comment 1 Jory A. Pratt gentoo-dev 2019-06-12 05:32:08 UTC
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.
Comment 2 Alexander Miller 2019-06-12 15:55:01 UTC
Created attachment 579636 [details, diff]
same patch with authorship info

I wrote the patch myself. Added requested info to patch.
Comment 3 Larry the Git Cow gentoo-dev 2019-06-18 12:19:31 UTC
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(+)