Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Jan 2000 19:52:18 +0000
From:      Tony Finch <fanf@demon.net>
To:        freebsd-hackers@freebsd.org, jdp@freebsd.org
Cc:        Tony Finch <fanf@demon.net>
Subject:   Re: LD_PRELOAD
Message-ID:  <E12Bk6U-00032O-00@fanf.noc.demon.net>
In-Reply-To: <E12BjiC-00031J-00@fanf.noc.demon.net>
References:  <E12BjiC-00031J-00@fanf.noc.demon.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Tony Finch <fanf@demon.net> wrote:
> 
> This brings me on to the second problem. I want to do some
> initialization of my library before the real action starts. On Solaris
> the linker calls a function in the object called _init() when it is
> loaded; it's easy to make this work. I can see similar functionality
> in FreeBSD's rtld but it looks like I have to jump through obscure
> hoops to make it work (an ELF DT_INIT section if I understand it
> correctly).

After some more playing I found that adding the following declarations
shut up the linker and caused the _init and _fini functions to be
called as I desired. My only remaining questions are whether the gcc
command line I used is correct and if it is what does it all mean?

	#ifdef __FreeBSD__
	static void _init(void) __attribute__ ((section (".init")));
	static void _fini(void) __attribute__ ((section (".fini")));
	#endif

Tony.
-- 
the dot at person


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?E12Bk6U-00032O-00>