https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69331
--- Comment #25 from Jakub Jelinek <jakub at gcc dot gnu.org> --- You can have a look e.g. how libgomp/testsuite/lib/*.exp finds -L options it wants to add to find libstdc++ or libgfortran. That said, I think better would be not to add this unconditionally to all libstdc++ tests, but add some dg-add-libatomic-options or similar tcl code that would append it if some test requests it.