From 81a73112e3d0b43c240c7c9040c24d68c2739bf3 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Mon, 11 Sep 2023 16:55:24 +0200
Subject: [PATCH] libgo: Consider '--with-build-sysroot=[...]' for target
libraries' build-tree testing (instead of build-time 'CC' etc.) [PR109951]
Similar to commit fb5d27be272b71fb9026224535fc73f125ce3be7
"libgomp: Consider '--with-build-sysroot=[...]' for target libraries' build-tree testing (instead of build-time 'CC' etc.) [PR91884, PR109951]",
this is commit b72813a68c943643a6241418f27aa8b9d4614647
"libgo: fix DejaGNU testsuite compiler when using build sysroot" done
differently, avoiding build-tree testing use of any random gunk that may
appear in build-time 'GOC'.
PR testsuite/109951
libgo/
* configure.ac: 'AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)'.
* Makefile.in: Regenerate.
* configure: Likewise.
* testsuite/Makefile.in: Likewise.
* testsuite/lib/libgo.exp (libgo_init): If
'--with-build-sysroot=[...]' was specified, use it for build-tree
testing.
* testsuite/libgo-test-support.exp.in (GOC_UNDER_TEST): Don't set.
(SYSROOT_CFLAGS_FOR_TARGET): Set.
---
libgo/Makefile.in | 1 +
libgo/configure | 7 +++++--
libgo/configure.ac | 2 ++
libgo/testsuite/Makefile.in | 1 +
libgo/testsuite/lib/libgo.exp | 8 ++++++++
libgo/testsuite/libgo-test-support.exp.in | 2 +-
6 files changed, 18 insertions(+), 3 deletions(-)
@@ -474,6 +474,7 @@ SPLIT_STACK = @SPLIT_STACK@
STRINGOPS_FLAG = @STRINGOPS_FLAG@
STRIP = @STRIP@
STRUCT_EPOLL_EVENT_FD_OFFSET = @STRUCT_EPOLL_EVENT_FD_OFFSET@
+SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
USE_DEJAGNU = @USE_DEJAGNU@
VERSION = @VERSION@
WARN_FLAGS = @WARN_FLAGS@
@@ -633,6 +633,7 @@ ac_subst_vars='am__EXEEXT_FALSE
am__EXEEXT_TRUE
LTLIBOBJS
LIBOBJS
+SYSROOT_CFLAGS_FOR_TARGET
HAVE_STATIC_LINK_FALSE
HAVE_STATIC_LINK_TRUE
HAVE_STAT_TIMESPEC_FALSE
@@ -11544,7 +11545,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11547 "configure"
+#line 11548 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11650,7 +11651,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11653 "configure"
+#line 11654 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -16147,6 +16148,8 @@ else
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
@@ -913,6 +913,8 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM(,)],
LDFLAGS=$LDFLAGS_hold])
AM_CONDITIONAL(HAVE_STATIC_LINK, test "$libgo_cv_ld_static" = yes)
+AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)
+
AC_CACHE_SAVE
if test ${multilib} = yes; then
@@ -223,6 +223,7 @@ SPLIT_STACK = @SPLIT_STACK@
STRINGOPS_FLAG = @STRINGOPS_FLAG@
STRIP = @STRIP@
STRUCT_EPOLL_EVENT_FD_OFFSET = @STRUCT_EPOLL_EVENT_FD_OFFSET@
+SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
USE_DEJAGNU = @USE_DEJAGNU@
VERSION = @VERSION@
WARN_FLAGS = @WARN_FLAGS@
@@ -53,5 +53,13 @@ load_gcc_lib timeout.exp
load_gcc_lib go.exp
proc libgo_init { args } {
+ global TESTING_IN_BUILD_TREE
+ if { [info exists TESTING_IN_BUILD_TREE] } {
+ # If '--with-build-sysroot=[...]' was specified, use it for build-tree
+ # testing.
+ global TEST_ALWAYS_FLAGS SYSROOT_CFLAGS_FOR_TARGET
+ set TEST_ALWAYS_FLAGS $SYSROOT_CFLAGS_FOR_TARGET
+ }
+
go_init $args
}
@@ -14,4 +14,4 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-set GOC_UNDER_TEST {@GOC@}
+set SYSROOT_CFLAGS_FOR_TARGET {@SYSROOT_CFLAGS_FOR_TARGET@}
--
2.34.1