libgo: only build syscall test with -static if it works
Test whether -static works, and use it if possible. This time for sure. For PR go/95061 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/234024
This commit is contained in:
parent
29f0e90d99
commit
e478cacb62
@ -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.
|
||||
|
@ -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
|
||||
|
@ -1105,9 +1105,9 @@ runtime_internal_sys_lo_check_GOCFLAGS = -fgo-compiling-runtime
|
||||
# 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
|
||||
# Use -static for the syscall tests if possible, because otherwise when
|
||||
# running as root the re-execs ignore LD_LIBRARY_PATH.
|
||||
@LIBGO_IS_LINUX_TRUE@syscall_check_GOCFLAGS = -static
|
||||
@HAVE_STATIC_LINK_TRUE@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
|
||||
|
48
libgo/configure
vendored
48
libgo/configure
vendored
@ -633,6 +633,8 @@ ac_subst_vars='am__EXEEXT_FALSE
|
||||
am__EXEEXT_TRUE
|
||||
LTLIBOBJS
|
||||
LIBOBJS
|
||||
HAVE_STATIC_LINK_FALSE
|
||||
HAVE_STATIC_LINK_TRUE
|
||||
HAVE_STAT_TIMESPEC_FALSE
|
||||
HAVE_STAT_TIMESPEC_TRUE
|
||||
STRUCT_EPOLL_EVENT_FD_OFFSET
|
||||
@ -11490,7 +11492,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 11493 "configure"
|
||||
#line 11495 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -11596,7 +11598,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 11599 "configure"
|
||||
#line 11601 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -15788,6 +15790,44 @@ $as_echo "#define HAVE_AS_X86_AES 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -static is supported" >&5
|
||||
$as_echo_n "checking whether -static is supported... " >&6; }
|
||||
if ${libgo_cv_ld_static+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
LDFLAGS_hold=$LDFLAGS
|
||||
LDFLAGS="$LDFLAGS -static"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
libgo_cv_ld_static=yes
|
||||
else
|
||||
libgo_cv_ld_static=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LDFLAGS=$LDFLAGS_hold
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_ld_static" >&5
|
||||
$as_echo "$libgo_cv_ld_static" >&6; }
|
||||
if test "$libgo_cv_ld_static" = yes; then
|
||||
HAVE_STATIC_LINK_TRUE=
|
||||
HAVE_STATIC_LINK_FALSE='#'
|
||||
else
|
||||
HAVE_STATIC_LINK_TRUE='#'
|
||||
HAVE_STATIC_LINK_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
cat >confcache <<\_ACEOF
|
||||
# This file is a shell script that caches the results of configure
|
||||
# tests run on this system so they can be shared between configure
|
||||
@ -16108,6 +16148,10 @@ if test -z "${HAVE_STAT_TIMESPEC_TRUE}" && test -z "${HAVE_STAT_TIMESPEC_FALSE}"
|
||||
as_fn_error $? "conditional \"HAVE_STAT_TIMESPEC\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
if test -z "${HAVE_STATIC_LINK_TRUE}" && test -z "${HAVE_STATIC_LINK_FALSE}"; then
|
||||
as_fn_error $? "conditional \"HAVE_STATIC_LINK\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
|
||||
: "${CONFIG_STATUS=./config.status}"
|
||||
ac_write_fail=0
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user