libgo: build 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.
Fixes https://gcc.gnu.org/PR95061
Change-Id: Ib9e464dd6b5550013db676fee758b413fc072db4
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/233897
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
index dea09de..eff0e00 100644
--- a/libgo/Makefile.am
+++ b/libgo/Makefile.am
@@ -967,6 +967,10 @@
# 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)
diff --git a/libgo/Makefile.in b/libgo/Makefile.in
index 607b88c..8726638 100644
--- a/libgo/Makefile.in
+++ b/libgo/Makefile.in
@@ -1104,6 +1104,10 @@
# otherwise we can't get the line numbers.
# 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
extra_go_files_internal_cpu = cpugen.go
extra_go_files_golang_org_x_sys_cpu = gcpugen.go