On Thu, 24 Sep 2020, Tobias Burnus wrote: > Hi all, > > we got the user comment that it is far from obvious to > use -foffload=-latomic if the following error shows up: > > unresolved symbol __atomic_compare_exchange_16 > collect2: error: ld returned 1 exit status > mkoffload: fatal error: ..../powerpc64le-none-linux-gnu-accel-nvptx-none-gcc > returned 1 exit status > > In principle, the same issue pops up with -lm and -lgfortran, > which on the host are automatically linked for g++ (-lm) and > for gfortran (both) but not gcc.
As discussed in bug 81358, I think --as-needed -latomic --no-as-needed should be used by the driver by default (when the compiler is configured with libatomic supported). The same ought to apply for the offloading libatomic as well: it should be linked in automatically when needed. -- Joseph S. Myers jos...@codesourcery.com