Re: Best practice for linking against libatomic?
Florian Weimer via Gcc-help <[email protected]> Tue, 13 Jan 2026 09:59:04 +0100
| Newsgroups | gmane.comp.gcc.help |
|---|---|
| Message-ID | <[email protected]> |
* Simon Richter: > Hi, > > On 1/12/26 11:59 PM, Florian Weimer wrote: > >> It would be interesting to know which functionality needs libatomic. >> What are the linker errors you encountered? > > Missing symbols, the ones in the build logs I have are: > > - __atomic_exchange_1 > - __atomic_fetch_add_2 > - __atomic_compare_exchange_1 > > There are a few weird ones, like > > /usr/bin/ld: /tmp/ccXOVIUZ.ltrans0.ltrans.o: undefined reference to > symbol '__atomic_exchange_1@@LIBATOMIC_1.0' > > so for LTO, there seems to be an error path that can find the version, > but then does not resolve the symbol -- these are fairly seldom > though. I think those call should never happen if you are targeting CPUs with the A extension. If you are not doing that, some parts of the build are misconfigured. Thanks, Florian