public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-4566] libffi: Integrate testsuite with GCC testsuite
@ 2021-10-20 12:36 H.J. Lu
  0 siblings, 0 replies; only message in thread
From: H.J. Lu @ 2021-10-20 12:36 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:4824ed41ba7cd63e60fd9f8769a58b79935a90d1

commit r12-4566-g4824ed41ba7cd63e60fd9f8769a58b79935a90d1
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Aug 30 14:31:46 2021 -0700

    libffi: Integrate testsuite with GCC testsuite
    
            * 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 -shared-libgcc -lstdc++ for
            C++ sources.

Diff:
---
 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..7dc7b5d19a3 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=-shared-libgcc -lstdc++"
     }
 
     if { [string match "arc*-*-linux*" $target_triplet] } {


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-20 12:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-20 12:36 [gcc r12-4566] libffi: Integrate testsuite with GCC testsuite H.J. Lu

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).