NetBSD Problem Report #8572
Received: (qmail 29739 invoked from network); 6 Oct 1999 21:32:35 -0000
Message-Id: <19991006212816.3625036@black>
Date: Wed, 6 Oct 1999 17:28:16 -0400 (EDT)
From: ezy@panix.com
Reply-To: ezy@panix.com
To: gnats-bugs@gnats.netbsd.org
Subject: dlsym() returns same address for same symbol in different modules
X-Send-Pr-Version: 3.95
>Number: 8572
>Category: lib
>Synopsis: dlsym() returns same address for same symbol in different modules
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: skrll
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Oct 06 14:35:01 +0000 1999
>Closed-Date: Fri Jan 05 13:21:47 +0000 2001
>Last-Modified: Fri Jan 05 13:21:47 +0000 2001
>Originator: Ezra Story
>Release: 1.4
>Organization:
>Environment:
System: NetBSD black 1.4K NetBSD 1.4K (BLACK) #14: Tue Oct 5 17:27:34 EDT 1999 ezy@black:/usr/src/cvs/syssrc/sys/arch/i386/compile/BLACK i386
also current ld.elf_so from Sept 6th
>Description:
Sep 6 22:43 ld.elf_so
See PR#2791 for i386/a.out version and possible fix.
>How-To-Repeat:
Unpack the shar below make and run testmod.
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# Makefile
# main.c
# mod1.c
# mod2.c
#
echo x - Makefile
sed 's/^X//' >Makefile << 'END-of-Makefile'
XCC = cc
XCFLAGS = -g $(SHARED_CFLAGS)
XSHARED_CFLAGS = -fpic
X.SUFFIXES: .so
X
XMODULE_SOURCES = mod1.c mod2.c
X
XMODULES = mod1.so mod2.so
X
XMAIN_SOURCE = main.c
X
XPROG = testmod
X
Xall: $(PROG) $(MODULES)
X
X
X
X$(PROG): $(MAIN_SOURCE)
X $(CC) -o $(PROG) $(MAIN_SOURCE)
X
Xshar testmod.shar: Makefile $(MODULE_SOURCES) $(MAIN_SOURCE)
X shar Makefile $(MODULE_SOURCES) $(MAIN_SOURCE) > testmod.shar
X
X.c.so:
X $(CC) -o tmp.o -c $(CFLAGS) $<
X $(LD) -Bshareable -o $@ tmp.o
X
END-of-Makefile
echo x - main.c
sed 's/^X//' >main.c << 'END-of-main.c'
X#include <stdio.h>
X#include <dlfcn.h>
X
Xtypedef void (*initmodule_funcptr)(void);
X
Xvoid
Xmain(int argc, char *argv[])
X{
X void *module;
X initmodule_funcptr moduleInit;
X
X printf("Opening modules...\n");
X
X /* Open and initialize 1st module */
X module = dlopen("./mod1.so", DL_LAZY);
X if (module == NULL) {
X perror("dlopen(mod1.so)");
X exit(1);
X }
X moduleInit = dlsym(module, "init_module");
X if (moduleInit == NULL) {
X perror("dlsym()");
X exit(1);
X }
X (*moduleInit)();
X
X
X /* Open and initialize 2n module */
X module = dlopen("./mod2.so", DL_LAZY);
X if (module == NULL) {
X perror("dlopen(mod2.so)");
X exit(1);
X }
X moduleInit = dlsym(module, "init_module");
X if (moduleInit == NULL) {
X perror("dlsym()");
X exit(1);
X }
X (*moduleInit)();
X
X exit(0);
X}
X
X
END-of-main.c
echo x - mod1.c
sed 's/^X//' >mod1.c << 'END-of-mod1.c'
X#include <stdio.h>
X
Xvoid
Xinit_module(void)
X{
X printf("init module 1\n");
X}
X
X
END-of-mod1.c
echo x - mod2.c
sed 's/^X//' >mod2.c << 'END-of-mod2.c'
X#include <stdio.h>
X
Xvoid
Xinit_module(void)
X{
X printf("init module 2\n");
X}
X
X
X
END-of-mod2.c
exit
>Fix:
no workaround. PR#2791?
>Release-Note:
>Audit-Trail:
From: itohy@netbsd.org
To: ezy@panix.com
Cc: gnats-bugs@gnats.netbsd.org, netbsd-bugs@gnats.netbsd.org
Subject: Re: lib/8572: dlsym() returns same address for same symbol in different modules
Date: Thu, 7 Oct 1999 09:06:37 +0900 (JST)
Is this related with PR #5890?
I think the pr should be treated as critical / high now.
Does anyone have an idea to correct this?
--
ITOH, Yasufumi <itohy@netbsd.org>
State-Changed-From-To: open->feedback
State-Changed-By: skrll
State-Changed-When: Fri Oct 13 05:44:58 PDT 2000
State-Changed-Why:
This seems to have been fixed by rtld.c:1.24->1.25 sometime ago.
Responsible-Changed-From-To: lib-bug-people->skrll
Responsible-Changed-By: skrll
Responsible-Changed-When: Fri Oct 13 05:44:58 PDT 2000
Responsible-Changed-Why:
Make sure I get the feedback.
State-Changed-From-To: feedback->closed
State-Changed-By: skrll
State-Changed-When: Fri Jan 5 05:14:57 PST 2001
State-Changed-Why:
Should be fixed and no feedback from originator. Please re-submit if
the problem still exists.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.