https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84484
--- Comment #8 from Ian Lance Taylor <ian at airs dot com> --- Odd. In any case, the patch is simple: diff --git a/libgo/configure b/libgo/configure index aba4dc39..1b61c9ba 100755 --- a/libgo/configure +++ b/libgo/configure @@ -14210,6 +14210,9 @@ if test "${libgo_cv_lib_pthread+set}" = set; then : else CFLAGS_hold=$CFLAGS CFLAGS="$CFLAGS -pthread" +if test -n "$LIBATOMIC"; then + CFLAGS="$CFLAGS -L../libatomic/.libs" +fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int i; diff --git a/libgo/configure.ac b/libgo/configure.ac index 1264a1d2..aea47a42 100644 --- a/libgo/configure.ac +++ b/libgo/configure.ac @@ -494,6 +494,9 @@ AC_CACHE_CHECK([whether -pthread is supported], [libgo_cv_lib_pthread], [CFLAGS_hold=$CFLAGS CFLAGS="$CFLAGS -pthread" +if test -n "$LIBATOMIC"; then + CFLAGS="$CFLAGS -L../libatomic/.libs" +fi AC_COMPILE_IFELSE([[int i;]], [libgo_cv_lib_pthread=yes], [libgo_cv_lib_pthread=no])