From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 77762 invoked by alias); 11 Nov 2019 18:12:36 -0000 Mailing-List: contact libffi-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libffi-discuss-owner@sourceware.org Received: (qmail 77745 invoked by uid 89); 11 Nov 2019 18:12:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_ASCII_DIVIDERS autolearn=ham version=3.3.1 spammy=mkdir, 2787, lappend X-HELO: esa1.hgst.iphmx.com Received: from esa1.hgst.iphmx.com (HELO esa1.hgst.iphmx.com) (68.232.141.245) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 11 Nov 2019 18:12:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1573495953; x=1605031953; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=lS/jwIFluHnv/updrnbMUtzZrddcBrlbYjPfioCeJWg=; b=eI6cEiAk8WnBcxOTo54vsu7Kp1KouGvBrjfRCtxPkslB2cdPtq5tIztT rj21D/bHvstNHZPZhVHBKIBWl0XGf/2vUW3FAUzZE8RTp1mxn3EYpDyh2 FSQmkYwTz7/HROWhQ8E2yfKrDKjTihOxKCkaDM1hks2nnuVN+3Nrn+y6R 3yfAylKFfMgqScfVglmSa77PSlGIN8pQ/3omwpbme5HeihYOMmLcaWpPa WpIahdy1TE2PdpM89DRGIMzKDUtlngHeLjVimocHURwbDQTZRVTo1GrVE IGkGcLEUpoLZlcWRK3KPtu+TRr7Q5QmPSZ1DeEUxjv8xXlWbk/lkTyrog A==; IronPort-SDR: fbWClCrdta6D4Epy7tx5aoIO9C4cNRG44PkedSjX8EPv+hagHsYgHSdlPKH36eSX0sL5RzwGbS AuUcNY3KeWeLFa+iibCby60ryUdpoOxdceOwhm6PKfwo16A5+xzohy8JDjl+4DI2o/8ejyx3rC M7Z50ILr6l0nQVzGflJoonwzP+nDrICR1L7ku1cn5FOjtk/zmb0/JaFGy2PFrNGAqF66RvqYdH RNqqqayEJCFUJWdSUgLi7yy8PzYVytfNRQni+5rFkRBymiw37bBhYFiQJMVxVOu/R0exStTlVJ Snk= Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 12 Nov 2019 02:12:32 +0800 IronPort-SDR: UkIGk4Fa1KoW27YxZAUtjbUdZbI5HBkBftf8khzzeuieVbl9B4RwELMf/1n6lfCYezs0wKQETx 9itUG/DBJGSYK2/YXDNFmETipffzOWhXfKQVr7mntmMzQmzkZmaAuSslCRZC28kqnw2GnIekLD j/Ov1qVHN97qmKo/4lOdo1As3YktZEZ8P3SFNaouJF0Aldk+33zpncNCt+IHtVQdrnnwQeotIR aJKAXwRgp5JXYEsvqOmzK5s7aFMlv2RpgO9/AI4TDmV0S2YZMQv3KU9Ng14l7c6MNYTyi+O1xu rYm8H+AfXLmrhNttYCsiXkqT Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2019 10:07:36 -0800 IronPort-SDR: xv7+Mgy5ZZT3xAjV8I+T3NCeYIIXrUdmmBTIez0h8LLZQFRr6snl6GZo7GYylS5Vr5dHfRThJO dYAPZHWLmDzfHQjw2coSa8B0pDwRVzLJTjAXEXtRIeLftYI0VIDpkqN6PXXVw7K7bxNkd+1724 3rUqsScog7Dnlpe7eEDgKcQtSR84wL/GEY4913WsiD/yH7AyX8zizH+impYnTfpva0WOusTwzG +Y6OcpnLhYNr/Iitjovi0gxkLcn6i8diN04x4aLWybP+uHA7UbWIdEHRvcaYPDu9lexxc5jbX+ jvw= WDCIronportException: Internal Received: from unknown (HELO redsun52) ([10.149.66.28]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2019 10:12:31 -0800 Date: Mon, 11 Nov 2019 18:12:00 -0000 From: "Maciej W. Rozycki" To: gcc-patches@gcc.gnu.org cc: libffi-discuss@sourceware.org, golang-dev@googlegroups.com Subject: [PATCH 2/4] libffi/test: Fix compilation for build sysroot In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-SW-Source: 2019/txt/msg00067.txt.bz2 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-test-support.exp to output files. * configure: Regenerate. * testsuite/libffi-test-support.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. --- 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-test-support.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 @@ -16635,7 +16635,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-test-support.exp man/Makefile libffi.pc" cat >confcache <<\_ACEOF @@ -17802,6 +17802,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-test-support.exp") CONFIG_FILES="$CONFIG_FILES testsuite/libffi-test-support.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 @@ -368,6 +368,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-test-support.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-test-support.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 @@ -105,7 +105,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-test-support.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 = `if [ -f $(top_srcdir)/../deja echo $(top_srcdir)/../dejagnu/runtest ; \ else echo runtest; fi` +EXTRA_DEJAGNU_SITE_CONFIG = libffi-test-support.exp CLEANFILES = *.exe core* *.log *.sum EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c \ libffi.call/cls_align_longdouble_split.c \ @@ -389,6 +390,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-test-support.exp: $(top_builddir)/config.status $(srcdir)/libffi-test-support.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-test-support.exp.in =================================================================== --- /dev/null +++ gcc/libffi/testsuite/libffi-test-support.exp.in @@ -0,0 +1 @@ +set GCC_UNDER_TEST {@CC@}