Issues with linker map file

Rainer Schuetze r.sagitario at gmx.de
Sun Jan 29 10:49:40 PST 2012



On 29.01.2012 19:20, Benjamin Thaut wrote:
> Am 29.01.2012 18:24, schrieb Rainer Schuetze:
>>
>> I guess you might know, but here are patches to build a phobos.dll, but
>> they are almost 2 years old now:
>> http://d.puremagic.com/issues/show_bug.cgi?id=4071
>
> I'm not really interrested in a phobos shared lib because I only use 2
> modules from phobos (traits, typetuple). I'm currently trying to make a
> shared library version of druntime so that I can create own shared
> libraries that all use the same druntime dll. Doing that I hope to
> bypass all the tls / gc issues, because there is only one instance of
> druntime. I don't want to dynamically load the dlls I just want to link
> them into the executables. If I'm not mistaken that would cause all
> symbols to be already resolved before any D code starts running.
>
> Do you see any problem with this approach?

Most of the patch deals with druntime issues, sharing the phobos library 
is just a simple add-on.

Just a few issues I remember:

- the init code needs to be split into one part that the shared dll can 
do, and one for each client of the dll (e.g. register to get notified in 
case a thread is created (for static TLS ctors), register memory roots 
to be scanned by the GC). Some of this has been done in a recent commit.

- it is not obvious whether the client's module_infos should be shared 
across all clients (my patch does not share these)

- importing data symbols through the import table needs special support 
in the client dll which dmd does not generate. That's why my patch scans 
relocations into the import table to change the place of the relocation 
to the address in the shared dll.

Rainer


More information about the Digitalmars-d mailing list