Subject: port-amd64/30570: dlopen(..., RTLD_NOW) always returns non-null
To: None <port-amd64-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: None <jlam@NetBSD.org>
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
>Organization:
	The NetBSD Project
>Environment:
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/cvs.netbsd.org/netbsd-2/amd64/obj/sys/arch/amd64/compile/ERACKS amd64
Architecture: x86_64
Machine: amd64
>Description:
	dlopen(..., RTLD_NOW) returns non-null, even if the shared module
	it is asked to open contains unresolved symbols.

>How-To-Repeat:
	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("./test-lib.so", RTLD_NOW);
		printf("%d\n", lib != 0);
		if (lib)
			dlclose(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-lib.so
	% ./test-dlopen
	1

	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.

>Fix:
	N/A