Fix libphobos testsuite failures on Solaris

Message ID yddr2cvy15f.fsf@CeBiTec.Uni-Bielefeld.DE
State New
Headers show
Series
  • Fix libphobos testsuite failures on Solaris
Related show

Commit Message

Rainer Orth Jan. 29, 2019, 2:43 p.m.
Yet another trivial fix for a Solaris libphobos testsuite failure:

FAIL: libphobos.shared/load.d -shared-libphobos -ldl (test for excess errors)
Excess errors:
/vol/gcc/src/hg/trunk/local/libphobos/testsuite/libphobos.shared/load.d:9: error: static assert  "unimplemented"

I guess this is obvious?  Tested on i386-pc-solaris2.11.  Ok for
mainline?

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2018-12-11  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* testsuite/libphobos.shared/load.d [Solaris]: Import
	core.sys.solaris.dlfcn.

Comments

Iain Buclaw Feb. 18, 2019, 11:10 p.m. | #1
On Tue, 29 Jan 2019 at 15:44, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
>

> Yet another trivial fix for a Solaris libphobos testsuite failure:

>

> FAIL: libphobos.shared/load.d -shared-libphobos -ldl (test for excess errors)

> Excess errors:

> /vol/gcc/src/hg/trunk/local/libphobos/testsuite/libphobos.shared/load.d:9: error: static assert  "unimplemented"

>

> I guess this is obvious?  Tested on i386-pc-solaris2.11.  Ok for

> mainline?

>


Looks ok.

As the OS-specific bindings are only imported for RTLD_NOLOAD, this
could be made explicit in the static assert.

---
import core.sys.posix.dlfcn;

version (DragonFlyBSD) import core.sys.dragonflybsd.dlfcn : RTLD_NOLOAD;
version (FreeBSD) import core.sys.freebsd.dlfcn : RTLD_NOLOAD;
version (linux) import core.sys.linux.dlfcn : RTLD_NOLOAD;
version (NetBSD) import core.sys.netbsd.dlfcn : RTLD_NOLOAD;
version (OSX) import core.sys.darwin.dlfcn : RTLD_NOLOAD;
version (Solaris) import core.sys.solaris.dlfcn : RTLD_NOLOAD;

static assert(__traits(compiles, RTLD_NOLOAD), "unimplemented");
---


-- 
Iain
Rainer Orth Feb. 19, 2019, 12:46 p.m. | #2
Hi Iain,

> On Tue, 29 Jan 2019 at 15:44, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:

>>

>> Yet another trivial fix for a Solaris libphobos testsuite failure:

>>

>> FAIL: libphobos.shared/load.d -shared-libphobos -ldl (test for excess errors)

>> Excess errors:

>> /vol/gcc/src/hg/trunk/local/libphobos/testsuite/libphobos.shared/load.d:9:

>> error: static assert "unimplemented"

>>

>> I guess this is obvious?  Tested on i386-pc-solaris2.11.  Ok for

>> mainline?

>>

>

> Looks ok.

>

> As the OS-specific bindings are only imported for RTLD_NOLOAD, this

> could be made explicit in the static assert.

>

> ---

> import core.sys.posix.dlfcn;

>

> version (DragonFlyBSD) import core.sys.dragonflybsd.dlfcn : RTLD_NOLOAD;

> version (FreeBSD) import core.sys.freebsd.dlfcn : RTLD_NOLOAD;

> version (linux) import core.sys.linux.dlfcn : RTLD_NOLOAD;

> version (NetBSD) import core.sys.netbsd.dlfcn : RTLD_NOLOAD;

> version (OSX) import core.sys.darwin.dlfcn : RTLD_NOLOAD;

> version (Solaris) import core.sys.solaris.dlfcn : RTLD_NOLOAD;

>

> static assert(__traits(compiles, RTLD_NOLOAD), "unimplemented");

> ---


indeed, that's certainly clearer.  Here's what I've committed after
testing on Linux/x86_64 (all libphobos.shared tests continue to pass)
and Solaris 11.5/x86 with dlpi_tls_modid (load.d compiles, but fails at
runtime as before:

core.exception.AssertError@/vol/gcc/src/hg/trunk/solaris-asan/libphobos/testsuite/libphobos.shared/load.d(147): Assertion failure

That's the same dlclose issue as discussed in PR d/88150 and the
gcc-patches thread starting at

	https://gcc.gnu.org/ml/gcc-patches/2019-01/msg01661.html

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2019-02-19  Iain Buclaw  <ibuclaw@gdcproject.org>

	* testsuite/libphobos.shared/load.d: Import core.sys.posix.dlfcn.
	[DragonFlyBSD, FreeBSD, linux, NetBSD, OSX, Solaris]: Import only
	RTLD_NOLOAD from core.sys.*.dlfcn.
	Assert RTLD_NOLOAD is available.
# HG changeset patch
# Parent  f954e54dcb5f39ad242574b49c3a99645396e20e
Fix libphobos testsuite failures on Solaris

diff --git a/libphobos/testsuite/libphobos.shared/load.d b/libphobos/testsuite/libphobos.shared/load.d
--- a/libphobos/testsuite/libphobos.shared/load.d
+++ b/libphobos/testsuite/libphobos.shared/load.d
@@ -3,10 +3,16 @@ import core.stdc.stdio;
 import core.stdc.string;
 import core.thread;
 
-version (linux) import core.sys.linux.dlfcn;
-else version (FreeBSD) import core.sys.freebsd.dlfcn;
-else version (NetBSD) import core.sys.netbsd.dlfcn;
-else static assert(0, "unimplemented");
+import core.sys.posix.dlfcn;
+
+version (DragonFlyBSD) import core.sys.dragonflybsd.dlfcn : RTLD_NOLOAD;
+version (FreeBSD) import core.sys.freebsd.dlfcn : RTLD_NOLOAD;
+version (linux) import core.sys.linux.dlfcn : RTLD_NOLOAD;
+version (NetBSD) import core.sys.netbsd.dlfcn : RTLD_NOLOAD;
+version (OSX) import core.sys.darwin.dlfcn : RTLD_NOLOAD;
+version (Solaris) import core.sys.solaris.dlfcn : RTLD_NOLOAD;
+
+static assert(__traits(compiles, RTLD_NOLOAD), "unimplemented");
 
 void loadSym(T)(void* handle, ref T val, const char* mangle)
 {

Patch

# HG changeset patch
# Parent  72693fde3d76ea72811c57d822fd624c0dc3594f
Fix libphobos testsuite failures on Solaris

diff --git a/libphobos/testsuite/libphobos.shared/load.d b/libphobos/testsuite/libphobos.shared/load.d
--- a/libphobos/testsuite/libphobos.shared/load.d
+++ b/libphobos/testsuite/libphobos.shared/load.d
@@ -6,6 +6,7 @@  import core.thread;
 version (linux) import core.sys.linux.dlfcn;
 else version (FreeBSD) import core.sys.freebsd.dlfcn;
 else version (NetBSD) import core.sys.netbsd.dlfcn;
+else version (Solaris) import core.sys.solaris.dlfcn;
 else static assert(0, "unimplemented");
 
 void loadSym(T)(void* handle, ref T val, const char* mangle)