Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 938009 - sys-devel/mold: fails to compile www-client/firefox-128.1.0:esr (assertion failure w/ icf)
Summary: sys-devel/mold: fails to compile www-client/firefox-128.1.0:esr (assertion fa...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Sam James
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: systemwide-mold
  Show dependency tree
 
Reported: 2024-08-16 12:13 UTC by ernsteiswuerfel
Modified: 2024-09-18 02:46 UTC (History)
4 users (show)

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


Attachments
build.log.xz (amd64, 128.1.0) (firefox-128.1.0:20240816-095608.log.xz,243.35 KB, application/x-xz)
2024-08-16 12:13 UTC, ernsteiswuerfel
Details
emerge --info (file_938009.txt,6.77 KB, text/plain)
2024-08-16 12:16 UTC, ernsteiswuerfel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ernsteiswuerfel archtester 2024-08-16 12:13:46 UTC
Created attachment 900245 [details]
build.log.xz (amd64, 128.1.0)

128.1.0 builds fine with standard linker but fails with mold:

[...]
813:33.23 /usr/lib/llvm/18/bin/x86_64-pc-linux-gnu-clang++-18 -o ../../dist/bin/firefox -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fstack-clash-protection -fno-rtti -pthread -fno-sized-deallocation -fno-aligned-new -ffunction-sections -fdata-sections -fno-math-errno -fno-exceptions -march=znver3 -pipe -fno-exceptions -fPIC -Os -fomit-frame-pointer -funwind-tables -Wl,@/var/tmp/portage/www-client/firefox-128.1.0/work/firefox_build/browser/app/firefox.list   -flto=thin -Wl,-plugin-opt=-import-instr-limit=10 -Wl,-plugin-opt=-import-hot-multiplier=30 -fuse-ld=mold -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs -flto=thin -Wl,--undefined-version -Wl,--compress-debug-sections=zlib -Wl,-rpath=/usr/lib64/firefox,--enable-new-dtags -fuse-ld=mold -Wl,-z,pack-relative-relocs -Wl,--icf=safe -Wl,-z,noexecstack -Wl,-z,text -Wl,-z,relro -Wl,-z,now -Wl,-z,nocopyreloc -fstack-protector-strong -fstack-clash-protection -rdynamic -Wl,-rpath-link,/var/tmp/portage/www-client/firefox-128.1.0/work/firefox_build/dist/bin -Wl,-rpath-link,/usr/lib -O2  ../../build/pure_virtual/libpure_virtual.a -pie  -ldl
813:35.14 ld.mold: /var/tmp/portage/sys-devel/mold-2.33.0/work/mold-2.33.0/elf/output-chunks.cc:1735: mold::elf::ElfSym<E> mold::elf::to_output_esym(Context<E>&, Symbol<E>&, mold::u32, U32<E>*) [with E = X86_64; mold::u32 = unsigned int; U32<E> = mold::Integer<unsigned int, std::endian::little>]: Assertion `!(isec->shdr().sh_flags & SHF_ALLOC)' failed.
813:38.67 x86_64-pc-linux-gnu-clang++-18: error: unable to execute command: Aborted (core dumped)
813:38.67 x86_64-pc-linux-gnu-clang++-18: error: linker command failed due to signal (use -v to see invocation)
813:38.67 gmake[4]: *** [/var/tmp/portage/www-client/firefox-128.1.0/work/firefox-128.1.0/config/rules.mk:422: ../../dist/bin/firefox] Error 1
813:38.67 gmake[4]: Leaving directory '/var/tmp/portage/www-client/firefox-128.1.0/work/firefox_build/browser/app'
813:38.68 gmake[3]: *** [/var/tmp/portage/www-client/firefox-128.1.0/work/firefox-128.1.0/config/recurse.mk:72: browser/app/target] Error 2
813:38.68 gmake[3]: Leaving directory '/var/tmp/portage/www-client/firefox-128.1.0/work/firefox_build'
813:38.68 gmake[2]: *** [/var/tmp/portage/www-client/firefox-128.1.0/work/firefox-128.1.0/config/recurse.mk:34: compile] Error 2
813:38.68 gmake[2]: Leaving directory '/var/tmp/portage/www-client/firefox-128.1.0/work/firefox_build'
813:38.68 gmake[1]: *** [/var/tmp/portage/www-client/firefox-128.1.0/work/firefox-128.1.0/config/rules.mk:361: default] Error 2
813:38.68 gmake[1]: Leaving directory '/var/tmp/portage/www-client/firefox-128.1.0/work/firefox_build'
813:38.68 gmake: *** [client.mk:60: build] Error 2
813:38.68 W 0 compiler warnings present.
8 * ERROR: www-client/firefox-128.1.0::gentoo failed (compile phase):
 *   (no error message)
Comment 1 ernsteiswuerfel archtester 2024-08-16 12:16:00 UTC
Created attachment 900246 [details]
emerge --info

I used mold-2.33.0.

The mold version does not seem to pop up in emerge --info.
Comment 2 Joonas Niilola gentoo-dev 2024-08-16 12:47:28 UTC
I _believe_ there's some sort of a problem with mold and llvm-18. Could you try using llvm-17 toolchain? Although I don't know how it helps to debug the issue other than perhaps allowing you to build Firefox with mold right now.
Comment 3 ernsteiswuerfel archtester 2024-08-16 16:47:43 UTC
(In reply to Joonas Niilola from comment #2)
> I _believe_ there's some sort of a problem with mold and llvm-18.
Seems your assumption is correct.

I didn't switch to llvm-17 toolchain but instead built with USE="-clang". This way firefox builds just fine with GCC + mold.
Comment 4 Steffen Hau 2024-09-16 18:37:48 UTC
https://github.com/rui314/mold/issues/1326
Comment 5 ernsteiswuerfel archtester 2024-09-16 20:01:41 UTC
Thanks for pointing out!

With the patch mentioned at https://github.com/rui314/mold/issues/1326 applied on mold-2.33.0 Firefox builds fine again with mold.
Comment 6 Joonas Niilola gentoo-dev 2024-09-17 07:24:20 UTC
I guess we're waiting for new mold release then.
Comment 7 Larry the Git Cow gentoo-dev 2024-09-18 02:46:10 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1cae6bea37065d9a98ba9dd4c1a4c6be626d086a

commit 1cae6bea37065d9a98ba9dd4c1a4c6be626d086a
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-09-18 02:13:53 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-09-18 02:45:33 +0000

    sys-devel/mold: fix --icf assert
    
    Shows up when building Firefox.
    
    Closes: https://bugs.gentoo.org/938009
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-devel/mold/files/mold-2.33.0-icf.patch |  41 ++++++++++++
 sys-devel/mold/mold-2.33.0-r1.ebuild       | 103 +++++++++++++++++++++++++++++
 2 files changed, 144 insertions(+)

Additionally, it has been referenced in the following commit(s):

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

commit ea3cc27f4c69cb50afd5f6786e6c56d709f48c20
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-09-18 02:16:17 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-09-18 02:45:33 +0000

    sys-devel/mold: control assertions with USE=debug
    
    Still not really sure how we should handle this distro-wide but whatever.
    
    Anyway, the assertions being enabled is how we hit #938009.
    
    Bug: https://bugs.gentoo.org/938009
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-devel/mold/mold-2.33.0-r1.ebuild | 5 ++++-
 sys-devel/mold/mold-9999.ebuild      | 7 +++++--
 2 files changed, 9 insertions(+), 3 deletions(-)