Subject: port-amd64/30570: dlopen(..., RTLD_NOW) always returns non-null
To: None <,,>
From: None <>
List: netbsd-bugs
Date: 06/21/2005 04:16:00
>Number:         30570
>Category:       port-amd64
>Synopsis:       dlopen(..., RTLD_NOW) always returns non-null
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    port-amd64-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 21 04:16:00 +0000 2005
>Originator:     Johnny C. Lam
>Release:        NetBSD 2.0_STABLE
	The NetBSD Project
System: NetBSD er2.home.local 2.0_STABLE NetBSD 2.0_STABLE (ERACKS) #0: Mon Jan 3 00:12:46 EST 2005 jlam@er2.home.local:/local/sources/ amd64
Architecture: x86_64
Machine: amd64
	dlopen(..., RTLD_NOW) returns non-null, even if the shared module
	it is asked to open contains unresolved symbols.

	The following is the exact test case used by the configure script
	in pkgsrc/chat/ircservices:

	% cat test-dlopen.c
	#include <dlfcn.h>
	int main(int argc, char **argv) {
		void *lib = dlopen("./", RTLD_NOW);
		printf("%d\n", lib != 0);
		if (lib)
		return 0;

	% cat test-lib.c
	int foo() {no_such_symbol();}

	% cc -fPIC test-dlopen.c -o test-dlopen
	% cc -shared -fPIC test-lib.c -o
	% ./test-dlopen

	I expected the "test-dlopen" program to print "0", as it did on
	the NetBSD-1.6.2/i386 system I also tested this on.