[D-runtime] druntime ModuleInfo discovery without bracketing segments

Martin Nowak dawg at dawgfoto.de
Sun Aug 25 12:02:20 PDT 2013


On 07/24/2013 04:42 PM, Martin Nowak wrote:
> The basic problem to solve is that _minfo* sections must be merged by 
> the linker but _minfo_beg and _minfo_end must not be be external 
> symbols as the executable would superimpose them.
> This is currently done with section groups of internal symbols.
> I recently had the idea that it should also work with hidden external 
> symbols but I still have to verify that.
> If it works we could move the functionality into the glue layer so 
> that it can hopefully be reused by GDC and LDC.
> Otherwise we could also try to add support for section groups and 
> internal symbols in the glue layer but that might be a lot of work.
>
> Best,
> Martin
>
I tried that out and it works.
The linker will correctly merge the external weak symbols, but because 
they are hidden they remain inaccessible
from outside of a shared library. Thus the runtime linker won't 
interpose the bracketing symbols with the ones from
the executable or another shared library.
This should be fairly simple to implement in the glue layer, we only 
need to mark the COMDAT variables as hidden.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/d-runtime/attachments/20130825/48792883/attachment.html>


More information about the D-runtime mailing list