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
- [ELF] Remove the special logic for STB_GNU_UNIQUE We've been treating STB_GNU_UNIQUE symbols as if they were weak. The rationale of doing is this: 1. GCC sometimes creates GNU-unique symbols instead... — committed to rui314/mold by rui314 2 years ago
- [ELF] Handle GNU-unique symbols as if they were weak https://github.com/rui314/mold/issues/524 — committed to rui314/mold by rui314 2 years ago
With:
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
HIDDENvisibility 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.