Re: Best practice for linking against libatomic?
Mathieu Malaterre via Gcc-help <[email protected]> Mon, 12 Jan 2026 15:48:42 +0100
| Newsgroups | gmane.comp.gcc.help |
|---|---|
| Message-ID | <CA+7wUswOPbwyu0WzH-qGrX0b=GAOoiMX0R6122st4YnAdjXNjg@mail.gmail.com> |
Simon, On Mon, Jan 12, 2026 at 12:11 PM Florian Weimer via Gcc-help <[email protected]> wrote: > > * Simon Richter: > > > Is there a recommended way of handling this for package maintainers, > > or should this really be done at system level (e.g. by hacking the > > specs)? > > GCC 16 will automatically link libatomic as required. For ref: * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81358 > Does RISC-V have default-lock-free atomics in libatomic? Those should > probably be in statically linked libgcc instead, similar to AArch64's > outline atomics. > > In general, programmers should avoid emulated atomics because it's > rarely useful. Automatic fallback to imperfect emulation probably does > more harm than good. This has worked for while in Debian: * https://salsa.debian.org/science-team/tbb/-/blob/master/debian/rules?ref_type=heads#L31-34 I've also written a cmake function to detect only when needed (see hwy/libjxl). 2cts -- Mathieu