The way the GNU linker deals with static archives is that it only loads objects
from the archive that are needed by *previously seen objects*. That is, in this
case, if libm or libc depend on symbols from libgcc, they might be out of luck.
As it happens, it's common for avr-libc to depend on symbols (specifically, the
deduplicated function prologue/epilogue) from libgcc. The linker, as invoked by
clang currently, fails to link the program in this case because of the argument
In general, libraries should be supplied to the linker in a dependents-then-
However, to more perfectly match GCC's behavior here--and since we don't control
the libraries in question--simply use --start-group and --end-group. These
flags tell the linker to repeatedly search all the intervening libraries until
no new undefined symbol references are created.