PATCH: Fix DLL constructors on OpenBSD
wiml at underhill.hhhh.org
Sat Jan 3 16:19:16 CST 2004
Alexandre Julliard <julliard at winehq.org> writes:
> The way it normally works is that the _init() function is built from
> the contents of the .init section, so if you add code in .init it's
> supposed to show up in _init().
Ah, right. This doesn't work on OBSD because __init() is fully
defined in crtbeginS.c, instead of being split between crtbegin and
crtend as in most gcc targets, so code added to .init is not
> [....] So there are two separate mechanisms, and
> the constructors are built on top of the .init stuff. In our case we
> need to be in .init because the constructors are normally called after
> the rest of the .init code.
It doesn't appear that the .init code on OpenBSD does anything
before calling the functions listed in .ctors. (Well, that's not
quite true: it sets a flag before calling the ctors.) As long as
the foo.spec.o file is listed early on the linker's command line,
its constructor(s) should be called before any others. The .so's
destructors are called in the reverse order.
What is it that _init() does on Linux, that the DLL init code needs
to run first? I'd be interested in trying to write an autoconf test
or something, if possible.
More information about the wine-devel