Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mold Crash caused by "-Wl,--icf=all" #398

Closed
Chilledheart opened this issue Mar 14, 2022 · 3 comments
Closed

mold Crash caused by "-Wl,--icf=all" #398

Chilledheart opened this issue Mar 14, 2022 · 3 comments

Comments

@Chilledheart
Copy link

I tested mold linker released last week with clang-13 (at apt.llvm.org) with libstdc++ 11 in ubuntu test toolchain under ubuntu bionic. mold crashed with -Wl,--icf=all (tested both of --no-threads and flto=thin, both of them crashed as well, it seems irrelevant). Here is the backtrace of mold.

ko@ubuntu:~/mold$ mold --version
mold 1.1.1 (c1af9c97e763a1d521889191a83b27bd6c43b351; compatible with GNU ld)
ko@ubuntu:~/mold$ gdb mold ~/yass/build-linux-amd64/NATIVE/core.8661
GNU gdb (Ubuntu 8.1.1-0ubuntu1) 8.1.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from mold...done.

warning: core file may not match specified executable file.
[New LWP 8661]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `/usr/local/bin/ld.mold -export-dynamic -z relro --hash-style=gnu --build-id --e'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000000000674ff7 in mold::elf::ObjectFile<mold::elf::X86_64>::compute_symtab(mold::elf::Context<mold::elf::X86_64>&)::{lambda(mold::elf::Symbol<mold::elf::X86_64>&)#1}::operator()(mold::elf::Symbol<mold::elf::X86_64>&) const (sym=..., this=<optimized out>) at /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/atomic_base.h:481
481             return __atomic_load_n(&_M_i, int(__m));
(gdb) bt
#0  0x0000000000674ff7 in mold::elf::ObjectFile<mold::elf::X86_64>::compute_symtab(mold::elf::Context<mold::elf::X86_64>&)::{lambda(mold::elf::Symbol<mold::elf::X86_64>&)#1}::operator()(mold::elf::Symbol<mold::elf::X86_64>&) const (sym=..., this=<optimized out>) at /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/atomic_base.h:481
#1  mold::elf::ObjectFile<mold::elf::X86_64>::compute_symtab (this=0x4e560109980, ctx=...) at elf/input-files.cc:1088
#2  0x00000000004a6cb4 in void mold::elf::create_output_symtab<mold::elf::X86_64>(mold::elf::Context<mold::elf::X86_64>&)::{lambda(mold::elf::ObjectFile<mold::elf::X86_64>*)#1}::operator()(mold::elf::ObjectFile<mold::elf::X86_64>*) const (this=0x4e560108d80, this@entry=0x1, file=0x4e560109980, file@entry=0x7ffc9f8d79a8) at elf/passes.cc:951
#3  tbb::detail::d2::parallel_for_each_operator_selector<void mold::elf::create_output_symtab<mold::elf::X86_64>(mold::elf::Context<mold::elf::X86_64>&)::{lambda(mold::elf::ObjectFile<mold::elf::X86_64>*)#1}>::call<mold::elf::ObjectFile<mold::elf::X86_64>*&, tbb::detail::d2::feeder_impl<{lambda(mold::elf::ObjectFile<mold::elf::X86_64>*)#1}, mold::elf::ObjectFile<mold::elf::X86_64>*> > (body=...,
    item=<error reading variable>) at third-party/tbb/include/tbb/../oneapi/tbb/parallel_for_each.h:95
#4  tbb::detail::d2::parallel_for_body_wrapper<__gnu_cxx::__normal_iterator<mold::elf::ObjectFile<mold::elf::X86_64>**, std::vector<mold::elf::ObjectFile<mold::elf::X86_64>*, std::allocator<mold::elf::ObjectFile<mold::elf::X86_64>*> > >, void mold::elf::create_output_symtab<mold::elf::X86_64>(mold::elf::Context<mold::elf::X86_64>&)::{lambda(mold::elf::ObjectFile<mold::elf::X86_64>*)#1}, mold::elf::ObjectFile<mold::elf::X86_64>*>::operator()(tbb::detail::d1::blocked_range<unsigned long>) const (this=0x4e560153158, range=...) at third-party/tbb/include/tbb/../oneapi/tbb/parallel_for_each.h:400
#5  tbb::detail::d1::start_for<tbb::detail::d1::blocked_range<unsigned long>, tbb::detail::d2::parallel_for_body_wrapper<__gnu_cxx::__normal_iterator<mold::elf::ObjectFile<mold::elf::X86_64>**, std::vector<mold::elf::ObjectFile<mold::elf::X86_64>*, std::allocator<mold::elf::ObjectFile<mold::elf::X86_64>*> > >, void mold::elf::create_output_symtab<mold::elf::X86_64>(mold::elf::Context<mold::elf::X86_64>&)::{lambda(mold::elf::ObjectFile<mold::elf::X86_64>*)#1}, mold::elf::ObjectFile<mold::elf::X86_64>*>, tbb::detail::d1::auto_partitioner const>::run_body(tbb::detail::d1::blocked_range<unsigned long>&) (
    this=0x4e560153100, r=...) at third-party/tbb/include/tbb/../oneapi/tbb/parallel_for.h:119
#6  tbb::detail::d1::dynamic_grainsize_mode<tbb::detail::d1::adaptive_mode<tbb::detail::d1::auto_partition_type> >::work_balance<tbb::detail::d1::start_for<tbb::detail::d1::blocked_range<unsigned long>, tbb::detail::d2::parallel_for_body_wrapper<__gnu_cxx::__normal_iterator<mold::elf::ObjectFile<mold::elf::X86_64>**, std::vector<mold::elf::ObjectFile<mold::elf::X86_64>*, std::allocator<mold::elf::ObjectFile<mold::elf::X86_64>*> > >, void mold::elf::create_output_symtab<mold::elf::X86_64>(mold::elf::Context<mold::elf::X86_64>&)::{lambda(mold::elf::ObjectFile<mold::elf::X86_64>*)#1}, mold::elf::ObjectFile<mold::elf::X86_64>*>, tbb::detail::d1::auto_partitioner const>, tbb::detail::d1::blocked_range<unsigned long> >(tbb::detail::d1::start_for<tbb::detail::d1::blocked_range<unsigned long>, tbb::detail::d2::parallel_for_body_wrapper<__gnu_cxx::__normal_iterator<mold::elf::ObjectFile<mold::elf::X86_64>**, std::vector<mold::elf::ObjectFile<mold::elf::X86_64>*, std::allocator<mold::elf::ObjectFile<mold::elf::X86_64>*> > >, void mold::elf::create_output_symtab<mold::elf::X86_64>(mold::elf::Context<mold::elf::X86_64>&)::{lambda(mold::elf::ObjectFile<mold::elf::X86_64>*)#1}, mold::elf::ObjectFile<mold::elf::X86_64>*>, tbb::detail::d1::auto_partitioner const>&, tbb::detail::d1::blocked_range<unsigned long>&, tbb::detail::d1::execution_data&) (this=<optimized out>, this@entry=0x4e560153178, start=warning: RTTI symbol not found for class 'tbb::detail::d1::start_for<tbb::detail::d1::blocked_range<unsigned long>, tbb::detail::d2::parallel_for_body_wrapper<__gnu_cxx::__normal_iterator<mold::elf::ObjectFile<mold::elf::X86_64>**, std::vector<mold::elf::ObjectFile<mold::elf::X86_64>*, std::allocator<mold::elf::ObjectFile<mold::elf::X86_64>*> > >, void mold::elf::create_output_symtab<mold::elf::X86_64>(mold::elf::Context<mold::elf::X86_64>&)::{lambda(mold::elf::ObjectFile<mold::elf::X86_64>*)#1}, mold::elf::ObjectFile<mold::elf::X86_64>*>, tbb::detail::d1::auto_partitioner const>'
..., range=...,
    ed=...) at third-party/tbb/include/tbb/../oneapi/tbb/partitioner.h:462
#7  0x00000000004a695b in tbb::detail::d1::partition_type_base<tbb::detail::d1::auto_partition_type>::execute<tbb::detail::d1::start_for<tbb::detail::d1::blocked_range<unsigned long>, tbb::detail::d2::parallel_for_body_wrapper<__gnu_cxx::__normal_iterator<mold::elf::ObjectFile<mold::elf::X86_64>**, std::vector<mold::elf::ObjectFile<mold::elf::X86_64>*, std::allocator<mold::elf::ObjectFile<mold::elf::X86_64>*> > >, void mold::elf::create_output_symtab<mold::elf::X86_64>(mold::elf::Context<mold::elf::X86_64>&)::{lambda(mold::elf::ObjectFile<mold::elf::X86_64>*)#1}, mold::elf::ObjectFile<mold::elf::X86_64>*>, tbb::detail::d1::auto_partitioner const>, tbb::detail::d1::blocked_range<unsigned long> >(tbb::detail::d1::start_for<tbb::detail::d1::blocked_range<unsigned long>, tbb::detail::d2::parallel_for_body_wrapper<__gnu_cxx::__normal_iterator<mold::elf::ObjectFile<mold::elf::X86_64>**, std::vector<mold::elf::ObjectFile<mold::elf::X86_64>*, std::allocator<mold::elf::ObjectFile<mold::elf::X86_64>*> > >, void mold::elf::create_output_symtab<mold::elf::X86_64>(mold::elf::Context<mold::elf::X86_64>&)::{lambda(mold::elf::ObjectFile<mold::elf::X86_64>*)#1}, mold::elf::ObjectFile<mold::elf::X86_64>*>, tbb::detail::d1::auto_partitioner const>&, tbb::detail::d1::blocked_range<unsigned long>&, tbb::detail::d1::execution_data&) (this=this@entry=0x4e560153178, start=warning: RTTI symbol not found for class 'tbb::detail::d1::start_for<tbb::detail::d1::blocked_range<unsigned long>, tbb::detail::d2::parallel_for_body_wrapper<__gnu_cxx::__normal_iterator<mold::elf::ObjectFile<mold::elf::X86_64>**, std::vector<mold::elf::ObjectFile<mold::elf::X86_64>*, std::allocator<mold::elf::ObjectFile<mold::elf::X86_64>*> > >, void mold::elf::create_output_symtab<mold::elf::X86_64>(mold::elf::Context<mold::elf::X86_64>&)::{lambda(mold::elf::ObjectFile<mold::elf::X86_64>*)#1}, mold::elf::ObjectFile<mold::elf::X86_64>*>, tbb::detail::d1::auto_partitioner const>'
..., range=..., ed=...)
    at third-party/tbb/include/tbb/../oneapi/tbb/partitioner.h:288
#8  0x00000000004a6664 in tbb::detail::d1::start_for<tbb::detail::d1::blocked_range<unsigned long>, tbb::detail::d2::parallel_for_body_wrapper<__gnu_cxx::__normal_iterator<mold::elf::ObjectFile<mold::elf::X86_64>**, std::vector<mold::elf::ObjectFile<mold::elf::X86_64>*, std::allocator<mold::elf::ObjectFile<mold::elf::X86_64>*> > >, void mold::elf::create_output_symtab<mold::elf::X86_64>(mold::elf::Context<mold::elf::X86_64>&)::{lambda(mold::elf::ObjectFile<mold::elf::X86_64>*)#1}, mold::elf::ObjectFile<mold::elf::X86_64>*>, tbb::detail::d1::auto_partitioner const>::execute(tbb::detail::d1::execution_data&) (this=0x4e560153100, ed=...) at third-party/tbb/include/tbb/../oneapi/tbb/parallel_for.h:172
#9  0x0000000000726b6b in tbb::detail::r1::task_dispatcher::local_wait_for_all<false, tbb::detail::r1::external_waiter> (this=this@entry=0x4e560140e80, t=0x4e560153100, t@entry=0x4e560154480, waiter=...)
    at /home/ko/mold/third-party/tbb/src/tbb/task_dispatcher.h:322
#10 0x0000000000725b97 in tbb::detail::r1::task_dispatcher::local_wait_for_all<tbb::detail::r1::external_waiter> (this=0x4e560140e80, t=0x4e560154480, waiter=...)
    at /home/ko/mold/third-party/tbb/src/tbb/task_dispatcher.h:463
#11 tbb::detail::r1::task_dispatcher::execute_and_wait (t=t@entry=0x4e560154480, wait_ctx=..., w_ctx=...) at /home/ko/mold/third-party/tbb/src/tbb/task_dispatcher.cpp:168
#12 0x0000000000725adf in tbb::detail::r1::execute_and_wait (t=..., t_ctx=..., wait_ctx=..., w_ctx=...) at /home/ko/mold/third-party/tbb/src/tbb/task_dispatcher.cpp:121
#13 0x00000000004a6565 in tbb::detail::d1::execute_and_wait (t=..., t_ctx=..., wait_ctx=..., w_ctx=...) at third-party/tbb/include/tbb/../oneapi/tbb/detail/_task.h:191
#14 tbb::detail::d1::start_for<tbb::detail::d1::blocked_range<unsigned long>, tbb::detail::d2::parallel_for_body_wrapper<__gnu_cxx::__normal_iterator<mold::elf::ObjectFile<mold::elf::X86_64>**, std::vector<mold::elf::ObjectFile<mold::elf::X86_64>*, std::allocator<mold::elf::ObjectFile<mold::elf::X86_64>*> > >, void mold::elf::create_output_symtab<mold::elf::X86_64>(mold::elf::Context<mold::elf::X86_64>&)::{lambda(mold::elf::ObjectFile<mold::elf::X86_64>*)#1}, mold::elf::ObjectFile<mold::elf::X86_64>*>, tbb::detail::d1::auto_partitioner const>::run(tbb::detail::d1::blocked_range<unsigned long> const&, void mold::elf::create_output_symtab<mold::elf::X86_64>(mold::elf::Context<mold::elf::X86_64>&)::{lambda(mold::elf::ObjectFile<mold::elf::X86_64>*)#1} const&, tbb::detail::d1::auto_partitioner&, tbb::detail::d1::task_group_context&) (context=..., range=..., body=..., partitioner=...) at third-party/tbb/include/tbb/../oneapi/tbb/parallel_for.h:114
#15 tbb::detail::d1::parallel_for<tbb::detail::d1::blocked_range<unsigned long>, tbb::detail::d2::parallel_for_body_wrapper<__gnu_cxx::__normal_iterator<mold::elf::ObjectFile<mold::elf::X86_64>**, std::vector<mold::elf::ObjectFile<mold::elf::X86_64>*, std::allocator<mold::elf::ObjectFile<mold::elf::X86_64>*> > >, void mold::elf::create_output_symtab<mold::elf::X86_64>(mold::elf::Context<mold::elf::X86_64>&)::{lambda(mold::elf::ObjectFile<mold::elf::X86_64>*)#1}, mold::elf::ObjectFile<mold::elf::X86_64>*> >(tbb::detail::d1::blocked_range<unsigned long> const&, tbb::detail::d2::parallel_for_body_wrapper<__gnu_cxx::__normal_iterator<mold::elf::ObjectFile<mold::elf::X86_64>**, std::vector<mold::elf::ObjectFile<mold::elf::X86_64>*, std::allocator<mold::elf::ObjectFile<mold::elf::X86_64>*> > >, void mold::elf::create_output_symtab<mold::elf::X86_64>(mold::elf::Context<mold::elf::X86_64>&)::{lambda(mold::elf::ObjectFile<mold::elf::X86_64>*)#1}, mold::elf::ObjectFile<mold::elf::X86_64>*> const&, tbb::detail::d1::task_group_context&) (context=..., range=..., body=...) at third-party/tbb/include/tbb/../oneapi/tbb/parallel_for.h:271
#16 tbb::detail::d2::for_each_root_task<__gnu_cxx::__normal_iterator<mold::elf::ObjectFile<mold::elf::X86_64>**, std::vector<mold::elf::ObjectFile<mold::elf::X86_64>*, std::allocator<mold::elf::ObjectFile---Type <return> to continue, or q <return> to quit---
<mold::elf::X86_64>*> > >, void mold::elf::create_output_symtab<mold::elf::X86_64>(mold::elf::Context<mold::elf::X86_64>&)::{lambda(mold::elf::ObjectFile<mold::elf::X86_64>*)#1}, mold::elf::ObjectFile<mold::elf::X86_64>*, std::random_access_iterator_tag>::execute(tbb::detail::d1::execution_data&) (this=0x7ffc9f8d7dc0) at third-party/tbb/include/tbb/../oneapi/tbb/parallel_for_each.h:555
#17 0x0000000000726b6b in tbb::detail::r1::task_dispatcher::local_wait_for_all<false, tbb::detail::r1::external_waiter> (this=this@entry=0x4e560140e80, t=t@entry=0x7ffc9f8d7dc0, waiter=...)
    at /home/ko/mold/third-party/tbb/src/tbb/task_dispatcher.h:322
#18 0x0000000000725b97 in tbb::detail::r1::task_dispatcher::local_wait_for_all<tbb::detail::r1::external_waiter> (this=0x4e560140e80, t=0x7ffc9f8d7dc0, waiter=...)
    at /home/ko/mold/third-party/tbb/src/tbb/task_dispatcher.h:463
#19 tbb::detail::r1::task_dispatcher::execute_and_wait (t=t@entry=0x7ffc9f8d7dc0, wait_ctx=..., w_ctx=...) at /home/ko/mold/third-party/tbb/src/tbb/task_dispatcher.cpp:168
#20 0x0000000000725adf in tbb::detail::r1::execute_and_wait (t=..., t_ctx=..., wait_ctx=..., w_ctx=...) at /home/ko/mold/third-party/tbb/src/tbb/task_dispatcher.cpp:121
#21 0x00000000004a6440 in tbb::detail::d1::execute_and_wait (t=warning: RTTI symbol not found for class 'tbb::detail::d2::for_each_root_task<__gnu_cxx::__normal_iterator<mold::elf::ObjectFile<mold::elf::X86_64>**, std::vector<mold::elf::ObjectFile<mold::elf::X86_64>*, std::allocator<mold::elf::ObjectFile<mold::elf::X86_64>*> > >, void mold::elf::create_output_symtab<mold::elf::X86_64>(mold::elf::Context<mold::elf::X86_64>&)::{lambda(mold::elf::ObjectFile<mold::elf::X86_64>*)#1}, mold::elf::ObjectFile<mold::elf::X86_64>*, std::random_access_iterator_tag>'
..., t_ctx=..., wait_ctx=..., w_ctx=...) at third-party/tbb/include/tbb/../oneapi/tbb/detail/_task.h:191
#22 tbb::detail::d2::run_parallel_for_each<__gnu_cxx::__normal_iterator<mold::elf::ObjectFile<mold::elf::X86_64>**, std::vector<mold::elf::ObjectFile<mold::elf::X86_64>*, std::allocator<mold::elf::ObjectFile<mold::elf::X86_64>*> > >, void mold::elf::create_output_symtab<mold::elf::X86_64>(mold::elf::Context<mold::elf::X86_64>&)::{lambda(mold::elf::ObjectFile<mold::elf::X86_64>*)#1}>(__gnu_cxx::__normal_iterator<mold::elf::ObjectFile<mold::elf::X86_64>**, std::vector<mold::elf::ObjectFile<mold::elf::X86_64>*, std::allocator<mold::elf::ObjectFile<mold::elf::X86_64>*> > >, __gnu_cxx::__normal_iterator<mold::elf::ObjectFile<mold::elf::X86_64>**, std::vector<mold::elf::ObjectFile<mold::elf::X86_64>*, std::allocator<mold::elf::ObjectFile<mold::elf::X86_64>*> > >, void mold::elf::create_output_symtab<mold::elf::X86_64>(mold::elf::Context<mold::elf::X86_64>&)::{lambda(mold::elf::ObjectFile<mold::elf::X86_64>*)#1} const&, tbb::detail::d1::task_group_context&) (first=0x4e560100080, last=0x4e5601af380,
    context=..., body=...) at third-party/tbb/include/tbb/../oneapi/tbb/parallel_for_each.h:603
#23 tbb::detail::d2::parallel_for_each<__gnu_cxx::__normal_iterator<mold::elf::ObjectFile<mold::elf::X86_64>**, std::vector<mold::elf::ObjectFile<mold::elf::X86_64>*, std::allocator<mold::elf::ObjectFile<mold::elf::X86_64>*> > >, void mold::elf::create_output_symtab<mold::elf::X86_64>(mold::elf::Context<mold::elf::X86_64>&)::{lambda(mold::elf::ObjectFile<mold::elf::X86_64>*)#1}>(__gnu_cxx::__normal_iterator<mold::elf::ObjectFile<mold::elf::X86_64>**, std::vector<mold::elf::ObjectFile<mold::elf::X86_64>*, std::allocator<mold::elf::ObjectFile<mold::elf::X86_64>*> > >, __gnu_cxx::__normal_iterator<mold::elf::ObjectFile<mold::elf::X86_64>**, std::vector<mold::elf::ObjectFile<mold::elf::X86_64>*, std::allocator<mold::elf::ObjectFile<mold::elf::X86_64>*> > >, void mold::elf::create_output_symtab<mold::elf::X86_64>(mold::elf::Context<mold::elf::X86_64>&)::{lambda(mold::elf::ObjectFile<mold::elf::X86_64>*)#1} const&) (first=0x4e560100080, last=0x4e5601af380, body=...)
    at third-party/tbb/include/tbb/../oneapi/tbb/parallel_for_each.h:635
#24 0x0000000000459010 in tbb::detail::d2::parallel_for_each<std::vector<mold::elf::ObjectFile<mold::elf::X86_64>*, std::allocator<mold::elf::ObjectFile<mold::elf::X86_64>*> >, void mold::elf::create_output_symtab<mold::elf::X86_64>(mold::elf::Context<mold::elf::X86_64>&)::{lambda(mold::elf::ObjectFile<mold::elf::X86_64>*)#1}>(std::vector<mold::elf::ObjectFile<mold::elf::X86_64>*, std::allocator<mold::elf::ObjectFile<mold::elf::X86_64>*> >&, void mold::elf::create_output_symtab<mold::elf::X86_64>(mold::elf::Context<mold::elf::X86_64>&)::{lambda(mold::elf::ObjectFile<mold::elf::X86_64>*)#1} const&) (
    rng=std::vector of length 166, capacity 512 = {...}, body=...) at third-party/tbb/include/tbb/../oneapi/tbb/parallel_for_each.h:641
#25 mold::elf::create_output_symtab<mold::elf::X86_64> (ctx=...) at elf/passes.cc:950
#26 0x000000000057590b in mold::elf::elf_main<mold::elf::X86_64> (argc=<optimized out>, argc@entry=54, argv=argv@entry=0x7ffc9f8d9808) at elf/main.cc:596
#27 0x00000000005739e6 in mold::elf::main (argc=1611700608, argc@entry=54, argv=0x7ffc9f8d8498, argv@entry=0x7ffc9f8d9808) at elf/main.cc:755
#28 0x000000000040e774 in main (argc=54, argv=0x7ffc9f8d9808) at main.cc:46
@rui314
Copy link
Owner

rui314 commented Mar 21, 2022

Thank you for reporting the issue! Did it fail all the time, or did it fail only when building some specific program? What program did you try to build using mold?

@Chilledheart
Copy link
Author

I thought it happens only to my case only, but it didn't. As to the programs, it is a bit complex. It happened to my personal project which relied on several projects, namely abseil-cpp, boringssl, libc++, protobuf, quiche and etc. I didn't take a look on all these projects yet but at least I can confirm this crash happens on boringssl project at least (tested on ssl_test target).
You might follow the below steps to reproduce:

git clone --depth 1 https://github.com/google/boringssl
cd boringssl
export CC=clang
export CXX=clang++
# boringssl is a mix of project contains asm/c/c++, many of them inherited from the legacy project openssl
# minimized cflags/cxxflags to reproduce this issue
export CFLAGS="-fuse-ld=mold -Wl,--icf=all"
export CXXFLAGS="-fuse-ld=mold -Wl,--icf=all"
# silicence unused `-fuse-ld` warning
sed -i 's/-Werror//g' CMakeLists.txt
cmake .
make -j $(nproc) ssl_test

Then you should get a core dump at the linking step.

I think icf is a great feature to reduce output binary (binariess reduced from 3M to 400KB for various cases for my porject). It would be worth to take some time on it.

@Chilledheart
Copy link
Author

And tested without flto=thin option as well, it crashed as well. This flag seems unrelated.
BTW I don't check with gcc yet 'cause I am using a old ubuntu distribution (i.e. trusty. At least mold+libc++ worked pretty well there :-p ).

@rui314 rui314 closed this as completed in ceed69f Apr 3, 2022
Chilledheart pushed a commit to Chilledheart/yass that referenced this issue Aug 9, 2022
the upstream issue is fixed.
rui314/mold#398
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants