[D-runtime] druntime ModuleInfo discovery without bracketing segments

Johannes Pfau johannespfau at googlemail.com
Mon Jun 17 05:45:45 PDT 2013


Am 14.06.2013 14:58, schrieb David Nadlinger:
> Thus, I thought about using a scheme where there is one global (C
> runtime) ctor per module just like there is in the old one. Instead of
> setting up the _Dmodule_ref chain directly, it would call the
> equivalent of _d_dso_registry. If a DSO info record (struct DSO in
> sections_linux) has not been initialized for the given image yet, the
> function would set it up, and in any case add the passed ModuleInfo*
> to a pointer array in the record.
>
Instead of emitting one constructor per module you could also create a 
special object file with that constructor, then always link against that 
object file when compiling a shared library.

This is also what gcc -shared does: It links in crtbeginS.o and crtendS.o.

-- 
Johannes Pfau



More information about the D-runtime mailing list