Re: libgo patch committed: Build syscall test with -static

2020-05-15 Thread Ian Lance Taylor via Gcc-patches
On Fri, May 15, 2020 at 6:42 AM Rainer Orth  
wrote:
>
> > On Thu, May 14, 2020 at 12:43 PM Rainer Orth
> >  wrote:
> >>
> >> > This libgo patch builds the syscall test with -static.  This avoids
> >> > problems finding libgo.so when running the test as root, which invokes
> >> > the test as a child process in various limited environments.  This
> >> > fixes GCC PR 95061.  Bootstrapped and ran Go tests on
> >> > x86_64-pc-linux-gnu.  Committed to mainline.
> >>
> >> this patch broke the syscall test on Solaris:
> >>
> >> ld: fatal: library -lpthread: not found
> >> ld: fatal: library -lm: not found
> >> ld: fatal: library -lc: not found
> >> ld: fatal: library -lc: not found
> >> collect2: error: ld returned 1 exit status
> >> FAIL: syscall
> >>
> >> There are no static versions of system libraries.
> >
> > Sorry about that.  The issue only arises on GNU/Linux, so committed
> > this patch after testing to at least fix the problem on Solaris.
>
> thanks.  However, during today's Linux/x86_64 bootstrap I see that the
> test fails there and indeed glibc-static isn't installed.

Ah, well.  Committed following to mainline.  This time for sure.

Ian
e210e6a965f65a7ae70e1bd8744e024999172a35
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 4776f78e5fa..bc9c1f07eda 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-cae8d4c388d4cc701c7f8fc221c9f6431760d93a
+bc27341f245a5cc54ac7530d037a609db72b677c
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
index 0bbe54cfe1b..5b1807228ad 100644
--- a/libgo/Makefile.am
+++ b/libgo/Makefile.am
@@ -967,8 +967,8 @@ endif
 # Also use -fno-inline to get better results from the memory profiler.
 runtime_pprof_check_GOCFLAGS = -static-libgo -fno-inline
 
-if LIBGO_IS_LINUX
-# Use -static for the syscall tests, because otherwise when
+if HAVE_STATIC_LINK
+# Use -static for the syscall tests if possible, because otherwise when
 # running as root the re-execs ignore LD_LIBRARY_PATH.
 syscall_check_GOCFLAGS = -static
 endif
diff --git a/libgo/configure.ac b/libgo/configure.ac
index f800d44a0e9..235d867ccda 100644
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -881,6 +881,17 @@ if test "x$libgo_cv_as_x86_aes" = xyes; then
[Define if your assembler supports AES instructions.])
 fi
 
+dnl Test whether the linker supports the -static option.
+AC_CACHE_CHECK([whether -static is supported],
+[libgo_cv_ld_static],
+[LDFLAGS_hold=$LDFLAGS
+LDFLAGS="$LDFLAGS -static"
+AC_LINK_IFELSE([AC_LANG_PROGRAM(,)],
+[libgo_cv_ld_static=yes],
+[libgo_cv_ld_static=no])
+LDFLAGS=$LDFLAGS_hold])
+AM_CONDITIONAL(HAVE_STATIC_LINK, test "$libgo_cv_ld_static" = yes)
+
 AC_CACHE_SAVE
 
 if test ${multilib} = yes; then


Re: libgo patch committed: Build syscall test with -static

2020-05-15 Thread Rainer Orth
Hi Ian,

> On Thu, May 14, 2020 at 12:43 PM Rainer Orth
>  wrote:
>>
>> > This libgo patch builds the syscall test with -static.  This avoids
>> > problems finding libgo.so when running the test as root, which invokes
>> > the test as a child process in various limited environments.  This
>> > fixes GCC PR 95061.  Bootstrapped and ran Go tests on
>> > x86_64-pc-linux-gnu.  Committed to mainline.
>>
>> this patch broke the syscall test on Solaris:
>>
>> ld: fatal: library -lpthread: not found
>> ld: fatal: library -lm: not found
>> ld: fatal: library -lc: not found
>> ld: fatal: library -lc: not found
>> collect2: error: ld returned 1 exit status
>> FAIL: syscall
>>
>> There are no static versions of system libraries.
>
> Sorry about that.  The issue only arises on GNU/Linux, so committed
> this patch after testing to at least fix the problem on Solaris.

thanks.  However, during today's Linux/x86_64 bootstrap I see that the
test fails there and indeed glibc-static isn't installed.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: libgo patch committed: Build syscall test with -static

2020-05-14 Thread Ian Lance Taylor via Gcc-patches
On Thu, May 14, 2020 at 12:43 PM Rainer Orth
 wrote:
>
> > This libgo patch builds the syscall test with -static.  This avoids
> > problems finding libgo.so when running the test as root, which invokes
> > the test as a child process in various limited environments.  This
> > fixes GCC PR 95061.  Bootstrapped and ran Go tests on
> > x86_64-pc-linux-gnu.  Committed to mainline.
>
> this patch broke the syscall test on Solaris:
>
> ld: fatal: library -lpthread: not found
> ld: fatal: library -lm: not found
> ld: fatal: library -lc: not found
> ld: fatal: library -lc: not found
> collect2: error: ld returned 1 exit status
> FAIL: syscall
>
> There are no static versions of system libraries.

Sorry about that.  The issue only arises on GNU/Linux, so committed
this patch after testing to at least fix the problem on Solaris.

Ian
49f993428fa6bc5921a473d4476db81698147519
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index b63bb3bd547..4776f78e5fa 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-93b3d88515db85e203d54f382200b84b56b0ae4c
+cae8d4c388d4cc701c7f8fc221c9f6431760d93a
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
index eff0e00e787..0bbe54cfe1b 100644
--- a/libgo/Makefile.am
+++ b/libgo/Makefile.am
@@ -967,9 +967,11 @@ endif
 # Also use -fno-inline to get better results from the memory profiler.
 runtime_pprof_check_GOCFLAGS = -static-libgo -fno-inline
 
+if LIBGO_IS_LINUX
 # Use -static for the syscall tests, because otherwise when
 # running as root the re-execs ignore LD_LIBRARY_PATH.
 syscall_check_GOCFLAGS = -static
+endif
 
 extra_go_files_runtime_internal_sys = version.go
 runtime/internal/sys.lo.dep: $(extra_go_files_runtime_internal_sys)


Re: libgo patch committed: Build syscall test with -static

2020-05-14 Thread Rainer Orth
Hi Ian,

> This libgo patch builds the syscall test with -static.  This avoids
> problems finding libgo.so when running the test as root, which invokes
> the test as a child process in various limited environments.  This
> fixes GCC PR 95061.  Bootstrapped and ran Go tests on
> x86_64-pc-linux-gnu.  Committed to mainline.

this patch broke the syscall test on Solaris:

ld: fatal: library -lpthread: not found
ld: fatal: library -lm: not found
ld: fatal: library -lc: not found
ld: fatal: library -lc: not found
collect2: error: ld returned 1 exit status
FAIL: syscall

There are no static versions of system libraries.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


libgo patch committed: Build syscall test with -static

2020-05-13 Thread Ian Lance Taylor via Gcc-patches
This libgo patch builds the syscall test with -static.  This avoids
problems finding libgo.so when running the test as root, which invokes
the test as a child process in various limited environments.  This
fixes GCC PR 95061.  Bootstrapped and ran Go tests on
x86_64-pc-linux-gnu.  Committed to mainline.

Ian
0d5d880994660e231f82b7cb1dcfab744158f7e0
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 02f6746cf6b..b63bb3bd547 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-876bdf3df3bb33dbf1414237d84be5da32a48082
+93b3d88515db85e203d54f382200b84b56b0ae4c
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
index dea09de592b..eff0e00e787 100644
--- a/libgo/Makefile.am
+++ b/libgo/Makefile.am
@@ -967,6 +967,10 @@ endif
 # Also use -fno-inline to get better results from the memory profiler.
 runtime_pprof_check_GOCFLAGS = -static-libgo -fno-inline
 
+# Use -static for the syscall tests, because otherwise when
+# running as root the re-execs ignore LD_LIBRARY_PATH.
+syscall_check_GOCFLAGS = -static
+
 extra_go_files_runtime_internal_sys = version.go
 runtime/internal/sys.lo.dep: $(extra_go_files_runtime_internal_sys)