Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Jun 1998 15:44:57 -0700 (PDT)
From:      Doug Ambrisko <ambrisko@whistle.com>
To:        mikko@dynas.se
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Problem with ld.so + LD_PRELOAD + _init()
Message-ID:  <199806182244.PAA25002@whistle.com>
In-Reply-To: <Pine.GSO.3.96.980617172736.26318G-100000@spirit.dynas.se> from =?ISO-8859-1?Q?Mikko_Ty=F6l=E4j=E4rvi?= at "Jun 17, 98 05:30:47 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
Mikko Työläjärvi writes:
| Fiddling around with LD_PRELOAD and wrapping of system calls, I
| discovered that the "_init()" function of the preloaded lib never gets
| called.
| 
| It is not entirely clear from the man-page that it should be,
| but on Solaris 2.[56], it is.  And it works for libraries linked with
| the program, as well as libraries loaded with dlopen().  Also, it
| sometimes makes life a lot easier...
| 
| A quick look in rtld.c seems to indicate that _init() functions are
| called in order by traversing the dependency graph, starting from the
| main program.  But preloaded libraries are never added to this graph,
| so they never get initialized.  Preloaded libs are included in the
| library search order though, so except for _init() never being called,
| it works as expected.
| 
| This is true on both 2.2.6 and CURRENT as of Jun, 12.
| 
| The question is whether this is intentional or not?

Nope wasn't intentional.  I didn't know that when I helped add that
feature so I never looked at it.

I'm sure jdp wouldn't mind a patch that fixed this.

Doug A.

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199806182244.PAA25002>