Hi!

On Tue, 18 Sep 2018 02:39:46 +0200, Iain Buclaw <ibuc...@gdcproject.org> wrote:
> This patch adds the configure and make files used for building D
> runtime and Phobos.  As well as running all unittests and the
> testsuite.

With a x86_64-pc-linux-gnu build, I've noticed breakage in '-m32'
multilib testing, made apparent by message: "[...]:
/lib/i386-linux-gnu/libgcc_s.so.1: version `GCC_7.0.0' not found
(required by [...])".  (That is, the system 'libgcc_s.so.1' being
dynamically linked instead of the just built one.)  This is because of
incomplete 'gccdir' setup in the '*.exp' file.  In such a multilibbed
configuration, there are 'build-gcc/gcc/libgcc.*' and
'build-gcc/gcc/32/libgcc.*' (for example); for '-m32' multilib testing,
paths need to be set up to point to the latter instead of the former.  It
seems as if some of this '*.exp' stuff has been copied from libffi (?);
the attached patch copies the missing pieces from there, too.  I've been
tempted to commit this "as obvious", but then thought I'll still get some
review/approval first.  If approving this patch, please respond with
"Reviewed-by: NAME <EMAIL>" so that your effort will be recorded in the
commit log, see <https://gcc.gnu.org/wiki/Reviewed-by>.


Grüße
 Thomas


From 5eb9e491a66c231df573d1915ba8c5f533e03d2c Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <tho...@codesourcery.com>
Date: Sun, 14 Apr 2019 12:48:22 +0200
Subject: [PATCH] Fix libphobos testsuite libgcc multilib search path

---
 libphobos/testsuite/lib/libphobos.exp | 38 +++++++++++++++++++++++++--
 1 file changed, 36 insertions(+), 2 deletions(-)

diff --git a/libphobos/testsuite/lib/libphobos.exp b/libphobos/testsuite/lib/libphobos.exp
index 6d113bc51723..0e4e2ebe085d 100644
--- a/libphobos/testsuite/lib/libphobos.exp
+++ b/libphobos/testsuite/lib/libphobos.exp
@@ -98,6 +98,15 @@ proc libphobos_init { args } {
     global gluefile wrap_flags
     global ld_library_path
     global DEFAULT_DFLAGS
+    global GCC_UNDER_TEST
+
+    if ![info exists GCC_UNDER_TEST] then {
+	if [info exists TOOL_EXECUTABLE] {
+	    set GCC_UNDER_TEST $TOOL_EXECUTABLE
+	} else {
+	    set GCC_UNDER_TEST "[find_gcc]"
+	}
+    }
 
     # If a testcase doesn't have special options, use these.
     if ![info exists DEFAULT_DFLAGS] then {
@@ -142,13 +151,14 @@ proc libphobos_init { args } {
 	set exeext $env(EXEEXT)
     }
 
-    # Compute what needs to be added to the existing LD_LIBRARY_PATH.
+    # Compute what needs to be put into LD_LIBRARY_PATH
     set ld_library_path ""
 
+    # Locate libgcc.a so we don't need to account for different values of
+    # SHLIB_EXT on different platforms
     set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
     if {$gccdir != ""} {
 	set gccdir [file dirname $gccdir]
-	append ld_library_path ":${gccdir}"
     }
 
     if { [file exists "${blddir}/libdruntime/.libs/libgdruntime.${shlib_ext}"] } {
@@ -159,6 +169,30 @@ proc libphobos_init { args } {
 	append ld_library_path ":${blddir}/src/.libs"
     }
 
+    # Compute what needs to be added to the existing LD_LIBRARY_PATH.
+    if {$gccdir != ""} {
+	# Add AIX pthread directory first.
+	if { [llength [glob -nocomplain ${gccdir}/pthread/libgcc_s*.a]] >= 1 } {
+	    append ld_library_path ":${gccdir}/pthread"
+	}
+	append ld_library_path ":${gccdir}"
+	set compiler [lindex $GCC_UNDER_TEST 0]
+
+	if { [is_remote host] == 0 && [which $compiler] != 0 } {
+	  foreach i "[exec $compiler --print-multi-lib]" {
+	    set mldir ""
+	    regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir
+	    set mldir [string trimright $mldir "\;@"]
+	    if { "$mldir" == "." } {
+	      continue
+	    }
+	    if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.so.*]] >= 1 } {
+	      append ld_library_path ":${gccdir}/${mldir}"
+	    }
+	  }
+	}
+    }
+
     set_ld_library_path_env_vars
 
     libphobos_maybe_build_wrapper "${objdir}/testglue.o"
-- 
2.17.1

Attachment: signature.asc
Description: PGP signature

Reply via email to