Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 937751 - www-client/firefox-{128.1,129.0} + libcxx-18 + mold: Fails to build by linker error
Summary: www-client/firefox-{128.1,129.0} + libcxx-18 + mold: Fails to build by linker...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal
Assignee: Mozilla Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: systemwide-mold
  Show dependency tree
 
Reported: 2024-08-11 09:25 UTC by mojyack
Modified: 2024-08-17 14:05 UTC (History)
1 user (show)

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


Attachments
libcxx patch (libcxx-remove-noinline.patch,557 bytes, patch)
2024-08-11 09:25 UTC, mojyack
Details | Diff
emerge --info (emerge-info.txt,6.29 KB, text/plain)
2024-08-11 09:27 UTC, mojyack
Details
build.log (build.log.xz,524.54 KB, application/x-xz)
2024-08-17 13:44 UTC, mojyack
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mojyack 2024-08-11 09:25:34 UTC
Created attachment 899831 [details, diff]
libcxx patch

When building firefox on musl system with llvm-18 and mold, linking libxul.so fails with error: mold: error: ../../../xpcom/base/Unified_cpp_xpcom_base0.o:(__llvm_prf_data): std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>::__init_copy_ctor_external(char const*, unsigned long) (.local) refers to a discarded COMDAT section probably due to an ODR violation

The cause seems to a "instrumented/xpcom/base/Unified_cpp_xpcom_base0.o" which has two symbols of "__init_copy_ctor_external".

See 3752 and 3980 below
% llvm-readelf -C -s Unified_cpp_xpcom_base0.o | grep init_copy
  1483: 0000000000000000     0 SECTION LOCAL  DEFAULT   1909 .text._ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE25__init_copy_ctor_externalEPKcm
  3752: 0000000000000000   196 FUNC    WEAK   DEFAULT   1909 std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>::__init_copy_ctor_external(char const*, unsigned long)
  3753: 0000000000000000    48 OBJECT  WEAK   HIDDEN    5201 __profc__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE25__init_copy_ctor_externalEPKcm.1075941064311504419
  3754: 0000000000000000    64 OBJECT  WEAK   HIDDEN    5203 __profd__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE25__init_copy_ctor_externalEPKcm.1075941064311504419
  3979: 0000000000000000     8 OBJECT  WEAK   HIDDEN    5202 __profvp__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE25__init_copy_ctor_externalEPKcm.1075941064311504419
  3980: 0000000000000000   196 FUNC    WEAK   HIDDEN    1909 std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>::__init_copy_ctor_external(char const*, unsigned long) (.local)

It is defined in "/usr/include/c++/v1/string:1965".
I don't know why two symbols were created, but the problem can be avoided by applying the attached "libcxx-remove-noinline.patch" to libcxx.

Other applications that use C++ or Rust build fine, so I think this is a Firefox issue.
Confirmed on AMD64+firefox-128.1, AMD64+firefox-129.0, arm64+firefox-129.0
Comment 1 mojyack 2024-08-11 09:27:32 UTC
Created attachment 899832 [details]
emerge --info
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-08-16 13:56:36 UTC
Please include the build.log too.
Comment 3 mojyack 2024-08-16 23:00:03 UTC
I'm re-building Firefox to get a log.
Comment 4 mojyack 2024-08-16 23:06:23 UTC
I don't know if this is related to this problem, but in fact I could not build firefox even with ld.lld due to the error "undefined symbol rust_eh_personality".
This error did not occur when using ld.mold.
After I finish the ongoing build, I'll try lld again.
Comment 6 Joonas Niilola gentoo-dev 2024-08-17 05:27:23 UTC
(In reply to mojyack from comment #5)
> build.log
> https://drive.google.com/file/d/1AKp7v1sv1zKvvoj_KwS4kPerusyXyKCg
> 
> full dump of /tmp/portage
> https://drive.google.com/file/d/1yd0QCp4na9vK91fu_OMUSpT09VWmZhje

Could you compress those with xz -9 for example and upload here?
Comment 7 mojyack 2024-08-17 13:44:27 UTC
Created attachment 900427 [details]
build.log
Comment 8 mojyack 2024-08-17 14:05:31 UTC
(In reply to mojyack from comment #5)
> build.log
> https://drive.google.com/file/d/1AKp7v1sv1zKvvoj_KwS4kPerusyXyKCg
> 
> full dump of /tmp/portage
> https://drive.google.com/file/d/1yd0QCp4na9vK91fu_OMUSpT09VWmZhje

(recompressed) full dump of /tmp/portage
https://drive.google.com/file/d/1b9OAPKh1hUZXrS9XP9JS4UzhLLY5KE1b