mold: spurious duplicate symbol error

spurious linker error when linking with libboost_fiber.a. with plain gcc it doesn’t happen.

g++ -Wall -Wextra -g -fPIC -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -fno-omit-frame-pointer -Wno-unused-parameter -march=haswell  -std=c++20 -DHAS_RAWMEMCHR -fdiagnostics-color=always -B/usr/local/libexec/mold -O3 -DNDEBUG  -flto  bunch-of-libs.... 

mold: error: duplicate symbol: /usr/lib/x86_64-linux-gnu/libboost_fiber.a(condition_variable.o): /tmp/ccFj8wOo.ltrans1.ltrans.o: guard variable for boost::fibers::detail::spinlock_ttas::lock()::generator
mold: error: duplicate symbol: /usr/lib/x86_64-linux-gnu/libboost_fiber.a(condition_variable.o): /tmp/ccFj8wOo.ltrans1.ltrans.o: boost::fibers::detail::spinlock_ttas::lock()::generator

mold 1.2.1 (c8d8f86a52084c96e2663d9f692c51e98c04cc2f; compatible with GNU ld)

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 41 (28 by maintainers)

Commits related to this issue

Most upvoted comments

With:

$ mold --version
mold 1.6.0 (997e53472d0d14e5bf74daeb676214730f0301b0; compatible with GNU ld)

And I confirmed everything builds, links, runs and passes tests on our side. Thanks for the quick fix!

Can you try with the above commit?

The HIDDEN visibility doesn’t (and IIUC shouldn’t) affect how symbol conflicts are resolved in this case, so I don’t think it prevented a symbol duplicate error for these symbols.