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 \