summaryrefslogtreecommitdiffstats
path: root/libffi
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2021-08-30 14:31:46 -0700
committerH.J. Lu <hjl.tools@gmail.com>2021-10-20 05:35:52 -0700
commit4824ed41ba7cd63e60fd9f8769a58b79935a90d1 (patch)
tree8c0b5bce915ec0e32f1774a0790dbc1aba50952e /libffi
parentlibffi: Integrate build with GCC (diff)
downloadgcc-4824ed41ba7cd63e60fd9f8769a58b79935a90d1.tar.gz
gcc-4824ed41ba7cd63e60fd9f8769a58b79935a90d1.tar.bz2
gcc-4824ed41ba7cd63e60fd9f8769a58b79935a90d1.tar.xz
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.
Diffstat (limited to 'libffi')
-rw-r--r--libffi/testsuite/lib/libffi.exp24
1 files 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 @@
15# <http://www.gnu.org/licenses/>. 15# <http://www.gnu.org/licenses/>.
16 16
17proc load_gcc_lib { filename } { 17proc load_gcc_lib { filename } {
18 global srcdir 18 global srcdir loaded_libs
19 load_file $srcdir/lib/$filename 19 load_file $srcdir/../../gcc/testsuite/lib/$filename
20 set loaded_libs($filename) ""
20} 21}
21 22
22load_lib dg.exp 23load_lib dg.exp
23load_lib libgloss.exp 24load_lib libgloss.exp
25load_gcc_lib target-supports.exp
26load_gcc_lib target-supports-dg.exp
24load_gcc_lib target-libpath.exp 27load_gcc_lib target-libpath.exp
25load_gcc_lib wrapper.exp 28load_gcc_lib wrapper.exp
26 29
@@ -277,6 +280,7 @@ proc libffi-init { args } {
277 global srcdir 280 global srcdir
278 global blddirffi 281 global blddirffi
279 global objdir 282 global objdir
283 global blddircxx
280 global TOOL_OPTIONS 284 global TOOL_OPTIONS
281 global tool 285 global tool
282 global libffi_include 286 global libffi_include
@@ -285,13 +289,13 @@ proc libffi-init { args } {
285 global ld_library_path 289 global ld_library_path
286 global compiler_vendor 290 global compiler_vendor
287 291
288 if ![info exists blddirffi] { 292 set blddirffi [lookfor_file [get_multilibs] libffi]
289 set blddirffi [pwd]/..
290 }
291
292 verbose "libffi $blddirffi" 293 verbose "libffi $blddirffi"
294 set blddircxx [lookfor_file [get_multilibs] libstdc++-v3]
295 verbose "libstdc++ $blddircxx"
296
297 set compiler_vendor "gnu"
293 298
294 # Which compiler are we building with?
295 if { [string match $compiler_vendor "gnu"] } { 299 if { [string match $compiler_vendor "gnu"] } {
296 set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a] 300 set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
297 if {$gccdir != ""} { 301 if {$gccdir != ""} {
@@ -320,6 +324,8 @@ proc libffi-init { args } {
320 324
321 # add the library path for libffi. 325 # add the library path for libffi.
322 append ld_library_path ":${blddirffi}/.libs" 326 append ld_library_path ":${blddirffi}/.libs"
327 # add the library path for libstdc++ as well.
328 append ld_library_path ":${blddircxx}/src/.libs"
323 329
324 verbose "ld_library_path: $ld_library_path" 330 verbose "ld_library_path: $ld_library_path"
325 331
@@ -332,6 +338,7 @@ proc libffi-init { args } {
332 if { $libffi_dir != "" } { 338 if { $libffi_dir != "" } {
333 set libffi_dir [file dirname ${libffi_dir}] 339 set libffi_dir [file dirname ${libffi_dir}]
334 set libffi_link_flags "-L${libffi_dir}/.libs" 340 set libffi_link_flags "-L${libffi_dir}/.libs"
341 lappend libffi_link_flags "-L${blddircxx}/src/.libs"
335 } 342 }
336 343
337 set_ld_library_path_env_vars 344 set_ld_library_path_env_vars
@@ -398,9 +405,8 @@ proc libffi_target_compile { source dest type options } {
398 lappend options "libs= -lpthread" 405 lappend options "libs= -lpthread"
399 } 406 }
400 407
401 # this may be required for g++, but just confused clang.
402 if { [string match "*.cc" $source] } { 408 if { [string match "*.cc" $source] } {
403 lappend options "c++" 409 lappend options "ldflags=-shared-libgcc -lstdc++"
404 } 410 }
405 411
406 if { [string match "arc*-*-linux*" $target_triplet] } { 412 if { [string match "arc*-*-linux*" $target_triplet] } {