From owner-freebsd-hackers  Tue Jul 18 10:14:40 2000
Delivered-To: freebsd-hackers@freebsd.org
Received: from hotmail.com (f328.law7.hotmail.com [216.33.236.206])
	by hub.freebsd.org (Postfix) with SMTP id 7EB4637B6E5
	for <freebsd-hackers@FreeBSD.ORG>; Tue, 18 Jul 2000 10:14:38 -0700 (PDT)
	(envelope-from johnnyteardrop@hotmail.com)
Received: (qmail 22496 invoked by uid 0); 18 Jul 2000 17:14:38 -0000
Message-ID: <20000718171438.22495.qmail@hotmail.com>
Received: from 209.249.186.215 by www.hotmail.com with HTTP;
	Tue, 18 Jul 2000 10:14:38 PDT
X-Originating-IP: [209.249.186.215]
From: "Greg Thompson" <johnnyteardrop@hotmail.com>
To: freebsd-hackers@FreeBSD.ORG
Subject: rtld problem
Date: Tue, 18 Jul 2000 13:14:38 EDT
Mime-Version: 1.0
Content-Type: text/plain; format=flowed
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
X-Loop: FreeBSD.ORG

hackers,

i'm having trouble with the runtime linker.  it seems like a bug, but 
perhaps there's something mystical i'm supposed to do to make this work.  
the short version of what i'm seeing is this:

my app references symbols in a shared lib.  the shared lib uses symbols in 
another shared lib.  if i like my app only against lib #1, it crashes while 
initializing static objects in lib #2.  if i link my app against both lib #1 
and lib #2, it runs fine.  i believe the problem is that the runtime 
linker/loader is initializing objects out of order.

okay, the longer version:

i create shared lib A kinda like this:

g++ obj1.o obj2.o ... -pthread -shared -Wl,-h,libA.so.5 -o libA.so.5
ln -s libA.so.5 libA.so

then i create shared lib B sorta like this:

g++ obj3.o obj4.o ... -pthread -shared -lA -Wl,-h,libB.so.5 -o libB.so.5
ln -s libB.so.5 libB.so

then if i make the app like so:

g++ app.o -lB -pthread -o app

it cores at startup.  if i make it like this:

g++ app.o -lA -lB -pthread -o app

it runs fine.

this is not good.  is there something i'm missing?  if not, how do i go 
about building a debug version of the runtime linker so i can debug this 
bastage?  thanks.

btw: this works fine under linux (gcc 2.95.2, ld 2.9.5, glibc 2.1.3) and 
under solaris (sun's CC, ld, libc, etc), so i don't think i'm expecting too 
much.
--
                  -greg

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message