From nobody@FreeBSD.ORG Mon Jun 28 16:36:09 1999
Return-Path: <nobody@FreeBSD.ORG>
Received: by hub.freebsd.org (Postfix, from userid 32767)
	id 900E814DD4; Mon, 28 Jun 1999 16:36:09 -0700 (PDT)
Message-Id: <19990628233609.900E814DD4@hub.freebsd.org>
Date: Mon, 28 Jun 1999 16:36:09 -0700 (PDT)
From: genek@narus.com
Sender: nobody@FreeBSD.ORG
To: freebsd-gnats-submit@freebsd.org
Subject: Dynamic loader or vtable problem in 3.2-STABLE and 4.0-CURRENT
X-Send-Pr-Version: www-1.0

>Number:         12438
>Category:       misc
>Synopsis:       Dynamic loader or vtable problem in 3.2-STABLE and 4.0-CURRENT
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    jdp
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jun 28 16:40:01 PDT 1999
>Closed-Date:    Sun Aug 29 18:58:07 PDT 1999
>Last-Modified:  Sun Aug 29 19:00:27 PDT 1999
>Originator:     Gene Kan
>Release:        3.2-STABLE
>Organization:
Narus, Inc.
>Environment:
FreeBSD freebsd.narus.com 3.2-STABLE FreeBSD 3.2-STABLE #0: Mon Jun 28 07:12:41 GMT 1999  root@freebsd.narus.com:/usr/src/sys/compile/FREEBSD i386
>Description:
Non-unique names across multiple shared objects loaded by dlopen are not uniquely-referenceable in C++.  It seems to work fine in C.
>How-To-Repeat:
liba.so contains class A : public baseclass.
libb.so contains class B : public baseclass.

Both shared objects contain a function getinterface() which returns a
new instance of baseclass appropriate to that .so.

Class A and B implement some method of baseclass.  Load liba.so and
libb.so using dlopen.  Instantiate objects of A and B.

a->function();
b->function();

You will find that both calls do the same thing, that is whatever the
first-loaded .so specified.

Dynamic-object-local namespaces under C++ are properly implemented in
Solaris and Linux, but fail for some reason in FreeBSD.
>Fix:


>Release-Note:
>Audit-Trail:

From: John Polstra <jdp@polstra.com>
To: freebsd-gnats-submit@freebsd.org
Cc: genek@narus.com
Subject: Re: misc/12438: Dynamic loader or vtable problem in 3.2-STABLE and 4.0-CURRENT
Date: Fri, 20 Aug 1999 09:23:04 -0700 (PDT)

 I think I understand, but I want to make sure.
 
 > liba.so contains class A : public baseclass.
 > libb.so contains class B : public baseclass.
 > 
 > Both shared objects contain a function getinterface() which returns a
 > new instance of baseclass appropriate to that .so.
 
 You are saying that getinterface() is a global symbol in each .so,
 right?
 
 John
 
Responsible-Changed-From-To: freebsd-bugs->jdp 
Responsible-Changed-By: jdp 
Responsible-Changed-When: Wed Aug 25 08:09:37 PDT 1999 
Responsible-Changed-Why:  
I have been working on a fix for this bug.  I expect to have something 
ready to test soon. 
State-Changed-From-To: open->closed 
State-Changed-By: jdp 
State-Changed-When: Sun Aug 29 18:58:07 PDT 1999 
State-Changed-Why:  
Fixed by: 

src/libexec/rtld-elf/map_object.c	1.5 
src/libexec/rtld-elf/rtld.c		1.34 
src/libexec/rtld-elf/rtld.h		1.9 
src/libexec/rtld-elf/alpha/reloc.c	1.8 
src/include/dlfcn.h			1.6 
src/sys/sys/queue.h			1.29 
>Unformatted:
