|
|||||||||||
|
Calling .init and .fini from dynamic libraries
From: Dan Brosemer <odin(at)svartalfheim.net>
Date: Sun Aug 24 2003 - 13:40:29 EDT
loader.c looks like it calls them in _dl_call_init:
DL_DEB(("doing ctors: [%s]\n", object->load_name));
if (object->dyn.init)
(*object->dyn.init)();
but I can't find anything that sets object->dyn.init. I think it should be done in resolve.c in _dl_finalize_object. We have this:
if (object->Dyn.info[DT_INIT])
object->Dyn.info[DT_INIT] += loff;
if (object->Dyn.info[DT_FINI])
object->Dyn.info[DT_FINI] += loff;
But still, the init and fini function pointers go unset. Is this assessment correct? If so, I'll work on a patch, though it may be a bit over my head. Also, same sections are not called when loading a normal ELF executable either. Thorsten Glasser mentioned this in a ports@ post a while back, and he mentioned that Dale Rahn had a patch. I looked for that patch and couldn't find it, so I thought I'd throw mine out there. It's heavily based on changes made to NetBSD when they were trying to get wine running some time ago. http://www.cleannorth.org/~odin/openbsd-patches/csu-3.4.diff
Thanks in advance
--
This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 13:48:43 EDT |
||||||||||
|
|||||||||||