From owner-freebsd-hackers Thu Jun 18 15:53:05 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id PAA02016 for freebsd-hackers-outgoing; Thu, 18 Jun 1998 15:53:05 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from alpo.whistle.com (alpo.whistle.com [207.76.204.38]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id PAA01996 for ; Thu, 18 Jun 1998 15:52:57 -0700 (PDT) (envelope-from ambrisko@whistle.com) Received: (from daemon@localhost) by alpo.whistle.com (8.8.5/8.8.5) id PAA06483; Thu, 18 Jun 1998 15:49:46 -0700 (PDT) Received: from crab.whistle.com(207.76.205.112), claiming to be "whistle.com" via SMTP by alpo.whistle.com, id smtpd006474; Thu Jun 18 22:49:39 1998 Received: (from ambrisko@localhost) by whistle.com (8.8.8/8.8.7) id PAA25002; Thu, 18 Jun 1998 15:44:57 -0700 (PDT) (envelope-from ambrisko) From: Doug Ambrisko Message-Id: <199806182244.PAA25002@whistle.com> Subject: Re: Problem with ld.so + LD_PRELOAD + _init() In-Reply-To: from =?ISO-8859-1?Q?Mikko_Ty=F6l=E4j=E4rvi?= at "Jun 17, 98 05:30:47 pm" To: mikko@dynas.se Date: Thu, 18 Jun 1998 15:44:57 -0700 (PDT) Cc: freebsd-hackers@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL29 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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