[Bug driver/81358] libatomic not automatically linked with C11 code

joseph at codesourcery dot com gcc-bugzilla@gcc.gnu.org
Mon Jul 10 20:02:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81358

--- Comment #6 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
The design of what's in separate libraries is historical; since it 
probably predates shared libraries, the reason isn't obvious (with shared 
libraries, before --as-needed, it avoided unnecessary runtime 
dependencies).  The conformance documentation for an implementation as a 
whole (compiler plus libraries) would of course specify using -std=c11 
-pedantic -lm -latomic, or whatever.  For a new libc implementation for 
Unix-like systems it would be natural just to use libc.so for everything, 
subject to performance issues from causing everything to be (potentially) 
multithreaded by linking with pthreads functions.  Note e.g. glibc moved 
some clock/timer functions from librt to libc a while back to avoid such 
issues from linking in librt.

The POSIX rules for the c99 utility, which correspond more or less to the 
traditional division into libraries on Unix-like systems, are at: 
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/c99.html


More information about the Gcc-bugs mailing list