Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Calling .init and .fini from dynamic libraries

From: Dan Brosemer <odin(at)svartalfheim.net>
Date: Sun Aug 24 2003 - 13:40:29 EDT


In trying to port wine (ReWind) to OpenBSD 3.4-beta, I've come to believe that when loading dynamic libraries, the .init and .fini sections are never called.

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
-Dan

--

"Burnished gallows set with red
 Caress the fevered, empty mind
 Of man who hangs bloodied and blind
 To reach for wisdom, not for bread." -- Deoridhe Grimsdaughter Received on Sun Aug 24 13:41:44 2003

Do you need help?X

This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 13:48:43 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library