public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 14/14] Add D Phobos config, makefiles, and testsuite.
@ 2018-09-18  0:42 Iain Buclaw
  2018-10-16 18:39 ` Richard Sandiford
  2019-04-20 21:22 ` Thomas Schwinge
  0 siblings, 2 replies; 10+ messages in thread
From: Iain Buclaw @ 2018-09-18  0:42 UTC (permalink / raw)
  To: gcc-patches

This patch adds the configure and make files used for building D
runtime and Phobos.  As well as running all unittests and the
testsuite.

ftp://ftp.gdcproject.org/patches/v4/14-v4-d-phobos-misc.patch

---
 libphobos/Makefile.am                         |    69 +
 libphobos/Makefile.in                         |   668 +
 libphobos/acinclude.m4                        |    18 +
 libphobos/aclocal.m4                          |   704 +
 libphobos/config.h.in                         |    56 +
 libphobos/configure                           | 17155 ++++++++++++++++
 libphobos/configure.ac                        |   212 +
 libphobos/d_rules.am                          |    60 +
 libphobos/libdruntime/Makefile.am             |   388 +
 libphobos/libdruntime/Makefile.in             |  2872 +++
 libphobos/m4/autoconf.m4                      |   135 +
 libphobos/m4/druntime.m4                      |   115 +
 libphobos/m4/druntime/cpu.m4                  |    95 +
 libphobos/m4/druntime/libraries.m4            |   163 +
 libphobos/m4/druntime/os.m4                   |   171 +
 libphobos/m4/gcc_support.m4                   |    34 +
 libphobos/m4/gdc.m4                           |    19 +
 libphobos/m4/libtool.m4                       |    78 +
 libphobos/src/Makefile.am                     |   211 +
 libphobos/src/Makefile.in                     |  2019 ++
 libphobos/src/libgphobos.spec.in              |     2 +-
 libphobos/testsuite/Makefile.am               |    15 +
 libphobos/testsuite/Makefile.in               |   452 +
 libphobos/testsuite/config/default.exp        |    17 +
 libphobos/testsuite/lib/libphobos-dg.exp      |    52 +
 libphobos/testsuite/lib/libphobos.exp         |   193 +
 .../libphobos.allocations/allocations.exp     |    29 +
 .../overflow_from_existing.d                  |     8 +
 .../overflow_from_zero.d                      |     8 +
 .../testsuite/libphobos.cycles/cycles.exp     |    53 +
 libphobos/testsuite/libphobos.cycles/mod1.d   |     9 +
 libphobos/testsuite/libphobos.cycles/mod2.d   |     9 +
 libphobos/testsuite/libphobos.cycles/mod3.d   |     9 +
 .../testsuite/libphobos.exceptions/chain.d    |    79 +
 .../libphobos.exceptions/exceptions.exp       |    29 +
 .../invalid_memory_operation.d                |    14 +
 .../libphobos.exceptions/line_trace.d         |    19 +
 .../libphobos.exceptions/static_dtor.d        |    16 +
 .../libphobos.exceptions/stderr_msg.d         |     6 +
 .../libphobos.exceptions/unittest_assert.d    |    11 +
 .../libphobos.exceptions/unknown_gc.d         |     9 +
 .../libphobos.init_fini/init_fini.exp         |    29 +
 .../libphobos.init_fini/runtime_args.d        |    13 +
 .../libphobos.init_fini/thread_join.d         |    18 +
 .../testsuite/libphobos.shared/finalize.d     |    63 +
 libphobos/testsuite/libphobos.shared/host.c   |    60 +
 libphobos/testsuite/libphobos.shared/lib.d    |   133 +
 .../testsuite/libphobos.shared/lib_13414.d    |     4 +
 .../testsuite/libphobos.shared/liblinkdep.d   |     6 +
 .../testsuite/libphobos.shared/libloaddep.d   |    13 +
 libphobos/testsuite/libphobos.shared/link.d   |    64 +
 libphobos/testsuite/libphobos.shared/linkD.c  |    14 +
 libphobos/testsuite/libphobos.shared/linkDR.c |    28 +
 .../testsuite/libphobos.shared/link_linkdep.d |     6 +
 .../testsuite/libphobos.shared/link_loaddep.d |     7 +
 .../libphobos.shared/link_mod_collision.d     |     5 +
 libphobos/testsuite/libphobos.shared/load.d   |   147 +
 libphobos/testsuite/libphobos.shared/loadDR.c |    39 +
 .../testsuite/libphobos.shared/load_13414.d   |    30 +
 .../testsuite/libphobos.shared/load_linkdep.d |    18 +
 .../testsuite/libphobos.shared/load_loaddep.d |    17 +
 .../libphobos.shared/load_mod_collision.d     |    14 +
 libphobos/testsuite/libphobos.shared/plugin.d |    73 +
 .../testsuite/libphobos.shared/shared.exp     |   108 +
 .../libphobos.thread/fiber_guard_page.d       |    47 +
 .../testsuite/libphobos.thread/thread.exp     |    29 +
 .../testsuite/libphobos.typeinfo/comparison.d |    78 +
 .../testsuite/libphobos.typeinfo/typeinfo.exp |    29 +
 .../libphobos.unittests/unittests.exp         |    53 +
 libphobos/testsuite/test_runner.d             |    95 +
 libphobos/testsuite/testsuite_flags.in        |    52 +
 71 files changed, 27572 insertions(+), 1 deletion(-)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 14/14] Add D Phobos config, makefiles, and testsuite.
  2018-09-18  0:42 [PATCH 14/14] Add D Phobos config, makefiles, and testsuite Iain Buclaw
@ 2018-10-16 18:39 ` Richard Sandiford
  2018-10-18 23:19   ` Iain Buclaw
  2018-10-22  8:18   ` Iain Buclaw
  2019-04-20 21:22 ` Thomas Schwinge
  1 sibling, 2 replies; 10+ messages in thread
From: Richard Sandiford @ 2018-10-16 18:39 UTC (permalink / raw)
  To: Iain Buclaw; +Cc: gcc-patches

Iain Buclaw <ibuclaw@gdcproject.org> writes:
> diff --git a/libphobos/d_rules.am b/libphobos/d_rules.am
> new file mode 100644
> index 00000000000..b16cf5052d2
> --- /dev/null
> +++ b/libphobos/d_rules.am
> @@ -0,0 +1,60 @@
> +# This file contains some common rules for D source compilation
> +# used for libdruntime and libphobos
> +
> +# If there are no sources with known extension (i.e. only D sources)
> +# automake forgets to set this

Needs a copyright notice and licence.

> +# AC_LANG(D)
> +# -----------
> +# (we have to use GDC as variable prefix as our GCC patches set GDC
> +#  GDC_FOR_BUILD etc. If we ever want to support other D compilers all
> +#  names need to be changed to DC)

Seems like this is still talking about GDC as a separate project.

> +  # This checks to see if the host supports the compiler-generated builtins
> +  # for atomic operations for various integral sizes. Note, this is intended
> +  # to be an all-or-nothing switch, so all the atomic operations that are
> +  # used should be checked.
> +  AC_MSG_CHECKING([for atomic builtins for byte])
> +  AC_CACHE_VAL(druntime_cv_atomic_byte, [
> +    AC_TRY_LINK(
> +      [import gcc.builtins;], [
> +      shared(byte) c1;
> +       byte c2, c3;
> +       __atomic_compare_exchange_1(&c1, &c2, c3, false, 5, 5);
> +       __atomic_load_1(&c1, 5);
> +       __atomic_store_1(&c1, c2, 5);
> +       return 0;
> +      ],
> +      [druntime_cv_atomic_byte=yes],
> +      [druntime_cv_atomic_byte=no])
> +  ])
> +  AC_MSG_RESULT($druntime_cv_atomic_byte)

Link tests generally don't work for newlib targets, since they often
require a specific command-line option to specify the target system.
But perhaps you don't support newlib targets anyway.  Either way,
it shouldn't hold up acceptance.

> --- /dev/null
> +++ b/libphobos/src/Makefile.am
> @@ -0,0 +1,211 @@
> +# Makefile for the Phobos standard library.
> +# Copyright (C) 2012-2017 Free Software Foundation, Inc.

2012-2018.

> diff --git a/libphobos/testsuite/Makefile.am b/libphobos/testsuite/Makefile.am
> new file mode 100644
> index 00000000000..dd99d9d871e
> --- /dev/null
> +++ b/libphobos/testsuite/Makefile.am
> @@ -0,0 +1,15 @@
> +## Process this file with automake to produce Makefile.in.
> +
> +AUTOMAKE_OPTIONS = foreign dejagnu
> +
> +# Setup the testing framework, if you have one
> +EXPECT = $(shell if test -f $(top_builddir)/../expect/expect; then \
> +	   echo $(top_builddir)/../expect/expect; else echo expect; fi)
> +
> +_RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
> +	     echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
> +RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)"
> +
> +AM_MAKEFLAGS = "EXEEXT=$(EXEEXT)"
> +
> +CLEANFILES = *.log *.sum

Should probably have a copyright & licence here too, even though
it's small, since it could grow in future.

> +// { dg-shouldfail "static_dtor_exception" }
> +// { dg-output "object.Exception@.*: static_dtor_exception" }
> +// Issue 16594
> +import core.stdc.stdio;

Which bug tracker is this referring to?  Maybe a URI would be better,
to avoid confusion with GCC's bugzilla.  Same for other bugzilla
references in later tests.  Or just remove if the tracker isn't public.

OK otherwise, thanks.

I think that's the last of the unreviewed patches.  Let me know
if I missed one.

Richard

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 14/14] Add D Phobos config, makefiles, and testsuite.
  2018-10-16 18:39 ` Richard Sandiford
@ 2018-10-18 23:19   ` Iain Buclaw
  2018-10-22  8:18   ` Iain Buclaw
  1 sibling, 0 replies; 10+ messages in thread
From: Iain Buclaw @ 2018-10-18 23:19 UTC (permalink / raw)
  To: gcc-patches, richard.sandiford

On Tue, 16 Oct 2018 at 19:01, Richard Sandiford
<richard.sandiford@arm.com> wrote:
>
> Iain Buclaw <ibuclaw@gdcproject.org> writes:
> > diff --git a/libphobos/d_rules.am b/libphobos/d_rules.am
> > new file mode 100644
> > index 00000000000..b16cf5052d2
> > --- /dev/null
> > +++ b/libphobos/d_rules.am
> > @@ -0,0 +1,60 @@
> > +# This file contains some common rules for D source compilation
> > +# used for libdruntime and libphobos
> > +
> > +# If there are no sources with known extension (i.e. only D sources)
> > +# automake forgets to set this
>
> Needs a copyright notice and licence.
>

OK.

> > +# AC_LANG(D)
> > +# -----------
> > +# (we have to use GDC as variable prefix as our GCC patches set GDC
> > +#  GDC_FOR_BUILD etc. If we ever want to support other D compilers all
> > +#  names need to be changed to DC)
>
> Seems like this is still talking about GDC as a separate project.
>

Will remove.

> > +  # This checks to see if the host supports the compiler-generated builtins
> > +  # for atomic operations for various integral sizes. Note, this is intended
> > +  # to be an all-or-nothing switch, so all the atomic operations that are
> > +  # used should be checked.
> > +  AC_MSG_CHECKING([for atomic builtins for byte])
> > +  AC_CACHE_VAL(druntime_cv_atomic_byte, [
> > +    AC_TRY_LINK(
> > +      [import gcc.builtins;], [
> > +      shared(byte) c1;
> > +       byte c2, c3;
> > +       __atomic_compare_exchange_1(&c1, &c2, c3, false, 5, 5);
> > +       __atomic_load_1(&c1, 5);
> > +       __atomic_store_1(&c1, c2, 5);
> > +       return 0;
> > +      ],
> > +      [druntime_cv_atomic_byte=yes],
> > +      [druntime_cv_atomic_byte=no])
> > +  ])
> > +  AC_MSG_RESULT($druntime_cv_atomic_byte)
>
> Link tests generally don't work for newlib targets, since they often
> require a specific command-line option to specify the target system.
> But perhaps you don't support newlib targets anyway.  Either way,
> it shouldn't hold up acceptance.
>

Targets using newlib are definitely not supported.  First off, there
would need to be relevant C bindings added to the druntime library
where appropriate.

> > --- /dev/null
> > +++ b/libphobos/src/Makefile.am
> > @@ -0,0 +1,211 @@
> > +# Makefile for the Phobos standard library.
> > +# Copyright (C) 2012-2017 Free Software Foundation, Inc.
>
> 2012-2018.
>

I will follow this up with a patch to contrib/update_copyrights.py so
that this is never missed in future.

> > diff --git a/libphobos/testsuite/Makefile.am b/libphobos/testsuite/Makefile.am
> > new file mode 100644
> > index 00000000000..dd99d9d871e
> > --- /dev/null
> > +++ b/libphobos/testsuite/Makefile.am
> > @@ -0,0 +1,15 @@
> > +## Process this file with automake to produce Makefile.in.
> > +
> > +AUTOMAKE_OPTIONS = foreign dejagnu
> > +
> > +# Setup the testing framework, if you have one
> > +EXPECT = $(shell if test -f $(top_builddir)/../expect/expect; then \
> > +        echo $(top_builddir)/../expect/expect; else echo expect; fi)
> > +
> > +_RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
> > +          echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
> > +RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)"
> > +
> > +AM_MAKEFLAGS = "EXEEXT=$(EXEEXT)"
> > +
> > +CLEANFILES = *.log *.sum
>
> Should probably have a copyright & licence here too, even though
> it's small, since it could grow in future.
>

OK, done.

> > +// { dg-shouldfail "static_dtor_exception" }
> > +// { dg-output "object.Exception@.*: static_dtor_exception" }
> > +// Issue 16594
> > +import core.stdc.stdio;
>
> Which bug tracker is this referring to?  Maybe a URI would be better,
> to avoid confusion with GCC's bugzilla.  Same for other bugzilla
> references in later tests.  Or just remove if the tracker isn't public.
>

They are referring to upstream bug-tracker http://issues.dlang.org/

I'll fix them up accordingly here, will also send them upstream too as
clickable links are generally favoured.

>
> I think that's the last of the unreviewed patches.  Let me know
> if I missed one.
>

Addressing these comments has taken a little longer than I hoped,
partly due to time constraints on my side leaving me to go through
this during the dark hours of the night.

What else would be left to do here once all has been addressed?

Thanks.
-- 
Iain

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 14/14] Add D Phobos config, makefiles, and testsuite.
  2018-10-16 18:39 ` Richard Sandiford
  2018-10-18 23:19   ` Iain Buclaw
@ 2018-10-22  8:18   ` Iain Buclaw
  1 sibling, 0 replies; 10+ messages in thread
From: Iain Buclaw @ 2018-10-22  8:18 UTC (permalink / raw)
  To: gcc-patches; +Cc: richard.sandiford

[-- Attachment #1: Type: text/plain, Size: 3656 bytes --]

On Tue, 16 Oct 2018 at 19:01, Richard Sandiford
<richard.sandiford@arm.com> wrote:
>
> Iain Buclaw <ibuclaw@gdcproject.org> writes:
> > diff --git a/libphobos/d_rules.am b/libphobos/d_rules.am
> > new file mode 100644
> > index 00000000000..b16cf5052d2
> > --- /dev/null
> > +++ b/libphobos/d_rules.am
> > @@ -0,0 +1,60 @@
> > +# This file contains some common rules for D source compilation
> > +# used for libdruntime and libphobos
> > +
> > +# If there are no sources with known extension (i.e. only D sources)
> > +# automake forgets to set this
>
> Needs a copyright notice and licence.
>
> > +# AC_LANG(D)
> > +# -----------
> > +# (we have to use GDC as variable prefix as our GCC patches set GDC
> > +#  GDC_FOR_BUILD etc. If we ever want to support other D compilers all
> > +#  names need to be changed to DC)
>
> Seems like this is still talking about GDC as a separate project.
>
> > +  # This checks to see if the host supports the compiler-generated builtins
> > +  # for atomic operations for various integral sizes. Note, this is intended
> > +  # to be an all-or-nothing switch, so all the atomic operations that are
> > +  # used should be checked.
> > +  AC_MSG_CHECKING([for atomic builtins for byte])
> > +  AC_CACHE_VAL(druntime_cv_atomic_byte, [
> > +    AC_TRY_LINK(
> > +      [import gcc.builtins;], [
> > +      shared(byte) c1;
> > +       byte c2, c3;
> > +       __atomic_compare_exchange_1(&c1, &c2, c3, false, 5, 5);
> > +       __atomic_load_1(&c1, 5);
> > +       __atomic_store_1(&c1, c2, 5);
> > +       return 0;
> > +      ],
> > +      [druntime_cv_atomic_byte=yes],
> > +      [druntime_cv_atomic_byte=no])
> > +  ])
> > +  AC_MSG_RESULT($druntime_cv_atomic_byte)
>
> Link tests generally don't work for newlib targets, since they often
> require a specific command-line option to specify the target system.
> But perhaps you don't support newlib targets anyway.  Either way,
> it shouldn't hold up acceptance.
>
> > --- /dev/null
> > +++ b/libphobos/src/Makefile.am
> > @@ -0,0 +1,211 @@
> > +# Makefile for the Phobos standard library.
> > +# Copyright (C) 2012-2017 Free Software Foundation, Inc.
>
> 2012-2018.
>
> > diff --git a/libphobos/testsuite/Makefile.am b/libphobos/testsuite/Makefile.am
> > new file mode 100644
> > index 00000000000..dd99d9d871e
> > --- /dev/null
> > +++ b/libphobos/testsuite/Makefile.am
> > @@ -0,0 +1,15 @@
> > +## Process this file with automake to produce Makefile.in.
> > +
> > +AUTOMAKE_OPTIONS = foreign dejagnu
> > +
> > +# Setup the testing framework, if you have one
> > +EXPECT = $(shell if test -f $(top_builddir)/../expect/expect; then \
> > +        echo $(top_builddir)/../expect/expect; else echo expect; fi)
> > +
> > +_RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
> > +          echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
> > +RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)"
> > +
> > +AM_MAKEFLAGS = "EXEEXT=$(EXEEXT)"
> > +
> > +CLEANFILES = *.log *.sum
>
> Should probably have a copyright & licence here too, even though
> it's small, since it could grow in future.
>
> > +// { dg-shouldfail "static_dtor_exception" }
> > +// { dg-output "object.Exception@.*: static_dtor_exception" }
> > +// Issue 16594
> > +import core.stdc.stdio;
>
> Which bug tracker is this referring to?  Maybe a URI would be better,
> to avoid confusion with GCC's bugzilla.  Same for other bugzilla
> references in later tests.  Or just remove if the tracker isn't public.
>
> OK otherwise, thanks.
>
> I think that's the last of the unreviewed patches.  Let me know
> if I missed one.
>

Attaching updates as per above comments.

Regards
--
Iain

[-- Attachment #2: 14-v4v5-d-phobos-misc.patch --]
[-- Type: application/x-patch, Size: 8723 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 14/14] Add D Phobos config, makefiles, and testsuite.
  2018-09-18  0:42 [PATCH 14/14] Add D Phobos config, makefiles, and testsuite Iain Buclaw
  2018-10-16 18:39 ` Richard Sandiford
@ 2019-04-20 21:22 ` Thomas Schwinge
  2019-04-20 21:54   ` Iain Buclaw
  2019-09-03  6:10   ` [PATCH] [LIBPHOBOS] Fix multi-lib RUNTESTFLAGS handling Bernd Edlinger
  1 sibling, 2 replies; 10+ messages in thread
From: Thomas Schwinge @ 2019-04-20 21:22 UTC (permalink / raw)
  To: Iain Buclaw, gcc-patches; +Cc: Rainer Orth, Mike Stump


[-- Attachment #1.1: Type: text/plain, Size: 1284 bytes --]

Hi!

On Tue, 18 Sep 2018 02:39:46 +0200, Iain Buclaw <ibuclaw@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



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Fix-libphobos-testsuite-libgcc-multilib-search.trunk.patch --]
[-- Type: text/x-diff, Size: 2729 bytes --]

From 5eb9e491a66c231df573d1915ba8c5f533e03d2c Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 658 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 14/14] Add D Phobos config, makefiles, and testsuite.
  2019-04-20 21:22 ` Thomas Schwinge
@ 2019-04-20 21:54   ` Iain Buclaw
  2019-10-30 12:06     ` Thomas Schwinge
  2019-09-03  6:10   ` [PATCH] [LIBPHOBOS] Fix multi-lib RUNTESTFLAGS handling Bernd Edlinger
  1 sibling, 1 reply; 10+ messages in thread
From: Iain Buclaw @ 2019-04-20 21:54 UTC (permalink / raw)
  To: Thomas Schwinge; +Cc: gcc-patches, Rainer Orth, Mike Stump

On Sat, 20 Apr 2019 at 22:30, Thomas Schwinge <thomas@codesourcery.com> wrote:
>
> Hi!
>
> On Tue, 18 Sep 2018 02:39:46 +0200, Iain Buclaw <ibuclaw@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>.
>

Seems reasonable to me.

-- 
Iain

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] [LIBPHOBOS] Fix multi-lib RUNTESTFLAGS handling
@ 2019-09-03  6:10   ` Bernd Edlinger
  2019-09-03  8:04     ` Iain Buclaw
  0 siblings, 1 reply; 10+ messages in thread
From: Bernd Edlinger @ 2019-09-03  6:10 UTC (permalink / raw)
  To: gcc-patches, Iain Buclaw

[-- Attachment #1: Type: text/plain, Size: 683 bytes --]

Hi,


I've noticed that testing libphobos fails for multi-lib configs:

$ make check-target-libphobos RUNTESTFLAGS="--target_board=unix\{-m32,\}"

fails for every 32bit execution, because the host libgcc_s.so is used which
is not the correct version:

spawn [open ...]
./test_aa.exe: /lib/i386-linux-gnu/libgcc_s.so.1: version `GCC_7.0.0' not found (required by ./test_aa.exe)
FAIL: libphobos.aa/test_aa.d execution test

This can be fixed by adding a few lines from libstdc++/testsuite/lib/libstdc++.exp
to libphobos/testsuite/lib/libphobos.exp, see attached patch.


Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
Is it OK for trunk?


Thanks
Bernd.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch-libphobos.diff --]
[-- Type: text/x-patch; name="patch-libphobos.diff", Size: 1167 bytes --]

2019-09-02  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	* testsuite/lib/libphobos.exp (libphobos_init): Add multi-lib libgcc dirs
	to the ld_library_path var.

Index: libphobos/testsuite/lib/libphobos.exp
===================================================================
--- libphobos/testsuite/lib/libphobos.exp	(revision 275320)
+++ libphobos/testsuite/lib/libphobos.exp	(working copy)
@@ -170,6 +170,25 @@ 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 != ""} {
+	set compiler ${gccdir}/gdc
+
+	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"

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] [LIBPHOBOS] Fix multi-lib RUNTESTFLAGS handling
  2019-09-03  6:10   ` [PATCH] [LIBPHOBOS] Fix multi-lib RUNTESTFLAGS handling Bernd Edlinger
@ 2019-09-03  8:04     ` Iain Buclaw
  2019-10-30 11:54       ` Thomas Schwinge
  0 siblings, 1 reply; 10+ messages in thread
From: Iain Buclaw @ 2019-09-03  8:04 UTC (permalink / raw)
  To: Bernd Edlinger; +Cc: gcc-patches

On Tue, 3 Sep 2019 at 08:10, Bernd Edlinger <bernd.edlinger@hotmail.de> wrote:
>
> Hi,
>
>
> I've noticed that testing libphobos fails for multi-lib configs:
>
> $ make check-target-libphobos RUNTESTFLAGS="--target_board=unix\{-m32,\}"
>
> fails for every 32bit execution, because the host libgcc_s.so is used which
> is not the correct version:
>
> spawn [open ...]
> ./test_aa.exe: /lib/i386-linux-gnu/libgcc_s.so.1: version `GCC_7.0.0' not found (required by ./test_aa.exe)
> FAIL: libphobos.aa/test_aa.d execution test
>
> This can be fixed by adding a few lines from libstdc++/testsuite/lib/libstdc++.exp
> to libphobos/testsuite/lib/libphobos.exp, see attached patch.
>
>
> Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
> Is it OK for trunk?
>

OK.

-- 
Iain

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] [LIBPHOBOS] Fix multi-lib RUNTESTFLAGS handling
  2019-09-03  8:04     ` Iain Buclaw
@ 2019-10-30 11:54       ` Thomas Schwinge
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Schwinge @ 2019-10-30 11:54 UTC (permalink / raw)
  To: gcc-patches, Bernd Edlinger; +Cc: Iain Buclaw


[-- Attachment #1.1: Type: text/plain, Size: 1094 bytes --]

Hi!

On 2019-09-03T10:04:14+0200, Iain Buclaw <ibuclaw@gdcproject.org> wrote:
> On Tue, 3 Sep 2019 at 08:10, Bernd Edlinger <bernd.edlinger@hotmail.de> wrote:
>> I've noticed that testing libphobos fails for multi-lib configs:
>>
>> $ make check-target-libphobos RUNTESTFLAGS="--target_board=unix\{-m32,\}"
>>
>> fails for every 32bit execution, because the host libgcc_s.so is used which
>> is not the correct version:
>>
>> spawn [open ...]
>> ./test_aa.exe: /lib/i386-linux-gnu/libgcc_s.so.1: version `GCC_7.0.0' not found (required by ./test_aa.exe)
>> FAIL: libphobos.aa/test_aa.d execution test
>>
>> This can be fixed by adding a few lines from libstdc++/testsuite/lib/libstdc++.exp
>> to libphobos/testsuite/lib/libphobos.exp, see attached patch.
>>
>>
>> Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
>> Is it OK for trunk?
>
> OK.

The very same problem existed since the beginning of D language support
in GCC, so I backported this to gcc-9-branch in r277611 "[LIBPHOBOS] Fix
multi-lib RUNTESTFLAGS handling", see attached.


Grüße
 Thomas



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-LIBPHOBOS-Fix-multi-lib-RUNTESTFLAGS-ha.gcc-9-branch.patch --]
[-- Type: text/x-diff, Size: 2784 bytes --]

From 2dba914d0a00623209ce8f9ceaf28e2d5e2ceb06 Mon Sep 17 00:00:00 2001
From: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed, 30 Oct 2019 11:51:15 +0000
Subject: [PATCH] [LIBPHOBOS] Fix multi-lib RUNTESTFLAGS handling

Testing libphobos fails for multi-lib configs:

$ make check-target-libphobos RUNTESTFLAGS="--target_board=unix\{-m32,\}"

fails for every 32bit execution, because the host libgcc_s.so is used which
is not the correct version:

spawn [open ...]
./test_aa.exe: /lib/i386-linux-gnu/libgcc_s.so.1: version `GCC_7.0.0' not found (required by ./test_aa.exe)
FAIL: libphobos.aa/test_aa.d execution test

This can be fixed by adding a few lines from libstdc++/testsuite/lib/libstdc++.exp
to libphobos/testsuite/lib/libphobos.exp

Backport trunk r275332:

	libphobos/
	2019-09-03  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	* testsuite/lib/libphobos.exp (libphobos_init): Add multi-lib libgcc
	dirs to the ld_library_path var.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-9-branch@277611 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libphobos/ChangeLog                   |  9 +++++++++
 libphobos/testsuite/lib/libphobos.exp | 19 +++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/libphobos/ChangeLog b/libphobos/ChangeLog
index 24de0ab9bd8..becd8b1ec86 100644
--- a/libphobos/ChangeLog
+++ b/libphobos/ChangeLog
@@ -1,3 +1,12 @@
+2019-10-30  Thomas Schwinge  <thomas@codesourcery.com>
+
+	Backport from trunk:
+
+	2019-09-03  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+	* testsuite/lib/libphobos.exp (libphobos_init): Add multi-lib libgcc
+	dirs to the ld_library_path var.
+
 2019-08-12  Release Manager
 
 	* GCC 9.2.0 released.
diff --git a/libphobos/testsuite/lib/libphobos.exp b/libphobos/testsuite/lib/libphobos.exp
index d3fe75358c8..056e8f1d444 100644
--- a/libphobos/testsuite/lib/libphobos.exp
+++ b/libphobos/testsuite/lib/libphobos.exp
@@ -170,6 +170,25 @@ 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 != ""} {
+	set compiler ${gccdir}/gdc
+
+	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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 658 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 14/14] Add D Phobos config, makefiles, and testsuite.
  2019-04-20 21:54   ` Iain Buclaw
@ 2019-10-30 12:06     ` Thomas Schwinge
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Schwinge @ 2019-10-30 12:06 UTC (permalink / raw)
  To: gcc-patches; +Cc: Iain Buclaw, Rainer Orth, Mike Stump, Bernd Edlinger


[-- Attachment #1.1: Type: text/plain, Size: 2100 bytes --]

Hi!

Just for posterity.

On 2019-04-20T23:22:31+0200, Iain Buclaw <ibuclaw@gdcproject.org> wrote:
> On Sat, 20 Apr 2019 at 22:30, Thomas Schwinge <thomas@codesourcery.com> wrote:
>> On Tue, 18 Sep 2018 02:39:46 +0200, Iain Buclaw <ibuclaw@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>.
>
> Seems reasonable to me.

I didn't get this committed promptly -- and in the mean time (what's half
a year, eh?), Bernd addressed the same issue:
<http://mid.mail-archive.com/AM6PR10MB2566B6AD3CAA9BEF6CA99C9DE4B90@AM6PR10MB2566.EURPRD10.PROD.OUTLOOK.COM>.

There remain a few incremental changes from his committed to my
originally proposed version (see attached), but I'm not committing that
now, as it's not affecting test results, and refactoring all the '*.exp'
files, unifying what has been copied from elsewhere, is a (big) task for
another day (weeks...).


Grüße
 Thomas



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Fix-libphobos-testsuite-libgcc-multilib-search.trunk.patch --]
[-- Type: text/x-diff, Size: 2348 bytes --]

From 0bd05a08a98a95d56b4b469dd6e68d485e70ab69 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <tschwing@mentor.com>
Date: Fri, 4 Oct 2019 13:06:08 +0200
Subject: [PATCH] Fix libphobos testsuite libgcc multilib search path
 (remaining pieces)

Changes similar to my original ones have already been committed in r275332.
---
 libphobos/testsuite/lib/libphobos.exp | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/libphobos/testsuite/lib/libphobos.exp b/libphobos/testsuite/lib/libphobos.exp
index 056e8f1d444..866090656c6 100644
--- a/libphobos/testsuite/lib/libphobos.exp
+++ b/libphobos/testsuite/lib/libphobos.exp
@@ -106,6 +106,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 {
@@ -153,13 +162,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}"] } {
@@ -172,7 +182,12 @@ proc libphobos_init { args } {
 
     # Compute what needs to be added to the existing LD_LIBRARY_PATH.
     if {$gccdir != ""} {
-	set compiler ${gccdir}/gdc
+	# 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]" {
-- 
2.17.1


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 658 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-10-30 12:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-18  0:42 [PATCH 14/14] Add D Phobos config, makefiles, and testsuite Iain Buclaw
2018-10-16 18:39 ` Richard Sandiford
2018-10-18 23:19   ` Iain Buclaw
2018-10-22  8:18   ` Iain Buclaw
2019-04-20 21:22 ` Thomas Schwinge
2019-04-20 21:54   ` Iain Buclaw
2019-10-30 12:06     ` Thomas Schwinge
2019-09-03  6:10   ` [PATCH] [LIBPHOBOS] Fix multi-lib RUNTESTFLAGS handling Bernd Edlinger
2019-09-03  8:04     ` Iain Buclaw
2019-10-30 11:54       ` Thomas Schwinge

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