[D-runtime] druntime ModuleInfo discovery without bracketing segments

Jacob Carlborg doob at me.com
Mon Sep 2 11:32:16 PDT 2013


On 1 sep 2013, at 20:26, David Nadlinger <code at klickverbot.at> wrote:

> The only thing I couldn't quite reuse from your (Martin's) solution is
> the trick of using a comdat .ctors.* section to make sure the
> compiler-generated ctor calling _d_dso_registry is only called once,
> as I couldn't get LLVM to mark the section for a weak variable as
> comdat if a custom section name is specified. One way around this
> might be using (LLVM-) module-level inline asm (though that might
> again cause problems w.r.t. bitcode-level module linking), but I think
> it should be possible to just use a (hidden) global boolean flag to
> ensure the ctor/dtor is only run once.


Clang uses module-level inline assembly for some symbols in Objective-C.

-- 
/Jacob Carlborg



More information about the D-runtime mailing list