From: "H.J. Lu" <hjl.tools@gmail.com>
To: gcc-patches@gcc.gnu.org
Cc: Jeff Law <jeffreyalaw@gmail.com>,
Jakub Jelinek <jakub@redhat.com>, DJ Delorie <dj@redhat.com>,
Xi Ruoyao <xry111@mengyan1223.wang>,
Richard Biener <richard.guenther@gmail.com>
Subject: [PATCH v2 4/4] libffi: Integrate testsuite with GCC testsuite
Date: Thu, 2 Sep 2021 08:50:45 -0700 [thread overview]
Message-ID: <20210902155045.2620513-5-hjl.tools@gmail.com> (raw)
In-Reply-To: <20210902155045.2620513-1-hjl.tools@gmail.com>
* testsuite/lib/libffi.exp (load_gcc_lib): Load library from GCC
testsuite.
Load target-supports.exp and target-supports-dg.exp.
(libffi-init): Use libraries in GCC build tree.
(libffi_target_compile): Link with -lstdc++ for C++ sources.
---
libffi/testsuite/lib/libffi.exp | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/libffi/testsuite/lib/libffi.exp b/libffi/testsuite/lib/libffi.exp
index 4f4dd48d2c6..d8bf6269a36 100644
--- a/libffi/testsuite/lib/libffi.exp
+++ b/libffi/testsuite/lib/libffi.exp
@@ -15,12 +15,15 @@
# <http://www.gnu.org/licenses/>.
proc load_gcc_lib { filename } {
- global srcdir
- load_file $srcdir/lib/$filename
+ global srcdir loaded_libs
+ load_file $srcdir/../../gcc/testsuite/lib/$filename
+ set loaded_libs($filename) ""
}
load_lib dg.exp
load_lib libgloss.exp
+load_gcc_lib target-supports.exp
+load_gcc_lib target-supports-dg.exp
load_gcc_lib target-libpath.exp
load_gcc_lib wrapper.exp
@@ -277,6 +280,7 @@ proc libffi-init { args } {
global srcdir
global blddirffi
global objdir
+ global blddircxx
global TOOL_OPTIONS
global tool
global libffi_include
@@ -285,13 +289,13 @@ proc libffi-init { args } {
global ld_library_path
global compiler_vendor
- if ![info exists blddirffi] {
- set blddirffi [pwd]/..
- }
-
+ set blddirffi [lookfor_file [get_multilibs] libffi]
verbose "libffi $blddirffi"
+ set blddircxx [lookfor_file [get_multilibs] libstdc++-v3]
+ verbose "libstdc++ $blddircxx"
+
+ set compiler_vendor "gnu"
- # Which compiler are we building with?
if { [string match $compiler_vendor "gnu"] } {
set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
if {$gccdir != ""} {
@@ -320,6 +324,8 @@ proc libffi-init { args } {
# add the library path for libffi.
append ld_library_path ":${blddirffi}/.libs"
+ # add the library path for libstdc++ as well.
+ append ld_library_path ":${blddircxx}/src/.libs"
verbose "ld_library_path: $ld_library_path"
@@ -332,6 +338,7 @@ proc libffi-init { args } {
if { $libffi_dir != "" } {
set libffi_dir [file dirname ${libffi_dir}]
set libffi_link_flags "-L${libffi_dir}/.libs"
+ lappend libffi_link_flags "-L${blddircxx}/src/.libs"
}
set_ld_library_path_env_vars
@@ -398,9 +405,8 @@ proc libffi_target_compile { source dest type options } {
lappend options "libs= -lpthread"
}
- # this may be required for g++, but just confused clang.
if { [string match "*.cc" $source] } {
- lappend options "c++"
+ lappend options "ldflags=-lstdc++"
}
if { [string match "arc*-*-linux*" $target_triplet] } {
--
2.31.1
next prev parent reply other threads:[~2021-09-02 15:50 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-02 15:50 [PATCH v2 0/4] libffi: Sync with upstream H.J. Lu
2021-09-02 15:50 ` [PATCH v2 1/4] libffi: Add HOWTO_MERGE, autogen.sh and merge.sh H.J. Lu
2021-09-02 15:50 ` [PATCH v2 2/4] libffi: Sync with libffi 3.4.2 H.J. Lu
2021-09-02 15:50 ` [PATCH v2 3/4] libffi: Integrate build with GCC H.J. Lu
2021-09-02 15:50 ` H.J. Lu [this message]
2021-10-10 13:55 ` PING^1 [PATCH v2 0/4] libffi: Sync with upstream H.J. Lu
2021-10-13 12:45 ` Richard Biener
2021-10-13 12:56 ` H.J. Lu
2021-10-13 13:03 ` Richard Biener
2021-10-13 13:42 ` H.J. Lu
2021-10-16 0:06 ` H.J. Lu
2021-10-16 0:22 ` David Edelsohn
2021-10-16 11:48 ` H.J. Lu
2021-10-16 17:04 ` David Edelsohn
2021-10-16 17:13 ` H.J. Lu
2021-10-16 19:21 ` Ian Lance Taylor
2021-10-16 19:53 ` David Edelsohn
2021-10-16 19:58 ` H.J. Lu
2021-10-16 20:07 ` David Edelsohn
2021-10-17 13:26 ` H.J. Lu
2021-10-18 15:04 ` David Edelsohn
2021-10-18 15:08 ` H.J. Lu
2021-10-19 15:02 ` David Edelsohn
2021-10-19 18:01 ` H.J. Lu
2021-10-24 20:36 ` Iain Sandoe
2021-10-24 20:40 ` H.J. Lu
2021-10-25 6:58 ` Iain Sandoe
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=20210902155045.2620513-5-hjl.tools@gmail.com \
--to=hjl.tools@gmail.com \
--cc=dj@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=jeffreyalaw@gmail.com \
--cc=richard.guenther@gmail.com \
--cc=xry111@mengyan1223.wang \
/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).