From: Thomas Schwinge <thomas@codesourcery.com>
To: <gcc-patches@gcc.gnu.org>
Cc: "Maciej W. Rozycki" <macro@orcam.me.uk>,
<libffi-discuss@sourceware.org>, H.J.Lu <hjl.tools@gmail.com>,
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>,
Mike Stump <mikestump@comcast.net>,
Iain Sandoe <idsandoe@googlemail.com>
Subject: libffi: Consider '--with-build-sysroot=[...]' for target libraries' build-tree testing (instead of build-time 'CC' etc.) [PR109951] (was: [PATCH v5 GCC] libffi/test: Fix compilation for build sysroot)
Date: Tue, 12 Sep 2023 12:58:27 +0200 [thread overview]
Message-ID: <871qf3zmi4.fsf@euler.schwinge.homeip.net> (raw)
In-Reply-To: <alpine.LFD.2.21.2004201336060.461@redsun52.ssa.fujisawa.hgst.com>
[-- Attachment #1: Type: text/plain, Size: 2039 bytes --]
Hi!
On 2020-04-20T14:18:40+0100, "Maciej W. Rozycki via Gcc-patches" <gcc-patches@gcc.gnu.org> 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.
This has since, as far as I can tell, been resolved properly by H.J. Lu's
GCC commit 5be7b66998127286fada45e4f23bd8a2056d553e,
"libffi: Integrate build with GCC", and
GCC commit 4824ed41ba7cd63e60fd9f8769a58b79935a90d1
"libffi: Integrate testsuite with GCC testsuite".
> Address this problem by providing a DejaGNU configuration file defining
> the compiler to use, via the CC_FOR_TARGET 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
As we've found, this is conceptually problematic, as discussed in
<https://inbox.sourceware.org/875y868a4b.fsf@euler.schwinge.homeip.net>
"Consider '--with-build-sysroot=[...]' for target libraries' build-tree testing (instead of build-time 'CC' etc.) [PR109951]".
I therefore suggest to apply to GCC libffi the conceptually same changes
as I've just pushed for libgomp:
<https://inbox.sourceware.org/874jjzzqc2.fsf@euler.schwinge.homeip.net>
"libgomp: Consider '--with-build-sysroot=[...]' for target libraries' build-tree testing (instead of build-time 'CC' etc.) [PR91884, PR109951]".
OK to push the attached
"libffi: Consider '--with-build-sysroot=[...]' for target libraries' build-tree testing (instead of build-time 'CC' etc.) [PR109951]"?
Grüße
Thomas
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-libffi-Consider-with-build-sysroot-.-for-target-libr.patch --]
[-- Type: text/x-diff, Size: 5237 bytes --]
From 8b8654d04dcbb7f0a5947bc21efc5b9c60b3b6c6 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Mon, 11 Sep 2023 10:50:00 +0200
Subject: [PATCH] libffi: 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 a0b48358cb1e70e161a87ec5deb7a4b25defba6b
"libffi/test: Fix compilation for build sysroot" done differently,
avoiding build-tree testing use of any random gunk that may appear in
build-time 'CC', 'CXX'.
PR testsuite/109951
libffi/
* configure.ac: 'AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)'.
<local.exp>: Don't set 'CC_FOR_TARGET', 'CXX_FOR_TARGET', instead
set 'SYSROOT_CFLAGS_FOR_TARGET'.
* Makefile.in: Regenerate.
* configure: Likewise.
* include/Makefile.in: Likewise.
* man/Makefile.in: Likewise.
* testsuite/Makefile.in: Likewise.
* testsuite/lib/libffi.exp (libffi_target_compile): If
'--with-build-sysroot=[...]' was specified, use it for build-tree
testing.
---
libffi/Makefile.in | 1 +
libffi/configure | 10 ++++++----
libffi/configure.ac | 5 +++--
libffi/include/Makefile.in | 1 +
libffi/man/Makefile.in | 1 +
libffi/testsuite/Makefile.in | 1 +
libffi/testsuite/lib/libffi.exp | 7 +++++++
7 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/libffi/Makefile.in b/libffi/Makefile.in
index 1d936b5c8a5..3a55212cc00 100644
--- a/libffi/Makefile.in
+++ b/libffi/Makefile.in
@@ -383,6 +383,7 @@ SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
+SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
TARGET = @TARGET@
TARGETDIR = @TARGETDIR@
TARGET_OBJ = @TARGET_OBJ@
diff --git a/libffi/configure b/libffi/configure
index 9eac9c907bf..f1efd6987a3 100755
--- a/libffi/configure
+++ b/libffi/configure
@@ -666,6 +666,7 @@ TESTSUBDIR_TRUE
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
+SYSROOT_CFLAGS_FOR_TARGET
READELF
CXXCPP
CPP
@@ -11634,7 +11635,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11637 "configure"
+#line 11638 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11740,7 +11741,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11743 "configure"
+#line 11744 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -15137,9 +15138,10 @@ _ACEOF
+
+
cat > local.exp <<EOF
-set CC_FOR_TARGET "$CC"
-set CXX_FOR_TARGET "$CXX"
+set SYSROOT_CFLAGS_FOR_TARGET "$SYSROOT_CFLAGS_FOR_TARGET"
set compiler_vendor "$ax_cv_c_compiler_vendor"
EOF
diff --git a/libffi/configure.ac b/libffi/configure.ac
index 014d89d0423..0381d178f66 100644
--- a/libffi/configure.ac
+++ b/libffi/configure.ac
@@ -61,9 +61,10 @@ AC_CHECK_TOOL(READELF, readelf)
# Test for 64-bit build.
AC_CHECK_SIZEOF([size_t])
+AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)
+
cat > local.exp <<EOF
-set CC_FOR_TARGET "$CC"
-set CXX_FOR_TARGET "$CXX"
+set SYSROOT_CFLAGS_FOR_TARGET "$SYSROOT_CFLAGS_FOR_TARGET"
set compiler_vendor "$ax_cv_c_compiler_vendor"
EOF
diff --git a/libffi/include/Makefile.in b/libffi/include/Makefile.in
index 879cb72296d..9759f0d91dc 100644
--- a/libffi/include/Makefile.in
+++ b/libffi/include/Makefile.in
@@ -255,6 +255,7 @@ SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
+SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
TARGET = @TARGET@
TARGETDIR = @TARGETDIR@
TARGET_OBJ = @TARGET_OBJ@
diff --git a/libffi/man/Makefile.in b/libffi/man/Makefile.in
index 9d4f96608c4..18de1e836f5 100644
--- a/libffi/man/Makefile.in
+++ b/libffi/man/Makefile.in
@@ -237,6 +237,7 @@ SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
+SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
TARGET = @TARGET@
TARGETDIR = @TARGETDIR@
TARGET_OBJ = @TARGET_OBJ@
diff --git a/libffi/testsuite/Makefile.in b/libffi/testsuite/Makefile.in
index a19b523e54a..27d48a7ad7a 100644
--- a/libffi/testsuite/Makefile.in
+++ b/libffi/testsuite/Makefile.in
@@ -210,6 +210,7 @@ SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
+SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
TARGET = @TARGET@
TARGETDIR = @TARGETDIR@
TARGET_OBJ = @TARGET_OBJ@
diff --git a/libffi/testsuite/lib/libffi.exp b/libffi/testsuite/lib/libffi.exp
index 15d3d5ebd73..6dc0bc1d77f 100644
--- a/libffi/testsuite/lib/libffi.exp
+++ b/libffi/testsuite/lib/libffi.exp
@@ -369,6 +369,13 @@ proc libffi_target_compile { source dest type options } {
lappend options "ldflags=$wrap_flags"
}
+ if { $blddirffi != "" } {
+ # If '--with-build-sysroot=[...]' was specified, use it for build-tree
+ # testing.
+ global SYSROOT_CFLAGS_FOR_TARGET
+ lappend options "additional_flags=${SYSROOT_CFLAGS_FOR_TARGET}"
+ }
+
# TOOL_OPTIONS must come first, so that it doesn't override testcase
# specific options.
if [info exists TOOL_OPTIONS] {
--
2.34.1
next prev parent reply other threads:[~2023-09-12 10:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-20 13:18 [PATCH v5 GCC] libffi/test: Fix compilation for build sysroot Maciej W. Rozycki
2020-04-22 18:04 ` Jeff Law
2020-04-25 20:33 ` Maciej W. Rozycki
2020-04-29 17:14 ` Jeff Law
2020-04-29 20:48 ` Florian Weimer
2023-09-12 10:58 ` Thomas Schwinge [this message]
2023-10-25 8:30 ` [PING] libffi: Consider '--with-build-sysroot=[...]' for target libraries' build-tree testing (instead of build-time 'CC' etc.) [PR109951] (was: [PATCH v5 GCC] libffi/test: Fix compilation for build sysroot) Thomas Schwinge
2023-10-26 13:32 ` [PING] libffi: Consider '--with-build-sysroot=[...]' for target libraries' build-tree testing (instead of build-time 'CC' etc.) [PR109951] Jeff Law
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871qf3zmi4.fsf@euler.schwinge.homeip.net \
--to=thomas@codesourcery.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hjl.tools@gmail.com \
--cc=idsandoe@googlemail.com \
--cc=libffi-discuss@sourceware.org \
--cc=macro@orcam.me.uk \
--cc=mikestump@comcast.net \
--cc=ro@CeBiTec.Uni-Bielefeld.DE \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).