public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH v3 0/4] Fix library testsuite compilation for build sysroot
@ 2020-02-28  1:17 Maciej W. Rozycki
  2020-02-28  1:18 ` [PATCH v3 1/4] libatomic/test: Fix " Maciej W. Rozycki
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Maciej W. Rozycki @ 2020-02-28  1:17 UTC (permalink / raw)
  To: gcc-patches
  Cc: Julian Brown, Tobias Burnus, Jeff Law, Thomas Schwinge,
	Mike Stump, Chung-Lin Tang, Ian Lance Taylor

Hi,

 This is v3 of patch series, originally posted here:

<https://gcc.gnu.org/ml/gcc-patches/2019-11/msg00767.html>
<https://gcc.gnu.org/ml/gcc-patches/2019-11/msg00768.html>
<https://gcc.gnu.org/ml/gcc-patches/2019-11/msg00769.html>
<https://gcc.gnu.org/ml/gcc-patches/2019-11/msg00770.html>

and then reposted as v2 here:

<https://gcc.gnu.org/ml/gcc-patches/2020-02/msg00827.html>
<https://gcc.gnu.org/ml/gcc-patches/2020-02/msg00828.html>
<https://gcc.gnu.org/ml/gcc-patches/2020-02/msg00829.html>
<https://gcc.gnu.org/ml/gcc-patches/2020-02/msg00830.html>

meant to address a problem with the testsuite compiler being set up across 
libatomic, libffi, libgo, libgomp with no correlation whatsoever to the 
target compiler being used in GCC compilation.  Consequently there in no 
arrangement made to set up the compilation sysroot according to the build 
sysroot specified for GCC compilation, causing a catastrophic failure 
across the testsuites affected from the inability to link executables.

 There were concerns raised by Julian and Chung-Lin about the libgomp 
change in v1 where an issue triggered in their standalone test environment 
and the wrong compiler executable was chosen.  To address this issue in v2 
I proposed to use the `--tool_exec' option to `runtest' to choose the 
compiler, however Mike expressed concerns about this approach causing 
troubles where `runtest' is invoked standalone rather than via `make'.

 I have outlined yet another (third) approach in:

<https://gcc.gnu.org/ml/gcc-patches/2020-02/msg00874.html>

and I have since realised that the generated 
`libgomp/testsuite/libgomp-test-support.exp' configuration file is not 
used with the usual automake's mechanism defined to supply cnofiguration 
files to DejaGNU.  Consequently this v3 of the series implements my third 
approach and I am fairly sure (and certainly do hope) it will satisfy 
everyone involved.

 This goes back to v1 for most of the matter and brings back the use of 
GCC_UNDER_TEST (or GOC_UNDER_TEST) supplied via `site.exp' to choose the 
compiler to use for testing.  However for consistency the file to keep 
this setting is in v3 called `*-site-extra.exp' rather than 
`*-test-support.exp'.

 For 1/4 (libatomic) and 2/4 (libffi) this is the only change made 
compared to v1, and v1 series has already been approved by Mike here:

<https://gcc.gnu.org/ml/gcc-patches/2019-12/msg01506.html>

and Jeff here:

<https://gcc.gnu.org/ml/gcc-patches/2020-01/msg01718.html>

These two patches were uncontroversial and the file name change can be 
considered trivial, so I am going to apply v3 of these patches shortly 
unless I hear objections.

 For 3/4 (libgo), where v1 has been already applied, v3 renames 
`libgo-site-extra.exp' to `libgo-test-support.exp' and also brings support 
for the `--tool_exec' option to `runtest', to keep testsuite things 
consistent across top-level target libraries.  I'm leaving it up to Ian to 
decide if he wants things arranged like this in libgo.

 For 4/4 (libgomp) some Makefile infrastructure changes are required along 
the lines of 1/4 and 2/4 to wire in `libgomp-site-extra.exp'; for these I 
request explicit approval before I push them.

 Verified with a cross-compiler configured for the `riscv-linux-gnu' 
target and the `x86_64-linux-gnu' host and using RISC-V/Linux QEMU in the 
user emulation mode as the target board.  Also no change in results with 
`x86_64-linux-gnu' native regression testing.

 See individual change descriptions for details.

 I'm assuming Ian will take care of the 3/4 libgo change; any objections 
about 1/4 and 2/4, and OK to apply 4/4 to the GCC repo?

 Finally, apologies for the confusion my earlier oversight with 
`libgomp/testsuite/libgomp-test-support.exp' wiring may have caused.

  Maciej

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH v3 2/4] libffi/test: Fix compilation for build sysroot
  2020-02-28  1:17 [PATCH v3 0/4] Fix library testsuite compilation for build sysroot Maciej W. Rozycki
  2020-02-28  1:18 ` [PATCH v3 1/4] libatomic/test: Fix " Maciej W. Rozycki
  2020-02-28  1:18 ` [PATCH v3 3/4] libgo/test: Complement compilation fix " Maciej W. Rozycki
@ 2020-02-28  1:18 ` Maciej W. Rozycki
  2020-02-28 11:50   ` H.J. Lu
  2020-02-28  1:19 ` [PATCH v3 4/4] libgomp/test: Remove a build sysroot fix regression Maciej W. Rozycki
  3 siblings, 1 reply; 17+ messages in thread
From: Maciej W. Rozycki @ 2020-02-28  1:18 UTC (permalink / raw)
  To: gcc-patches
  Cc: Julian Brown, Tobias Burnus, Jeff Law, Thomas Schwinge,
	Mike Stump, Chung-Lin Tang, Ian Lance Taylor

Fix a problem with the libffi testsuite using a method to determine the 
compiler to use resulting in the tool being different from one the 
library has been built with, and causing a catastrophic failure from the 
inability to actually choose any compiler at all in a cross-compilation 
configuration.

Address this problem by providing a DejaGNU configuration file defining 
the compiler to use, via the GCC_UNDER_TEST TCL variable, set from $CC 
by autoconf, which will have all the required options set for the target 
compiler to build executables in the environment configured, removing 
failures like:

FAIL: libffi.call/closure_fn0.c -W -Wall -Wno-psabi -O0 (test for excess errors)
Excess errors:
default_target_compile: No compiler to compile with
UNRESOLVED: libffi.call/closure_fn0.c -W -Wall -Wno-psabi -O0 compilation failed to produce executable

and bringing overall test results for the `riscv64-linux-gnu' target 
(here with the `x86_64-linux-gnu' host and RISC-V QEMU in the Linux user 
emulation mode as the target board) from:

		=== libffi Summary ===

# of unexpected failures	708
# of unresolved testcases	708
# of unsupported tests		30

to:

		=== libffi Summary ===

# of expected passes		1934
# of unsupported tests		28

Also respect the TOOL_EXECUTABLE TCL variable for a standalone run via 
`runtest' and remove an unused TOOL_OPTIONS TCL variable instance.

	libffi/
	* configure.ac: Add testsuite/libffi-site-extra.exp to output 
	files.
	* configure: Regenerate.
	* testsuite/libffi-site-extra.exp.in: New file.
	* testsuite/Makefile.am (EXTRA_DEJAGNU_SITE_CONFIG): New 
	variable.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/lib/libffi.exp (libffi-init): Handle GCC_UNDER_TEST.
	(libffi_target_compile): Likewise.
---
Changes from v2:

- Revert to v1.

- Rename testsuite/libffi-test-support.exp.in to 
  testsuite/libffi-site-extra.exp.in.

Changes from v1:

- Remove testsuite/libffi-test-support.exp.in and the associated changes.

- Pass $(CC) via `--tool_exec' in $(AM_RUNTESTFLAGS).
---
 libffi/configure                          |    3 ++-
 libffi/configure.ac                       |    2 +-
 libffi/testsuite/Makefile.am              |    2 ++
 libffi/testsuite/Makefile.in              |    5 ++++-
 libffi/testsuite/lib/libffi.exp           |   16 ++++++++++++++--
 libffi/testsuite/libffi-site-extra.exp.in |    1 +
 6 files changed, 24 insertions(+), 5 deletions(-)

gcc-test-libffi-gcc-under-test.diff
Index: gcc/libffi/configure
===================================================================
--- gcc.orig/libffi/configure
+++ gcc/libffi/configure
@@ -16662,7 +16662,7 @@ ac_config_commands="$ac_config_commands
 ac_config_links="$ac_config_links include/ffitarget.h:src/$TARGETDIR/ffitarget.h"
 
 
-ac_config_files="$ac_config_files include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc"
+ac_config_files="$ac_config_files include/Makefile include/ffi.h Makefile testsuite/Makefile testsuite/libffi-site-extra.exp man/Makefile libffi.pc"
 
 
 cat >confcache <<\_ACEOF
@@ -17829,6 +17829,7 @@ do
     "include/ffi.h") CONFIG_FILES="$CONFIG_FILES include/ffi.h" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
     "testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;;
+    "testsuite/libffi-site-extra.exp") CONFIG_FILES="$CONFIG_FILES testsuite/libffi-site-extra.exp" ;;
     "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;;
     "libffi.pc") CONFIG_FILES="$CONFIG_FILES libffi.pc" ;;
 
Index: gcc/libffi/configure.ac
===================================================================
--- gcc.orig/libffi/configure.ac
+++ gcc/libffi/configure.ac
@@ -377,6 +377,6 @@ test -d src/$TARGETDIR || mkdir src/$TAR
 
 AC_CONFIG_LINKS(include/ffitarget.h:src/$TARGETDIR/ffitarget.h)
 
-AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc)
+AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile testsuite/libffi-site-extra.exp man/Makefile libffi.pc)
 
 AC_OUTPUT
Index: gcc/libffi/testsuite/Makefile.am
===================================================================
--- gcc.orig/libffi/testsuite/Makefile.am
+++ gcc/libffi/testsuite/Makefile.am
@@ -11,6 +11,8 @@ RUNTEST = `if [ -f $(top_srcdir)/../deja
 	       echo $(top_srcdir)/../dejagnu/runtest ; \
 	    else echo runtest; fi`
 
+EXTRA_DEJAGNU_SITE_CONFIG = libffi-site-extra.exp
+
 AM_RUNTESTFLAGS =
 
 CLEANFILES = *.exe core* *.log *.sum
Index: gcc/libffi/testsuite/Makefile.in
===================================================================
--- gcc.orig/libffi/testsuite/Makefile.in
+++ gcc/libffi/testsuite/Makefile.in
@@ -106,7 +106,7 @@ am__configure_deps = $(am__aclocal_m4_de
 DIST_COMMON = $(srcdir)/Makefile.am
 mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/fficonfig.h
-CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_FILES = libffi-site-extra.exp
 CONFIG_CLEAN_VPATH_FILES =
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
@@ -279,6 +279,7 @@ RUNTEST = `if [ -f $(top_srcdir)/../deja
 	       echo $(top_srcdir)/../dejagnu/runtest ; \
 	    else echo runtest; fi`
 
+EXTRA_DEJAGNU_SITE_CONFIG = libffi-site-extra.exp
 CLEANFILES = *.exe core* *.log *.sum
 EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c		\
 libffi.call/cls_align_longdouble_split.c				\
@@ -390,6 +391,8 @@ $(top_srcdir)/configure: @MAINTAINER_MOD
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
+libffi-site-extra.exp: $(top_builddir)/config.status $(srcdir)/libffi-site-extra.exp.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 
 mostlyclean-libtool:
 	-rm -f *.lo
Index: gcc/libffi/testsuite/lib/libffi.exp
===================================================================
--- gcc.orig/libffi/testsuite/lib/libffi.exp
+++ gcc/libffi/testsuite/lib/libffi.exp
@@ -99,7 +99,8 @@ proc libffi-init { args } {
     global blddirffi
     global objdir
     global blddircxx
-    global TOOL_OPTIONS
+    global TOOL_EXECUTABLE
+    global GCC_UNDER_TEST
     global tool
     global libffi_include
     global libffi_link_flags
@@ -123,7 +124,15 @@ proc libffi-init { args } {
     set ld_library_path "."
     append ld_library_path ":${gccdir}"
 
-    set compiler "${gccdir}/xgcc"
+    if ![info exists GCC_UNDER_TEST] then {
+	if [info exists TOOL_EXECUTABLE] {
+	    set GCC_UNDER_TEST $TOOL_EXECUTABLE
+	} else {
+	    set GCC_UNDER_TEST "[find_gcc]"
+	}
+    }
+
+    set compiler [lindex $GCC_UNDER_TEST 0]
     if { [is_remote host] == 0 && [which $compiler] != 0 } {
 	foreach i "[exec $compiler --print-multi-lib]" {
 	    set mldir ""
@@ -175,11 +184,14 @@ proc libffi_target_compile { source dest
     global srcdir
     global blddirffi
     global TOOL_OPTIONS
+    global GCC_UNDER_TEST
     global libffi_link_flags
     global libffi_include
     global target_triplet
 
 
+    lappend options "compiler=$GCC_UNDER_TEST"
+
     if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } {
 	lappend options "libs=${gluefile}"
 	lappend options "ldflags=$wrap_flags"
Index: gcc/libffi/testsuite/libffi-site-extra.exp.in
===================================================================
--- /dev/null
+++ gcc/libffi/testsuite/libffi-site-extra.exp.in
@@ -0,0 +1 @@
+set GCC_UNDER_TEST {@CC@}

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH v3 3/4] libgo/test: Complement compilation fix for build sysroot
  2020-02-28  1:17 [PATCH v3 0/4] Fix library testsuite compilation for build sysroot Maciej W. Rozycki
  2020-02-28  1:18 ` [PATCH v3 1/4] libatomic/test: Fix " Maciej W. Rozycki
@ 2020-02-28  1:18 ` Maciej W. Rozycki
  2020-02-28  1:18 ` [PATCH v3 2/4] libffi/test: Fix compilation " Maciej W. Rozycki
  2020-02-28  1:19 ` [PATCH v3 4/4] libgomp/test: Remove a build sysroot fix regression Maciej W. Rozycki
  3 siblings, 0 replies; 17+ messages in thread
From: Maciej W. Rozycki @ 2020-02-28  1:18 UTC (permalink / raw)
  To: gcc-patches
  Cc: Julian Brown, Tobias Burnus, Jeff Law, Thomas Schwinge,
	Mike Stump, Chung-Lin Tang, Ian Lance Taylor

Complement commit b72813a68c94 ("libgo: fix DejaGNU testsuite compiler 
when using build sysroot") and move testsuite/libgo-test-support.exp.in 
to testsuite/libgo-site-extra.exp.in.  Update testsuite/lib/libgo.exp to 
handle the `--tool_exec' option to `runtest' as with other top-level GCC 
target libraries, by using the TOOL_EXECUTABLE TCL variable.

	libgo/
	* configure.ac: Produce testsuite/libgo-site-extra.exp rather 
	than testsuite/libgo-test-support.exp.
	* configure: Regenerate.
	* testsuite/libgo-test-support.exp.in: Rename file to...
	* testsuite/libgo-site-extra.exp.in: ... this.
	* testsuite/Makefile.am: Use libgo-site-extra.exp rather than 
	libgo-test-support.exp.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/lib/libgo.exp: Handle TOOL_EXECUTABLE.
---
Changes from v2:

- Rename testsuite/libgo-test-support.exp.in to 
  testsuite/libgo-site-extra.exp.in.

Applies on top of v1.
---
 libgo/configure                           |    4 ++--
 libgo/configure.ac                        |    2 +-
 libgo/testsuite/Makefile.am               |    2 +-
 libgo/testsuite/Makefile.in               |    6 +++---
 libgo/testsuite/lib/libgo.exp             |   12 ++++++++----
 libgo/testsuite/libgo-site-extra.exp.in   |   17 +++++++++++++++++
 libgo/testsuite/libgo-test-support.exp.in |   17 -----------------
 7 files changed, 32 insertions(+), 28 deletions(-)

gcc-test-libgo-site-extra.diff
Index: gcc/libgo/configure
===================================================================
--- gcc.orig/libgo/configure
+++ gcc/libgo/configure
@@ -15880,7 +15880,7 @@ else
   multilib_arg=
 fi
 
-ac_config_files="$ac_config_files Makefile testsuite/Makefile testsuite/libgo-test-support.exp"
+ac_config_files="$ac_config_files Makefile testsuite/Makefile testsuite/libgo-site-extra.exp"
 
 
 ac_config_commands="$ac_config_commands default"
@@ -17061,7 +17061,7 @@ do
     "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
     "testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;;
-    "testsuite/libgo-test-support.exp") CONFIG_FILES="$CONFIG_FILES testsuite/libgo-test-support.exp" ;;
+    "testsuite/libgo-site-extra.exp") CONFIG_FILES="$CONFIG_FILES testsuite/libgo-site-extra.exp" ;;
     "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
Index: gcc/libgo/configure.ac
===================================================================
--- gcc.orig/libgo/configure.ac
+++ gcc/libgo/configure.ac
@@ -889,7 +889,7 @@ else
   multilib_arg=
 fi
 
-AC_CONFIG_FILES(Makefile testsuite/Makefile testsuite/libgo-test-support.exp)
+AC_CONFIG_FILES(Makefile testsuite/Makefile testsuite/libgo-site-extra.exp)
 
 AC_CONFIG_COMMANDS([default],
 [if test -n "$CONFIG_FILES"; then
Index: gcc/libgo/testsuite/Makefile.am
===================================================================
--- gcc.orig/libgo/testsuite/Makefile.am
+++ gcc/libgo/testsuite/Makefile.am
@@ -11,7 +11,7 @@ RUNTEST = `if [ -f $(top_srcdir)/../deja
 	       echo $(top_srcdir)/../dejagnu/runtest ; \
 	    else echo runtest; fi`
 
-EXTRA_DEJAGNU_SITE_CONFIG = libgo-test-support.exp
+EXTRA_DEJAGNU_SITE_CONFIG = libgo-site-extra.exp
 
 # When running the tests we set GCC_EXEC_PREFIX to the install tree so that
 # files that have already been installed there will be found.  The -B option
Index: gcc/libgo/testsuite/Makefile.in
===================================================================
--- gcc.orig/libgo/testsuite/Makefile.in
+++ gcc/libgo/testsuite/Makefile.in
@@ -107,7 +107,7 @@ am__configure_deps = $(am__aclocal_m4_de
 DIST_COMMON = $(srcdir)/Makefile.am
 mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES = libgo-test-support.exp
+CONFIG_CLEAN_FILES = libgo-site-extra.exp
 CONFIG_CLEAN_VPATH_FILES =
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
@@ -300,7 +300,7 @@ RUNTEST = `if [ -f $(top_srcdir)/../deja
 	       echo $(top_srcdir)/../dejagnu/runtest ; \
 	    else echo runtest; fi`
 
-EXTRA_DEJAGNU_SITE_CONFIG = libgo-test-support.exp
+EXTRA_DEJAGNU_SITE_CONFIG = libgo-site-extra.exp
 
 # When running the tests we set GCC_EXEC_PREFIX to the install tree so that
 # files that have already been installed there will be found.  The -B option
@@ -340,7 +340,7 @@ $(top_srcdir)/configure: @MAINTAINER_MOD
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
-libgo-test-support.exp: $(top_builddir)/config.status $(srcdir)/libgo-test-support.exp.in
+libgo-site-extra.exp: $(top_builddir)/config.status $(srcdir)/libgo-site-extra.exp.in
 	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 
 mostlyclean-libtool:
Index: gcc/libgo/testsuite/lib/libgo.exp
===================================================================
--- gcc.orig/libgo/testsuite/lib/libgo.exp
+++ gcc/libgo/testsuite/lib/libgo.exp
@@ -17,11 +17,15 @@
 set TESTING_IN_BUILD_TREE 1
 
 if ![info exists GOC_UNDER_TEST] then {
-    set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
-    if {$gccdir != ""} {
-	set gccdir [file dirname $gccdir]
+    if [info exists TOOL_EXECUTABLE] {
+	set GOC_UNDER_TEST $TOOL_EXECUTABLE
+    } else {
+	set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
+	if {$gccdir != ""} {
+	    set gccdir [file dirname $gccdir]
+	}
+	set GOC_UNDER_TEST "$gccdir/gccgo -B$gccdir/"
     }
-    set GOC_UNDER_TEST "$gccdir/gccgo -B$gccdir/"
 }
 
 if [info exists GOTEST_TMPDIR] {
Index: gcc/libgo/testsuite/libgo-site-extra.exp.in
===================================================================
--- /dev/null
+++ gcc/libgo/testsuite/libgo-site-extra.exp.in
@@ -0,0 +1,17 @@
+# Copyright (C) 2019 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+set GOC_UNDER_TEST {@GOC@}
Index: gcc/libgo/testsuite/libgo-test-support.exp.in
===================================================================
--- gcc.orig/libgo/testsuite/libgo-test-support.exp.in
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright (C) 2019 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GCC; see the file COPYING3.  If not see
-# <http://www.gnu.org/licenses/>.
-
-set GOC_UNDER_TEST {@GOC@}

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH v3 1/4] libatomic/test: Fix compilation for build sysroot
  2020-02-28  1:17 [PATCH v3 0/4] Fix library testsuite compilation for build sysroot Maciej W. Rozycki
@ 2020-02-28  1:18 ` Maciej W. Rozycki
  2020-02-28  1:18 ` [PATCH v3 3/4] libgo/test: Complement compilation fix " Maciej W. Rozycki
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 17+ messages in thread
From: Maciej W. Rozycki @ 2020-02-28  1:18 UTC (permalink / raw)
  To: gcc-patches
  Cc: Julian Brown, Tobias Burnus, Jeff Law, Thomas Schwinge,
	Mike Stump, Chung-Lin Tang, Ian Lance Taylor

Fix a problem with the libatomic testsuite using a method to determine 
the compiler to use resulting in the tool being different from one the 
library has been built with, and causing a catastrophic failure from the 
lack of a suitable `--sysroot=' option where the `--with-build-sysroot=' 
configuration option has been used to build the compiler resulting in 
the inability to link executables.

Address this problem by providing a DejaGNU configuration file defining 
the compiler to use, via the GCC_UNDER_TEST TCL variable, set from $CC 
by autoconf, which will have all the required options set for the target 
compiler to build executables in the environment configured, removing 
failures like:

.../bin/riscv64-linux-gnu-ld: cannot find crt1.o: No such file or directory
.../bin/riscv64-linux-gnu-ld: cannot find -lm
collect2: error: ld returned 1 exit status
compiler exited with status 1
FAIL: libatomic.c/atomic-compare-exchange-1.c (test for excess errors)
Excess errors:
.../bin/riscv64-linux-gnu-ld: cannot find crt1.o: No such file or directory
.../bin/riscv64-linux-gnu-ld: cannot find -lm

UNRESOLVED: libatomic.c/atomic-compare-exchange-1.c compilation failed to produce executable

and bringing overall test results for the `riscv64-linux-gnu' target 
(here with the `x86_64-linux-gnu' host and RISC-V QEMU in the Linux user 
emulation mode as the target board) from:

		=== libatomic Summary ===

# of unexpected failures	27
# of unresolved testcases	27

to:

		=== libatomic Summary ===

# of expected passes		54

	libatomic/
	* configure.ac: Add testsuite/libatomic-site-extra.exp to output 
	files.
	* configure: Regenerate.
	* libatomic/testsuite/libatomic-site-extra.exp.in: New file.
	* testsuite/Makefile.am (EXTRA_DEJAGNU_SITE_CONFIG): New 
	variable.
	* testsuite/Makefile.in: Regenerate.
---
Changes from v2:

- Revert to v1.

- Rename testsuite/libatomic-test-support.exp.in to 
  testsuite/libatomic-site-extra.exp.in.

Changes from v1:

- Remove testsuite/libatomic-test-support.exp.in and the associated
  changes.

- Pass $(CC) via `--tool_exec' in $(AM_RUNTESTFLAGS).
---
 libatomic/configure                             |    3 +++
 libatomic/configure.ac                          |    1 +
 libatomic/testsuite/Makefile.am                 |    2 ++
 libatomic/testsuite/Makefile.in                 |    5 ++++-
 libatomic/testsuite/libatomic-site-extra.exp.in |    1 +
 5 files changed, 11 insertions(+), 1 deletion(-)

gcc-test-libatomic-gcc-under-test.diff
Index: gcc/libatomic/configure
===================================================================
--- gcc.orig/libatomic/configure
+++ gcc/libatomic/configure
@@ -15728,6 +15728,8 @@ fi
 
 ac_config_files="$ac_config_files Makefile testsuite/Makefile"
 
+ac_config_files="$ac_config_files testsuite/libatomic-site-extra.exp"
+
 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
@@ -16799,6 +16801,7 @@ do
     "gstdint.h") CONFIG_COMMANDS="$CONFIG_COMMANDS gstdint.h" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
     "testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;;
+    "testsuite/libatomic-site-extra.exp") CONFIG_FILES="$CONFIG_FILES testsuite/libatomic-site-extra.exp" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
Index: gcc/libatomic/configure.ac
===================================================================
--- gcc.orig/libatomic/configure.ac
+++ gcc/libatomic/configure.ac
@@ -288,4 +288,5 @@ else
 fi
 
 AC_CONFIG_FILES(Makefile testsuite/Makefile)
+AC_CONFIG_FILES(testsuite/libatomic-site-extra.exp)
 AC_OUTPUT
Index: gcc/libatomic/testsuite/Makefile.am
===================================================================
--- gcc.orig/libatomic/testsuite/Makefile.am
+++ gcc/libatomic/testsuite/Makefile.am
@@ -11,3 +11,5 @@ EXPECT = $(shell if test -f $(top_buildd
 _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
 	     echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
 RUNTEST = $(_RUNTEST) $(AM_RUNTESTFLAGS)
+
+EXTRA_DEJAGNU_SITE_CONFIG = libatomic-site-extra.exp
Index: gcc/libatomic/testsuite/Makefile.in
===================================================================
--- gcc.orig/libatomic/testsuite/Makefile.in
+++ gcc/libatomic/testsuite/Makefile.in
@@ -109,7 +109,7 @@ am__configure_deps = $(am__aclocal_m4_de
 DIST_COMMON = $(srcdir)/Makefile.am
 mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/auto-config.h
-CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_FILES = libatomic-site-extra.exp
 CONFIG_CLEAN_VPATH_FILES =
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
@@ -278,6 +278,7 @@ _RUNTEST = $(shell if test -f $(top_srcd
 	     echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
 
 RUNTEST = $(_RUNTEST) $(AM_RUNTESTFLAGS)
+EXTRA_DEJAGNU_SITE_CONFIG = libatomic-site-extra.exp
 all: all-am
 
 .SUFFIXES:
@@ -310,6 +311,8 @@ $(top_srcdir)/configure: @MAINTAINER_MOD
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
+libatomic-site-extra.exp: $(top_builddir)/config.status $(srcdir)/libatomic-site-extra.exp.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 
 mostlyclean-libtool:
 	-rm -f *.lo
Index: gcc/libatomic/testsuite/libatomic-site-extra.exp.in
===================================================================
--- /dev/null
+++ gcc/libatomic/testsuite/libatomic-site-extra.exp.in
@@ -0,0 +1 @@
+set GCC_UNDER_TEST {@CC@}

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH v3 4/4] libgomp/test: Remove a build sysroot fix regression
  2020-02-28  1:17 [PATCH v3 0/4] Fix library testsuite compilation for build sysroot Maciej W. Rozycki
                   ` (2 preceding siblings ...)
  2020-02-28  1:18 ` [PATCH v3 2/4] libffi/test: Fix compilation " Maciej W. Rozycki
@ 2020-02-28  1:19 ` Maciej W. Rozycki
  2020-03-25 17:30   ` Chung-Lin Tang
  3 siblings, 1 reply; 17+ messages in thread
From: Maciej W. Rozycki @ 2020-02-28  1:19 UTC (permalink / raw)
  To: gcc-patches
  Cc: Julian Brown, Tobias Burnus, Jeff Law, Thomas Schwinge,
	Mike Stump, Chung-Lin Tang, Ian Lance Taylor

Fix a problem with commit c8e759b4215b ("libgomp/test: Fix compilation 
for build sysroot") that caused a regression in some standalone test 
environments where testsuite/libgomp-test-support.exp is used, but the 
compiler is expected to be determined by `[find_gcc]', and set the 
GCC_UNDER_TEST TCL variable in testsuite/libgomp-site-extra.exp instead.

	libgomp/
	* configure.ac: Add testsuite/libgomp-site-extra.exp to output 
	files.
	* configure: Regenerate.
	* testsuite/libgomp-site-extra.exp.in: New file.
	* testsuite/libgomp-test-support.exp.in (GCC_UNDER_TEST): Remove 
	variable.
	* testsuite/Makefile.am (EXTRA_DEJAGNU_SITE_CONFIG): New
	variable.
	* testsuite/Makefile.in: Regenerate.
---
Changes from v2:

- Do not use `--tool_exec' with AM_RUNTESTFLAGS.

- Move the definition of GCC_UNDER_TEST from 
  testsuite/libgomp-test-support.exp to 
  testsuite/libgomp-site-extra.exp.

Applies on top of v1.
---
 libgomp/configure                             |    3 +++
 libgomp/configure.ac                          |    1 +
 libgomp/testsuite/Makefile.am                 |    2 ++
 libgomp/testsuite/Makefile.in                 |    6 +++++-
 libgomp/testsuite/libgomp-site-extra.exp.in   |    1 +
 libgomp/testsuite/libgomp-test-support.exp.in |    2 --
 6 files changed, 12 insertions(+), 3 deletions(-)

gcc-test-libgomp-site-extra.diff
Index: gcc/libgomp/configure
===================================================================
--- gcc.orig/libgomp/configure
+++ gcc/libgomp/configure
@@ -17047,6 +17047,8 @@ ac_config_files="$ac_config_files Makefi
 
 ac_config_files="$ac_config_files testsuite/libgomp-test-support.pt.exp:testsuite/libgomp-test-support.exp.in"
 
+ac_config_files="$ac_config_files testsuite/libgomp-site-extra.exp"
+
 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
@@ -18200,6 +18202,7 @@ do
     "testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;;
     "libgomp.spec") CONFIG_FILES="$CONFIG_FILES libgomp.spec" ;;
     "testsuite/libgomp-test-support.pt.exp") CONFIG_FILES="$CONFIG_FILES testsuite/libgomp-test-support.pt.exp:testsuite/libgomp-test-support.exp.in" ;;
+    "testsuite/libgomp-site-extra.exp") CONFIG_FILES="$CONFIG_FILES testsuite/libgomp-site-extra.exp" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
Index: gcc/libgomp/configure.ac
===================================================================
--- gcc.orig/libgomp/configure.ac
+++ gcc/libgomp/configure.ac
@@ -436,4 +436,5 @@ GCC_BASE_VER
 AC_CONFIG_FILES(omp.h omp_lib.h omp_lib.f90 libgomp_f.h)
 AC_CONFIG_FILES(Makefile testsuite/Makefile libgomp.spec)
 AC_CONFIG_FILES([testsuite/libgomp-test-support.pt.exp:testsuite/libgomp-test-support.exp.in])
+AC_CONFIG_FILES([testsuite/libgomp-site-extra.exp])
 AC_OUTPUT
Index: gcc/libgomp/testsuite/Makefile.am
===================================================================
--- gcc.orig/libgomp/testsuite/Makefile.am
+++ gcc/libgomp/testsuite/Makefile.am
@@ -12,6 +12,8 @@ _RUNTEST = $(shell if test -f $(top_srcd
 	     echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
 RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
 
+EXTRA_DEJAGNU_SITE_CONFIG = libgomp-site-extra.exp
+
 # Instead of directly in ../testsuite/libgomp-test-support.exp.in, the
 # following variables have to be "routed through" this Makefile, for expansion
 # of the several (Makefile) variables used therein.
Index: gcc/libgomp/testsuite/Makefile.in
===================================================================
--- gcc.orig/libgomp/testsuite/Makefile.in
+++ gcc/libgomp/testsuite/Makefile.in
@@ -111,7 +111,8 @@ am__configure_deps = $(am__aclocal_m4_de
 DIST_COMMON = $(srcdir)/Makefile.am
 mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES = libgomp-test-support.pt.exp
+CONFIG_CLEAN_FILES = libgomp-test-support.pt.exp \
+	libgomp-site-extra.exp
 CONFIG_CLEAN_VPATH_FILES =
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
@@ -310,6 +311,7 @@ _RUNTEST = $(shell if test -f $(top_srcd
 	     echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
 
 RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
+EXTRA_DEJAGNU_SITE_CONFIG = libgomp-site-extra.exp
 all: all-am
 
 .SUFFIXES:
@@ -344,6 +346,8 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(
 $(am__aclocal_m4_deps):
 libgomp-test-support.pt.exp: $(top_builddir)/config.status $(srcdir)/libgomp-test-support.exp.in
 	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+libgomp-site-extra.exp: $(top_builddir)/config.status $(srcdir)/libgomp-site-extra.exp.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 
 mostlyclean-libtool:
 	-rm -f *.lo
Index: gcc/libgomp/testsuite/libgomp-site-extra.exp.in
===================================================================
--- /dev/null
+++ gcc/libgomp/testsuite/libgomp-site-extra.exp.in
@@ -0,0 +1 @@
+set GCC_UNDER_TEST {@CC@}
Index: gcc/libgomp/testsuite/libgomp-test-support.exp.in
===================================================================
--- gcc.orig/libgomp/testsuite/libgomp-test-support.exp.in
+++ gcc/libgomp/testsuite/libgomp-test-support.exp.in
@@ -1,5 +1,3 @@
-set GCC_UNDER_TEST {@CC@}
-
 set cuda_driver_include "@CUDA_DRIVER_INCLUDE@"
 set cuda_driver_lib "@CUDA_DRIVER_LIB@"
 set hsa_runtime_lib "@HSA_RUNTIME_LIB@"

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 2/4] libffi/test: Fix compilation for build sysroot
  2020-02-28  1:18 ` [PATCH v3 2/4] libffi/test: Fix compilation " Maciej W. Rozycki
@ 2020-02-28 11:50   ` H.J. Lu
  2020-02-28 13:44     ` Maciej W. Rozycki
  0 siblings, 1 reply; 17+ messages in thread
From: H.J. Lu @ 2020-02-28 11:50 UTC (permalink / raw)
  To: Maciej W. Rozycki
  Cc: GCC Patches, Julian Brown, Tobias Burnus, Jeff Law,
	Thomas Schwinge, Mike Stump, Chung-Lin Tang, Ian Lance Taylor

On Thu, Feb 27, 2020 at 5:18 PM Maciej W. Rozycki <macro@wdc.com> wrote:
>
> Fix a problem with the libffi testsuite using a method to determine the
> compiler to use resulting in the tool being different from one the
> library has been built with, and causing a catastrophic failure from the
> inability to actually choose any compiler at all in a cross-compilation
> configuration.
>
> Address this problem by providing a DejaGNU configuration file defining
> the compiler to use, via the GCC_UNDER_TEST TCL variable, set from $CC
> by autoconf, which will have all the required options set for the target
> compiler to build executables in the environment configured, removing
> failures like:
>
> FAIL: libffi.call/closure_fn0.c -W -Wall -Wno-psabi -O0 (test for excess errors)
> Excess errors:
> default_target_compile: No compiler to compile with
> UNRESOLVED: libffi.call/closure_fn0.c -W -Wall -Wno-psabi -O0 compilation failed to produce executable
>
> and bringing overall test results for the `riscv64-linux-gnu' target
> (here with the `x86_64-linux-gnu' host and RISC-V QEMU in the Linux user
> emulation mode as the target board) from:
>
>                 === libffi Summary ===
>
> # of unexpected failures        708
> # of unresolved testcases       708
> # of unsupported tests          30
>
> to:
>
>                 === libffi Summary ===
>
> # of expected passes            1934
> # of unsupported tests          28
>
> Also respect the TOOL_EXECUTABLE TCL variable for a standalone run via
> `runtest' and remove an unused TOOL_OPTIONS TCL variable instance.
>
>         libffi/
>         * configure.ac: Add testsuite/libffi-site-extra.exp to output
>         files.
>         * configure: Regenerate.
>         * testsuite/libffi-site-extra.exp.in: New file.
>         * testsuite/Makefile.am (EXTRA_DEJAGNU_SITE_CONFIG): New
>         variable.
>         * testsuite/Makefile.in: Regenerate.
>         * testsuite/lib/libffi.exp (libffi-init): Handle GCC_UNDER_TEST.
>         (libffi_target_compile): Likewise.

Upstream libffi has local.exp.  Is that possible to use the same file?


-- 
H.J.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 2/4] libffi/test: Fix compilation for build sysroot
  2020-02-28 11:50   ` H.J. Lu
@ 2020-02-28 13:44     ` Maciej W. Rozycki
  2020-02-28 13:55       ` H.J. Lu
  0 siblings, 1 reply; 17+ messages in thread
From: Maciej W. Rozycki @ 2020-02-28 13:44 UTC (permalink / raw)
  To: H.J. Lu
  Cc: GCC Patches, Julian Brown, Tobias Burnus, Jeff Law,
	Thomas Schwinge, Mike Stump, Chung-Lin Tang, Ian Lance Taylor

On Fri, 28 Feb 2020, H.J. Lu wrote:

> >         libffi/
> >         * configure.ac: Add testsuite/libffi-site-extra.exp to output
> >         files.
> >         * configure: Regenerate.
> >         * testsuite/libffi-site-extra.exp.in: New file.
> >         * testsuite/Makefile.am (EXTRA_DEJAGNU_SITE_CONFIG): New
> >         variable.
> >         * testsuite/Makefile.in: Regenerate.
> >         * testsuite/lib/libffi.exp (libffi-init): Handle GCC_UNDER_TEST.
> >         (libffi_target_compile): Likewise.
> 
> Upstream libffi has local.exp.  Is that possible to use the same file?

 Thanks for the suggestion; I didn't realise we are so out of date WRT the 
upstream version.

 I find the way local.exp has been wired in rather hackish as it makes the 
template buried in `configure.ac' and also it requires running `autoconf' 
whenever there is a need to change it.

 However that hack has been actually made to address this very problem 
discussed with this submission, so why not simply sync our copy of libffi 
with the upstream version?  Then we can decide if changing the hack into 
something cleaner is worth the hassle.

  Maciej

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 2/4] libffi/test: Fix compilation for build sysroot
  2020-02-28 13:44     ` Maciej W. Rozycki
@ 2020-02-28 13:55       ` H.J. Lu
  2020-02-28 21:23         ` Jeff Law
  0 siblings, 1 reply; 17+ messages in thread
From: H.J. Lu @ 2020-02-28 13:55 UTC (permalink / raw)
  To: Maciej W. Rozycki
  Cc: GCC Patches, Julian Brown, Tobias Burnus, Jeff Law,
	Thomas Schwinge, Mike Stump, Chung-Lin Tang, Ian Lance Taylor

On Fri, Feb 28, 2020 at 5:44 AM Maciej W. Rozycki <macro@wdc.com> wrote:
>
> On Fri, 28 Feb 2020, H.J. Lu wrote:
>
> > >         libffi/
> > >         * configure.ac: Add testsuite/libffi-site-extra.exp to output
> > >         files.
> > >         * configure: Regenerate.
> > >         * testsuite/libffi-site-extra.exp.in: New file.
> > >         * testsuite/Makefile.am (EXTRA_DEJAGNU_SITE_CONFIG): New
> > >         variable.
> > >         * testsuite/Makefile.in: Regenerate.
> > >         * testsuite/lib/libffi.exp (libffi-init): Handle GCC_UNDER_TEST.
> > >         (libffi_target_compile): Likewise.
> >
> > Upstream libffi has local.exp.  Is that possible to use the same file?
>
>  Thanks for the suggestion; I didn't realise we are so out of date WRT the
> upstream version.
>
>  I find the way local.exp has been wired in rather hackish as it makes the
> template buried in `configure.ac' and also it requires running `autoconf'
> whenever there is a need to change it.
>
>  However that hack has been actually made to address this very problem
> discussed with this submission, so why not simply sync our copy of libffi
> with the upstream version?  Then we can decide if changing the hack into
> something cleaner is worth the hassle.

I'd love to sync with upstream libffi.  In fact, I have done it on my
users/hjl/cet/master
branch:

https://gitlab.com/x86-gcc/gcc/-/commit/9090e840b8464ce0f684e305eb75ff4655d05deb


-- 
H.J.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 2/4] libffi/test: Fix compilation for build sysroot
  2020-02-28 13:55       ` H.J. Lu
@ 2020-02-28 21:23         ` Jeff Law
  2020-02-28 21:50           ` H.J. Lu
  0 siblings, 1 reply; 17+ messages in thread
From: Jeff Law @ 2020-02-28 21:23 UTC (permalink / raw)
  To: H.J. Lu, Maciej W. Rozycki
  Cc: GCC Patches, Julian Brown, Tobias Burnus, Thomas Schwinge,
	Mike Stump, Chung-Lin Tang, Ian Lance Taylor

On Fri, 2020-02-28 at 05:54 -0800, H.J. Lu wrote:
> On Fri, Feb 28, 2020 at 5:44 AM Maciej W. Rozycki <macro@wdc.com> wrote:
> > On Fri, 28 Feb 2020, H.J. Lu wrote:
> > 
> > > >         libffi/
> > > >         * configure.ac: Add testsuite/libffi-site-extra.exp to output
> > > >         files.
> > > >         * configure: Regenerate.
> > > >         * testsuite/libffi-site-extra.exp.in: New file.
> > > >         * testsuite/Makefile.am (EXTRA_DEJAGNU_SITE_CONFIG): New
> > > >         variable.
> > > >         * testsuite/Makefile.in: Regenerate.
> > > >         * testsuite/lib/libffi.exp (libffi-init): Handle
> > > > GCC_UNDER_TEST.
> > > >         (libffi_target_compile): Likewise.
> > > 
> > > Upstream libffi has local.exp.  Is that possible to use the same file?
> > 
> >  Thanks for the suggestion; I didn't realise we are so out of date WRT the
> > upstream version.
> > 
> >  I find the way local.exp has been wired in rather hackish as it makes the
> > template buried in `configure.ac' and also it requires running `autoconf'
> > whenever there is a need to change it.
> > 
> >  However that hack has been actually made to address this very problem
> > discussed with this submission, so why not simply sync our copy of libffi
> > with the upstream version?  Then we can decide if changing the hack into
> > something cleaner is worth the hassle.
> 
> I'd love to sync with upstream libffi.  In fact, I have done it on my
> users/hjl/cet/master
> branch:
> 
> https://gitlab.com/x86-gcc/gcc/-/commit/9090e840b8464ce0f684e305eb75ff4655d05deb
I think we'd like to update as well, but isn't there an ABI change in libffi
that has to be fixed first?

jeff

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 2/4] libffi/test: Fix compilation for build sysroot
  2020-02-28 21:23         ` Jeff Law
@ 2020-02-28 21:50           ` H.J. Lu
  2020-03-17 21:52             ` Maciej W. Rozycki
  0 siblings, 1 reply; 17+ messages in thread
From: H.J. Lu @ 2020-02-28 21:50 UTC (permalink / raw)
  To: Jeffrey Law
  Cc: Maciej W. Rozycki, GCC Patches, Julian Brown, Tobias Burnus,
	Thomas Schwinge, Mike Stump, Chung-Lin Tang, Ian Lance Taylor

On Fri, Feb 28, 2020 at 1:16 PM Jeff Law <law@redhat.com> wrote:
>
> On Fri, 2020-02-28 at 05:54 -0800, H.J. Lu wrote:
> > On Fri, Feb 28, 2020 at 5:44 AM Maciej W. Rozycki <macro@wdc.com> wrote:
> > > On Fri, 28 Feb 2020, H.J. Lu wrote:
> > >
> > > > >         libffi/
> > > > >         * configure.ac: Add testsuite/libffi-site-extra.exp to output
> > > > >         files.
> > > > >         * configure: Regenerate.
> > > > >         * testsuite/libffi-site-extra.exp.in: New file.
> > > > >         * testsuite/Makefile.am (EXTRA_DEJAGNU_SITE_CONFIG): New
> > > > >         variable.
> > > > >         * testsuite/Makefile.in: Regenerate.
> > > > >         * testsuite/lib/libffi.exp (libffi-init): Handle
> > > > > GCC_UNDER_TEST.
> > > > >         (libffi_target_compile): Likewise.
> > > >
> > > > Upstream libffi has local.exp.  Is that possible to use the same file?
> > >
> > >  Thanks for the suggestion; I didn't realise we are so out of date WRT the
> > > upstream version.
> > >
> > >  I find the way local.exp has been wired in rather hackish as it makes the
> > > template buried in `configure.ac' and also it requires running `autoconf'
> > > whenever there is a need to change it.
> > >
> > >  However that hack has been actually made to address this very problem
> > > discussed with this submission, so why not simply sync our copy of libffi
> > > with the upstream version?  Then we can decide if changing the hack into
> > > something cleaner is worth the hassle.
> >
> > I'd love to sync with upstream libffi.  In fact, I have done it on my
> > users/hjl/cet/master
> > branch:
> >
> > https://gitlab.com/x86-gcc/gcc/-/commit/9090e840b8464ce0f684e305eb75ff4655d05deb
> I think we'd like to update as well, but isn't there an ABI change in libffi
> that has to be fixed first?

Libffi 3.4 ABI was changed to support CET.  But it isn't the first
time ABI change for libffi,

-- 
H.J.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 2/4] libffi/test: Fix compilation for build sysroot
  2020-02-28 21:50           ` H.J. Lu
@ 2020-03-17 21:52             ` Maciej W. Rozycki
  2020-03-24 20:59               ` Mike Stump
  0 siblings, 1 reply; 17+ messages in thread
From: Maciej W. Rozycki @ 2020-03-17 21:52 UTC (permalink / raw)
  To: H.J. Lu
  Cc: Jeffrey Law, GCC Patches, Julian Brown, Tobias Burnus,
	Thomas Schwinge, Mike Stump, Chung-Lin Tang, Ian Lance Taylor

On Fri, 28 Feb 2020, H.J. Lu wrote:

> > > >  However that hack has been actually made to address this very problem
> > > > discussed with this submission, so why not simply sync our copy of libffi
> > > > with the upstream version?  Then we can decide if changing the hack into
> > > > something cleaner is worth the hassle.
> > >
> > > I'd love to sync with upstream libffi.  In fact, I have done it on my
> > > users/hjl/cet/master
> > > branch:
> > >
> > > https://gitlab.com/x86-gcc/gcc/-/commit/9090e840b8464ce0f684e305eb75ff4655d05deb
> > I think we'd like to update as well, but isn't there an ABI change in libffi
> > that has to be fixed first?
> 
> Libffi 3.4 ABI was changed to support CET.  But it isn't the first
> time ABI change for libffi,

 Have we made any conclusions WRT the way to move forward with this stuff?  
Things remain broken and I'd prefer to get the issues off the plate while 
the stuff is hot, or at least mildly warm.  I'm about to get distracted 
with other work.

  Maciej

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 2/4] libffi/test: Fix compilation for build sysroot
  2020-03-17 21:52             ` Maciej W. Rozycki
@ 2020-03-24 20:59               ` Mike Stump
  2020-03-26 22:00                 ` Maciej W. Rozycki
  0 siblings, 1 reply; 17+ messages in thread
From: Mike Stump @ 2020-03-24 20:59 UTC (permalink / raw)
  To: Maciej W. Rozycki
  Cc: H.J. Lu, Jeffrey Law, GCC Patches, Julian Brown, Tobias Burnus,
	Thomas Schwinge, Chung-Lin Tang, Ian Lance Taylor

On Mar 17, 2020, at 2:52 PM, Maciej W. Rozycki <macro@wdc.com> wrote:
> 
> On Fri, 28 Feb 2020, H.J. Lu wrote:
>> 
>> Libffi 3.4 ABI was changed to support CET.  But it isn't the first
>> time ABI change for libffi,
> 
> Have we made any conclusions WRT the way to move forward with this stuff?  
> Things remain broken and I'd prefer to get the issues off the plate while 
> the stuff is hot, or at least mildly warm.  I'm about to get distracted 
> with other work.

It's unfortunate that upstream has anything that prevents it from us just importing it all and calling it done.

Anyway, if you see a path forward for grabbing all the Makefile/config stuff and leaving the abi changing stuff out, and just important that, we can do a partial import.  I say this without reviewing the diffs from upstream and how many there are and what's in them.  I'm hoping things are nicely segregated and reasonably small otherwise.

That could unblock your concerns and you can leave the rest for some else that can play with the abi.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 4/4] libgomp/test: Remove a build sysroot fix regression
  2020-02-28  1:19 ` [PATCH v3 4/4] libgomp/test: Remove a build sysroot fix regression Maciej W. Rozycki
@ 2020-03-25 17:30   ` Chung-Lin Tang
  2020-04-01 12:12     ` Maciej W. Rozycki
  0 siblings, 1 reply; 17+ messages in thread
From: Chung-Lin Tang @ 2020-03-25 17:30 UTC (permalink / raw)
  To: Maciej W. Rozycki, gcc-patches
  Cc: Julian Brown, Tobias Burnus, Jeff Law, Thomas Schwinge,
	Mike Stump, Chung-Lin Tang, Ian Lance Taylor

On 2020/2/28 9:18 AM, Maciej W. Rozycki wrote:
> Fix a problem with commit c8e759b4215b ("libgomp/test: Fix compilation
> for build sysroot") that caused a regression in some standalone test
> environments where testsuite/libgomp-test-support.exp is used, but the
> compiler is expected to be determined by `[find_gcc]', and set the
> GCC_UNDER_TEST TCL variable in testsuite/libgomp-site-extra.exp instead.
> 
> 	libgomp/
> 	* configure.ac: Add testsuite/libgomp-site-extra.exp to output
> 	files.
> 	* configure: Regenerate.
> 	* testsuite/libgomp-site-extra.exp.in: New file.
> 	* testsuite/libgomp-test-support.exp.in (GCC_UNDER_TEST): Remove
> 	variable.
> 	* testsuite/Makefile.am (EXTRA_DEJAGNU_SITE_CONFIG): New
> 	variable.
> 	* testsuite/Makefile.in: Regenerate.
> ---
> Changes from v2:
> 
> - Do not use `--tool_exec' with AM_RUNTESTFLAGS.
> 
> - Move the definition of GCC_UNDER_TEST from
>    testsuite/libgomp-test-support.exp to
>    testsuite/libgomp-site-extra.exp.

Hi Maciej,
sorry, I didn't notice you were blocked on input from us.

I tested our testing with this patch and can confirm it works for us; didn't notice
any breakage.

Chung-Lin

> Applies on top of v1.
> ---
>   libgomp/configure                             |    3 +++
>   libgomp/configure.ac                          |    1 +
>   libgomp/testsuite/Makefile.am                 |    2 ++
>   libgomp/testsuite/Makefile.in                 |    6 +++++-
>   libgomp/testsuite/libgomp-site-extra.exp.in   |    1 +
>   libgomp/testsuite/libgomp-test-support.exp.in |    2 --
>   6 files changed, 12 insertions(+), 3 deletions(-)
> 
> gcc-test-libgomp-site-extra.diff
> Index: gcc/libgomp/configure
> ===================================================================
> --- gcc.orig/libgomp/configure
> +++ gcc/libgomp/configure
> @@ -17047,6 +17047,8 @@ ac_config_files="$ac_config_files Makefi
>   
>   ac_config_files="$ac_config_files testsuite/libgomp-test-support.pt.exp:testsuite/libgomp-test-support.exp.in"
>   
> +ac_config_files="$ac_config_files testsuite/libgomp-site-extra.exp"
> +
>   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
> @@ -18200,6 +18202,7 @@ do
>       "testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;;
>       "libgomp.spec") CONFIG_FILES="$CONFIG_FILES libgomp.spec" ;;
>       "testsuite/libgomp-test-support.pt.exp") CONFIG_FILES="$CONFIG_FILES testsuite/libgomp-test-support.pt.exp:testsuite/libgomp-test-support.exp.in" ;;
> +    "testsuite/libgomp-site-extra.exp") CONFIG_FILES="$CONFIG_FILES testsuite/libgomp-site-extra.exp" ;;
>   
>     *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
>     esac
> Index: gcc/libgomp/configure.ac
> ===================================================================
> --- gcc.orig/libgomp/configure.ac
> +++ gcc/libgomp/configure.ac
> @@ -436,4 +436,5 @@ GCC_BASE_VER
>   AC_CONFIG_FILES(omp.h omp_lib.h omp_lib.f90 libgomp_f.h)
>   AC_CONFIG_FILES(Makefile testsuite/Makefile libgomp.spec)
>   AC_CONFIG_FILES([testsuite/libgomp-test-support.pt.exp:testsuite/libgomp-test-support.exp.in])
> +AC_CONFIG_FILES([testsuite/libgomp-site-extra.exp])
>   AC_OUTPUT
> Index: gcc/libgomp/testsuite/Makefile.am
> ===================================================================
> --- gcc.orig/libgomp/testsuite/Makefile.am
> +++ gcc/libgomp/testsuite/Makefile.am
> @@ -12,6 +12,8 @@ _RUNTEST = $(shell if test -f $(top_srcd
>   	     echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
>   RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
>   
> +EXTRA_DEJAGNU_SITE_CONFIG = libgomp-site-extra.exp
> +
>   # Instead of directly in ../testsuite/libgomp-test-support.exp.in, the
>   # following variables have to be "routed through" this Makefile, for expansion
>   # of the several (Makefile) variables used therein.
> Index: gcc/libgomp/testsuite/Makefile.in
> ===================================================================
> --- gcc.orig/libgomp/testsuite/Makefile.in
> +++ gcc/libgomp/testsuite/Makefile.in
> @@ -111,7 +111,8 @@ am__configure_deps = $(am__aclocal_m4_de
>   DIST_COMMON = $(srcdir)/Makefile.am
>   mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
>   CONFIG_HEADER = $(top_builddir)/config.h
> -CONFIG_CLEAN_FILES = libgomp-test-support.pt.exp
> +CONFIG_CLEAN_FILES = libgomp-test-support.pt.exp \
> +	libgomp-site-extra.exp
>   CONFIG_CLEAN_VPATH_FILES =
>   AM_V_P = $(am__v_P_@AM_V@)
>   am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
> @@ -310,6 +311,7 @@ _RUNTEST = $(shell if test -f $(top_srcd
>   	     echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
>   
>   RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
> +EXTRA_DEJAGNU_SITE_CONFIG = libgomp-site-extra.exp
>   all: all-am
>   
>   .SUFFIXES:
> @@ -344,6 +346,8 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(
>   $(am__aclocal_m4_deps):
>   libgomp-test-support.pt.exp: $(top_builddir)/config.status $(srcdir)/libgomp-test-support.exp.in
>   	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
> +libgomp-site-extra.exp: $(top_builddir)/config.status $(srcdir)/libgomp-site-extra.exp.in
> +	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
>   
>   mostlyclean-libtool:
>   	-rm -f *.lo
> Index: gcc/libgomp/testsuite/libgomp-site-extra.exp.in
> ===================================================================
> --- /dev/null
> +++ gcc/libgomp/testsuite/libgomp-site-extra.exp.in
> @@ -0,0 +1 @@
> +set GCC_UNDER_TEST {@CC@}
> Index: gcc/libgomp/testsuite/libgomp-test-support.exp.in
> ===================================================================
> --- gcc.orig/libgomp/testsuite/libgomp-test-support.exp.in
> +++ gcc/libgomp/testsuite/libgomp-test-support.exp.in
> @@ -1,5 +1,3 @@
> -set GCC_UNDER_TEST {@CC@}
> -
>   set cuda_driver_include "@CUDA_DRIVER_INCLUDE@"
>   set cuda_driver_lib "@CUDA_DRIVER_LIB@"
>   set hsa_runtime_lib "@HSA_RUNTIME_LIB@"
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 2/4] libffi/test: Fix compilation for build sysroot
  2020-03-24 20:59               ` Mike Stump
@ 2020-03-26 22:00                 ` Maciej W. Rozycki
  2020-03-30 18:45                   ` Mike Stump
  0 siblings, 1 reply; 17+ messages in thread
From: Maciej W. Rozycki @ 2020-03-26 22:00 UTC (permalink / raw)
  To: Mike Stump
  Cc: H.J. Lu, Jeffrey Law, GCC Patches, Julian Brown, Tobias Burnus,
	Thomas Schwinge, Chung-Lin Tang, Ian Lance Taylor,
	libffi-discuss

On Tue, 24 Mar 2020, Mike Stump wrote:

> > Have we made any conclusions WRT the way to move forward with this stuff?  
> > Things remain broken and I'd prefer to get the issues off the plate while 
> > the stuff is hot, or at least mildly warm.  I'm about to get distracted 
> > with other work.
> 
> It's unfortunate that upstream has anything that prevents it from us 
> just importing it all and calling it done.
> 
> Anyway, if you see a path forward for grabbing all the Makefile/config 
> stuff and leaving the abi changing stuff out, and just important that, 
> we can do a partial import.  I say this without reviewing the diffs from 
> upstream and how many there are and what's in them.  I'm hoping things 
> are nicely segregated and reasonably small otherwise.

 Thank you for your input.

 I have actually considered extracting the bits already, but I hesitated 
putting that forward that as having looked at the part that we require I 
have thought it to be very messy: the .exp file is handcrafted with an 
inline piece of scriptery buried in `configure.ac' and never cleaned, not 
even with `make distclean', nor equipped with any Makefile dependencies.  
Clearly it must have been written by someone who hasn't been accustomed to 
working with GNU autotools.

 The ultimate change is very small, but it has only been created gradually 
with four commits in the upstream libffi repository, none of which applies
cleanly to ours and most of which include unrelated stuff.  They are:

- commit 8308984e479e ("[PATCH] Make sure we're running dejagnu tests with 
  the right compiler."),

- commit 2d9b3939751b ("[PATCH] Fix for closures with sunpro compiler"),

- commit 0c3824702d3d ("[PATCH] Always set CC_FOR_TARGET for dejagnu, to 
  make the testsuite respect $CC"),

- commit 7d698125b1f0 ("[PATCH] Use the proper C++ compiler to run C++ 
  tests") -- not yet needed in our libffi version as no tests are marked
  C++.

-- at <git://github.com/libffi/libffi.git>.  I have now extracted the 
relevant bits from the four commits and the result is below.

 I have pushed it through my testing and it fixes the test results just 
like my earlier proposal; in fact libffi.log files are the same modulo 
timestamps and one number that is randomly generated.  It is worth noting 
however that the multilib discovery logic in `libffi-init' has not been 
updated unlike with my proposal and it continues using the compiler 
hardcoded within rather than one set with CC_FOR_TARGET/CXX_FOR_TARGET.

 That uses a mechanism (*_FOR_TARGET, interpreted within `target_compile') 
different from one we do (*_UNDER_TEST, used to set `compiler=' in the 
invocation of `target_compile'), and ignores TOOL_EXECUTABLE altogether.  
It makes sense however semantically to me for a standalone library test 
suite to consider the compiler just a tool in testing and not the object 
under test.  Plus it makes it easy to define compilers for the various 
languages required.

 So I am in favour of retaining the mechanism rather than using my earlier 
proposal, however I'm in two minds as to how to proceed.  Integrating the 
change as it is will make us having clutter left in the tree after `make 
distclean', but we can do it right away.  Fixing the problems with the 
change upstream in libffi first and then merging the result back into our 
tree will avoid getting the clutter, but will likely take time.

 I'll sleep on it yet, and meanwhile I'll be happy to hear suggestions.  
I have also cc-ed the libffi mailing list for a possible further insight.

  Maciej

---
 libffi/configure             |    5 +++++
 libffi/configure.ac          |    5 +++++
 libffi/testsuite/Makefile.am |    2 ++
 libffi/testsuite/Makefile.in |    1 +
 4 files changed, 13 insertions(+)

Index: gcc/libffi/configure
===================================================================
--- gcc.orig/libffi/configure
+++ gcc/libffi/configure
@@ -14961,6 +14961,11 @@ _ACEOF
 
 
 
+cat > local.exp <<EOF
+set CC_FOR_TARGET "$CC"
+set CXX_FOR_TARGET "$CXX"
+EOF
+
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
Index: gcc/libffi/configure.ac
===================================================================
--- gcc.orig/libffi/configure.ac
+++ gcc/libffi/configure.ac
@@ -61,6 +61,11 @@ AC_PROG_LIBTOOL
 # Test for 64-bit build.
 AC_CHECK_SIZEOF([size_t])
 
+cat > local.exp <<EOF
+set CC_FOR_TARGET "$CC"
+set CXX_FOR_TARGET "$CXX"
+EOF
+
 AM_MAINTAINER_MODE
 
 AC_CHECK_HEADERS(sys/mman.h)
Index: gcc/libffi/testsuite/Makefile.am
===================================================================
--- gcc.orig/libffi/testsuite/Makefile.am
+++ gcc/libffi/testsuite/Makefile.am
@@ -13,6 +13,8 @@ RUNTEST = `if [ -f $(top_srcdir)/../deja
 
 AM_RUNTESTFLAGS =
 
+EXTRA_DEJAGNU_SITE_CONFIG=../local.exp
+
 CLEANFILES = *.exe core* *.log *.sum
 
 EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c		\
Index: gcc/libffi/testsuite/Makefile.in
===================================================================
--- gcc.orig/libffi/testsuite/Makefile.in
+++ gcc/libffi/testsuite/Makefile.in
@@ -279,6 +279,7 @@ RUNTEST = `if [ -f $(top_srcdir)/../deja
 	       echo $(top_srcdir)/../dejagnu/runtest ; \
 	    else echo runtest; fi`
 
+EXTRA_DEJAGNU_SITE_CONFIG = ../local.exp
 CLEANFILES = *.exe core* *.log *.sum
 EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c		\
 libffi.call/cls_align_longdouble_split.c				\


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 2/4] libffi/test: Fix compilation for build sysroot
  2020-03-26 22:00                 ` Maciej W. Rozycki
@ 2020-03-30 18:45                   ` Mike Stump
  2020-03-31 21:11                     ` Maciej W. Rozycki
  0 siblings, 1 reply; 17+ messages in thread
From: Mike Stump @ 2020-03-30 18:45 UTC (permalink / raw)
  To: Maciej W. Rozycki
  Cc: H.J. Lu, Jeffrey Law, GCC Patches, Julian Brown, Tobias Burnus,
	Thomas Schwinge, Chung-Lin Tang, Ian Lance Taylor,
	libffi-discuss

On Mar 26, 2020, at 3:00 PM, Maciej W. Rozycki <macro@wdc.com> wrote:
> 
> I have actually considered extracting the bits already, but I hesitated 
> putting that forward that as having looked at the part that we require I 
> have thought it to be very messy:

Yeah, sometimes it's like that.  I glanced at the work, if you think it's a step forward, I'd support importing it, my take, import from upstream isn't a bad way to go.

> So I am in favour of retaining the mechanism rather than using my earlier 
> proposal, however I'm in two minds as to how to proceed.  Integrating the 
> change as it is will make us having clutter left in the tree after `make 
> distclean', but we can do it right away.

I'd support this.  distclean is one rm -rf away from being clean enough.  I'd not let that gate or hold up the import.

If there is work that we want that's more to do with in tree building and testing (sys root fun, multilibs), while not ideal, we can deviate from upstream to support that.  Though, if there is a way to naturally support that, that upstream can accept, that'd be better.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 2/4] libffi/test: Fix compilation for build sysroot
  2020-03-30 18:45                   ` Mike Stump
@ 2020-03-31 21:11                     ` Maciej W. Rozycki
  0 siblings, 0 replies; 17+ messages in thread
From: Maciej W. Rozycki @ 2020-03-31 21:11 UTC (permalink / raw)
  To: Mike Stump, Richard Henderson
  Cc: H.J. Lu, Jeffrey Law, GCC Patches, Julian Brown, Tobias Burnus,
	Thomas Schwinge, Chung-Lin Tang, Ian Lance Taylor,
	libffi-discuss

On Mon, 30 Mar 2020, Mike Stump wrote:

> > I have actually considered extracting the bits already, but I hesitated 
> > putting that forward that as having looked at the part that we require I 
> > have thought it to be very messy:
> 
> Yeah, sometimes it's like that.  I glanced at the work, if you think 
> it's a step forward, I'd support importing it, my take, import from 
> upstream isn't a bad way to go.

 So I looked into it some more and interestingly enough all the commits I 
have listed in the previous message have already been made as of libffi's 
commit c82cc159426d ("Merge pull request #166 from chevah/master") that we 
imported with our commit b1760f7f915a ("Merge libffi to upstream commit 
c82cc159426d8d4402375fa1ae3f045b9cf82e16").

 That merge was extensively discussed starting from: 
<https://gcc.gnu.org/ml/gcc-patches/2015-01/msg00705.html>, however no 
mention was as to why the local.exp part had been omitted from the merge.  
Perhaps it was considered not necessary for integrating with the GCC tree, 
although I would think that keeping the divergence to the minimum is 
preferable, and it looks to me that our requirements boil down essentially 
to adding multilib support and making some further, minor tweaks to match 
the rest of the tree.  Whereas the diff between the Makefile systems as at 
libffi's commit c82cc159426d and our commit b1760f7f915a looks to me quite 
substantial.

 Perhaps Richard will be able to provide some input here.

> > So I am in favour of retaining the mechanism rather than using my earlier 
> > proposal, however I'm in two minds as to how to proceed.  Integrating the 
> > change as it is will make us having clutter left in the tree after `make 
> > distclean', but we can do it right away.
> 
> I'd support this.  distclean is one rm -rf away from being clean enough.  
> I'd not let that gate or hold up the import.

 While doing further work on finding a solution that would be acceptable 
(to me anyway), I actually found two further upstream libffi commits:

- commit 6b6df1a7bb37 ("[PATCH] Adds `local.exp` to CLEANFILES"),

- commit 6cf0dea78a5a ("[PATCH] Change CLEANFILES to DISTCLEANFILES"),

both beyond our merge point, that fix this shortcoming.  Still there's no 
Makefile dependency, so if configure.ac is patched or local.exp removed, 
then it is not regenerated, and all that would not be required if what 
automake provides was used.

> If there is work that we want that's more to do with in tree building 
> and testing (sys root fun, multilibs), while not ideal, we can deviate 
> from upstream to support that.  Though, if there is a way to naturally 
> support that, that upstream can accept, that'd be better.

 I did some work now to reduce the divergence and will be posting patch 
series shortly to both upstream libffi and our version.  Hopefully that'll 
be acceptable, at least the initial, minimal change from each series.

 If not, for a reference, here's an updated version of the patch I posted 
last time.  It includes the two upstream libffi commits I have mentioned 
above.

 Let's see how it goes.  Thank you for your input.

  Maciej
---
 libffi/Makefile.am           |    3 +++
 libffi/Makefile.in           |    4 ++++
 libffi/configure             |    5 +++++
 libffi/configure.ac          |    5 +++++
 libffi/testsuite/Makefile.am |    2 ++
 libffi/testsuite/Makefile.in |    1 +
 6 files changed, 20 insertions(+)

gcc-test-libffi-cc-for-target.diff
Index: gcc/libffi/Makefile.am
===================================================================
--- gcc.orig/libffi/Makefile.am
+++ gcc/libffi/Makefile.am
@@ -15,6 +15,9 @@ EXTRA_DIST = LICENSE ChangeLog.v1 Change
 	libffi.xcodeproj/project.pbxproj				\
 	libtool-ldflags
 
+# local.exp is generated by configure
+DISTCLEANFILES = local.exp
+
 # Automake Documentation:
 # If your package has Texinfo files in many directories, you can use the
 # variable TEXINFO_TEX to tell Automake where to find the canonical
Index: gcc/libffi/Makefile.in
===================================================================
--- gcc.orig/libffi/Makefile.in
+++ gcc/libffi/Makefile.in
@@ -454,6 +454,9 @@ EXTRA_DIST = LICENSE ChangeLog.v1 Change
 	libtool-ldflags
 
 
+# local.exp is generated by configure
+DISTCLEANFILES = local.exp
+
 # Automake Documentation:
 # If your package has Texinfo files in many directories, you can use the
 # variable TEXINFO_TEX to tell Automake where to find the canonical
@@ -1674,6 +1677,7 @@ installcheck: installcheck-recursive
 	-rm -f src/x86/$(am__dirstamp)
 	-rm -f src/xtensa/$(DEPDIR)/$(am__dirstamp)
 	-rm -f src/xtensa/$(am__dirstamp)
+	-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
Index: gcc/libffi/configure
===================================================================
--- gcc.orig/libffi/configure
+++ gcc/libffi/configure
@@ -14961,6 +14961,11 @@ _ACEOF
 
 
 
+cat > local.exp <<EOF
+set CC_FOR_TARGET "$CC"
+set CXX_FOR_TARGET "$CXX"
+EOF
+
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
Index: gcc/libffi/configure.ac
===================================================================
--- gcc.orig/libffi/configure.ac
+++ gcc/libffi/configure.ac
@@ -61,6 +61,11 @@ AC_PROG_LIBTOOL
 # Test for 64-bit build.
 AC_CHECK_SIZEOF([size_t])
 
+cat > local.exp <<EOF
+set CC_FOR_TARGET "$CC"
+set CXX_FOR_TARGET "$CXX"
+EOF
+
 AM_MAINTAINER_MODE
 
 AC_CHECK_HEADERS(sys/mman.h)
Index: gcc/libffi/testsuite/Makefile.am
===================================================================
--- gcc.orig/libffi/testsuite/Makefile.am
+++ gcc/libffi/testsuite/Makefile.am
@@ -13,6 +13,8 @@ RUNTEST = `if [ -f $(top_srcdir)/../deja
 
 AM_RUNTESTFLAGS =
 
+EXTRA_DEJAGNU_SITE_CONFIG=../local.exp
+
 CLEANFILES = *.exe core* *.log *.sum
 
 EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c		\
Index: gcc/libffi/testsuite/Makefile.in
===================================================================
--- gcc.orig/libffi/testsuite/Makefile.in
+++ gcc/libffi/testsuite/Makefile.in
@@ -279,6 +279,7 @@ RUNTEST = `if [ -f $(top_srcdir)/../deja
 	       echo $(top_srcdir)/../dejagnu/runtest ; \
 	    else echo runtest; fi`
 
+EXTRA_DEJAGNU_SITE_CONFIG = ../local.exp
 CLEANFILES = *.exe core* *.log *.sum
 EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c		\
 libffi.call/cls_align_longdouble_split.c				\

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 4/4] libgomp/test: Remove a build sysroot fix regression
  2020-03-25 17:30   ` Chung-Lin Tang
@ 2020-04-01 12:12     ` Maciej W. Rozycki
  0 siblings, 0 replies; 17+ messages in thread
From: Maciej W. Rozycki @ 2020-04-01 12:12 UTC (permalink / raw)
  To: Chung-Lin Tang
  Cc: gcc-patches, Julian Brown, Tobias Burnus, Jeff Law,
	Thomas Schwinge, Mike Stump, Ian Lance Taylor

On Thu, 26 Mar 2020, Chung-Lin Tang wrote:

> > Changes from v2:
> > 
> > - Do not use `--tool_exec' with AM_RUNTESTFLAGS.
> > 
> > - Move the definition of GCC_UNDER_TEST from
> >    testsuite/libgomp-test-support.exp to
> >    testsuite/libgomp-site-extra.exp.
> 
> Hi Maciej,
> sorry, I didn't notice you were blocked on input from us.

 No worries; I'm glad you are all right!

> I tested our testing with this patch and can confirm it works for us; 
> didn't notice any breakage.

 Thank you!  I'll be posting a revised series shortly for a libffi update; 
no change to the libgomp part on this occasion now that it works for you.

  Maciej

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2020-04-01 12:12 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-28  1:17 [PATCH v3 0/4] Fix library testsuite compilation for build sysroot Maciej W. Rozycki
2020-02-28  1:18 ` [PATCH v3 1/4] libatomic/test: Fix " Maciej W. Rozycki
2020-02-28  1:18 ` [PATCH v3 3/4] libgo/test: Complement compilation fix " Maciej W. Rozycki
2020-02-28  1:18 ` [PATCH v3 2/4] libffi/test: Fix compilation " Maciej W. Rozycki
2020-02-28 11:50   ` H.J. Lu
2020-02-28 13:44     ` Maciej W. Rozycki
2020-02-28 13:55       ` H.J. Lu
2020-02-28 21:23         ` Jeff Law
2020-02-28 21:50           ` H.J. Lu
2020-03-17 21:52             ` Maciej W. Rozycki
2020-03-24 20:59               ` Mike Stump
2020-03-26 22:00                 ` Maciej W. Rozycki
2020-03-30 18:45                   ` Mike Stump
2020-03-31 21:11                     ` Maciej W. Rozycki
2020-02-28  1:19 ` [PATCH v3 4/4] libgomp/test: Remove a build sysroot fix regression Maciej W. Rozycki
2020-03-25 17:30   ` Chung-Lin Tang
2020-04-01 12:12     ` Maciej W. Rozycki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).