https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106156
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Oh yes, libatomic is needed to compile atomics for riscv. If we are stage2+ then libatomic target library needs to be in library search path and the lto plugin needs to be dependent on libatomic in the top level makefile too.