[Bug go/84484] libgo configure tests fail to find -latomic

2018-02-22 Thread ian at airs dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84484

Ian Lance Taylor  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #18 from Ian Lance Taylor  ---
Thanks for the patch.  I committed it.

[Bug go/84484] libgo configure tests fail to find -latomic

2018-02-22 Thread ian at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84484

--- Comment #17 from ian at gcc dot gnu.org  ---
Author: ian
Date: Thu Feb 22 19:49:04 2018
New Revision: 257914

URL: https://gcc.gnu.org/viewcvs?rev=257914=gcc=rev
Log:
PR go/84484
libgo: add support for riscv64

Patch by Andreas Schwab.

Reviewed-on: https://go-review.googlesource.com/96377

* go.test/go-test.exp (go-set-goarch): Recognize riscv64-*-*.

Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/go.test/go-test.exp
trunk/libgo/configure
trunk/libgo/configure.ac
trunk/libgo/go/cmd/cgo/main.go
trunk/libgo/go/go/build/syslist.go
trunk/libgo/go/internal/syscall/unix/getrandom_linux_generic.go
trunk/libgo/go/runtime/hash64.go
trunk/libgo/go/runtime/lfstack_64bit.go
trunk/libgo/go/runtime/unaligned1.go
trunk/libgo/go/syscall/endian_little.go
trunk/libgo/go/syscall/libcall_linux_ustat.go
trunk/libgo/goarch.sh
trunk/libgo/match.sh
trunk/libgo/misc/cgo/testcshared/src/libgo2/dup2.go
trunk/libgo/misc/cgo/testcshared/src/libgo2/dup3.go
trunk/libgo/testsuite/gotest

[Bug go/84484] libgo configure tests fail to find -latomic

2018-02-21 Thread sch...@linux-m68k.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84484

--- Comment #16 from Andreas Schwab  ---
Created attachment 43484
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43484=edit
libgo support for riscv64

With this patch I can sucessfully build libgo for riscv64.

[Bug go/84484] libgo configure tests fail to find -latomic

2018-02-21 Thread ian at airs dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84484

--- Comment #15 from Ian Lance Taylor  ---
> The first hunk is useless since this is a compile test.

Understood, but I would prefer to test the exact options that the build is
going to use.

[Bug go/84484] libgo configure tests fail to find -latomic

2018-02-21 Thread sch...@linux-m68k.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84484

--- Comment #14 from Andreas Schwab  ---
See gcc/config/riscv/linux.h for why it does that.

[Bug go/84484] libgo configure tests fail to find -latomic

2018-02-21 Thread sch...@linux-m68k.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84484

--- Comment #13 from Andreas Schwab  ---
The first hunk is useless since this is a compile test.

[Bug go/84484] libgo configure tests fail to find -latomic

2018-02-21 Thread ian at airs dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84484

--- Comment #12 from Ian Lance Taylor  ---
How about this patch?

diff --git a/libgo/configure b/libgo/configure
index aba4dc39..dcfc524b 100755
--- a/libgo/configure
+++ b/libgo/configure
@@ -14209,7 +14209,7 @@ if test "${libgo_cv_lib_pthread+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   CFLAGS_hold=$CFLAGS
-CFLAGS="$CFLAGS -pthread"
+CFLAGS="$CFLAGS -pthread -L../libatomic/.libs"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 int i;
@@ -14226,7 +14226,8 @@ fi
 $as_echo "$libgo_cv_lib_pthread" >&6; }
 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


diff --git a/libgo/configure.ac b/libgo/configure.ac
index 1264a1d2..1f49aee9 100644
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -493,14 +493,15 @@ dnl Test whether the compiler supports the -pthread
option.
 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)

[Bug go/84484] libgo configure tests fail to find -latomic

2018-02-21 Thread sch...@linux-m68k.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84484

--- Comment #11 from Andreas Schwab  ---
See comment #0.

[Bug go/84484] libgo configure tests fail to find -latomic

2018-02-21 Thread ian at airs dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84484

--- Comment #10 from Ian Lance Taylor  ---
In what way does it fail?  The final link of libgo is always done against
../libatomic/libatomic.la.

[Bug go/84484] libgo configure tests fail to find -latomic

2018-02-21 Thread sch...@linux-m68k.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84484

--- Comment #9 from Andreas Schwab  ---
That does not work because CFLAGS gets reset after the test.  Only
PTHREAD_CFLAGS survives.

[Bug go/84484] libgo configure tests fail to find -latomic

2018-02-20 Thread wilson at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84484

Jim Wilson  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-02-20
 CC||wilson at gcc dot gnu.org
 Ever confirmed|0   |1

[Bug go/84484] libgo configure tests fail to find -latomic

2018-02-20 Thread ian at airs dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84484

--- Comment #8 from Ian Lance Taylor  ---
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])

[Bug go/84484] libgo configure tests fail to find -latomic

2018-02-20 Thread sch...@linux-m68k.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84484

--- Comment #7 from Andreas Schwab  ---
The patch file link.

[Bug go/84484] libgo configure tests fail to find -latomic

2018-02-20 Thread ian at airs dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84484

--- Comment #6 from Ian Lance Taylor  ---
Give me a hint: what doesn't work?

[Bug go/84484] libgo configure tests fail to find -latomic

2018-02-20 Thread sch...@linux-m68k.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84484

--- Comment #5 from Andreas Schwab  ---
That doesn't work.

[Bug go/84484] libgo configure tests fail to find -latomic

2018-02-20 Thread ian at airs dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84484

--- Comment #4 from Ian Lance Taylor  ---
To get the change from https://golang.org/cl/95436 in the form of a patch,
click on the download link (middle of the screen on the right) then click on
one of the "patch file" links at the bottom of the pop-up window.

[Bug go/84484] libgo configure tests fail to find -latomic

2018-02-20 Thread sch...@linux-m68k.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84484

--- Comment #3 from Andreas Schwab  ---
https://golang.org/cl/95436 doesn't contain any patch.

[Bug go/84484] libgo configure tests fail to find -latomic

2018-02-20 Thread sch...@linux-m68k.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84484

--- Comment #2 from Andreas Schwab  ---

contains a preliminary patch to add support for riscv, you also need

for libffi.

[Bug go/84484] libgo configure tests fail to find -latomic

2018-02-20 Thread ian at airs dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84484

--- Comment #1 from Ian Lance Taylor  ---
Does the patch in https://golang.org/cl/95436 fix the problem?

Note that there will be other problems building libgo for riscv: it will need
to be added to goarch.sh, match.sh, and testsuite/gotest, and a bunch of files
will need build constraints added.