libgo patch committed: Add -L option for libatomic when using -pthread

Message ID CAOyqgcWETBzwSYBXExAJCOVSzTHkc=d=YCCA9Mta8juH=7C=iw@mail.gmail.com
State New
Headers show
Series
  • libgo patch committed: Add -L option for libatomic when using -pthread
Related show

Commit Message

Ian Lance Taylor Feb. 22, 2018, 6:49 p.m.
This patch to libgo adds a -L option for libatomic when using
-pthread.  This fixes configure checks for riscv, for which -pthread
implies -latomic.  This fixes GCC PR 84484.  Bootstrapped and ran Go
testsuite on x86_64-pc-linux-gnu.  Committed to mainline.

Ian

Patch

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 257848)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@ 
-c6e0970f75508e209a10a7db5164d6ea3f9b28bf
+b4d61f028dd1623142df4130b6c660bb77474b7b
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: libgo/configure.ac
===================================================================
--- libgo/configure.ac	(revision 257527)
+++ libgo/configure.ac	(working copy)
@@ -493,14 +493,15 @@  dnl Test whether the compiler supports t
 AC_CACHE_CHECK([whether -pthread is supported],
 [libgo_cv_lib_pthread],
 [CFLAGS_hold=$CFLAGS
-CFLAGS="$CFLAGS -pthread"
+CFLAGS="$CFLAGS -pthread -L../libatomic/.libs"
 AC_COMPILE_IFELSE([[int i;]],
 [libgo_cv_lib_pthread=yes],
 [libgo_cv_lib_pthread=no])
 CFLAGS=$CFLAGS_hold])
 PTHREAD_CFLAGS=
 if test "$libgo_cv_lib_pthread" = yes; then
-  PTHREAD_CFLAGS=-pthread
+  # RISC-V apparently adds -latomic when using -pthread.
+  PTHREAD_CFLAGS="-pthread -L../libatomic/.libs"
 fi
 AC_SUBST(PTHREAD_CFLAGS)