August 29, 2013 Re: [D-runtime] druntime ModuleInfo discovery without bracketing segments | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | On Mon, Aug 26, 2013 at 3:10 AM, Martin Nowak <dawg@dawgfoto.de> wrote: > So you can't control the order in which sections are created? This makes me wonder because defining variables in C code with attribute section will also preserve the order. It turns out that it actually might be possible to implement this on LLVM: The problem is not so much the order of symbols when just emitting a single LLVM module to a single object file, but that we also use the LLVM bitcode-level linker, which also has to handle whatever we are doing in a reasonable way (i.e. the desired semantics must actually exist in LLVM IR, not just on the target). In any case, what precise kind of "hidden" are you experimenting with? STV_HIDDEN? I couldn't quite get things to work here, do you maybe have an example patch/asm file/…? Thanks, David _______________________________________________ D-runtime mailing list D-runtime@puremagic.com http://lists.puremagic.com/mailman/listinfo/d-runtime |
September 01, 2013 Re: [D-runtime] druntime ModuleInfo discovery without bracketing segments | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Nadlinger | On Thu, Aug 29, 2013 at 11:29 PM, David Nadlinger <code@klickverbot.at> wrote: > In any case, what precise kind of "hidden" are you experimenting with? STV_HIDDEN? I couldn't quite get things to work here, do you maybe have an example patch/asm file/…? Okay, turns out I just made a stupid mistake; I got the basic mechanism to work with LLVM, even though strictly speaking I might be relying on undefined behavior. 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. Now I just need to find the time to actually implement the change (i.e. the change to ModuleInfo emission plus the _d_dso_registry calls) in LDC, but I think I'll wait with that until the DLL-related dust has settled on the DMD side of things. David _______________________________________________ D-runtime mailing list D-runtime@puremagic.com http://lists.puremagic.com/mailman/listinfo/d-runtime |
September 02, 2013 Re: [D-runtime] druntime ModuleInfo discovery without bracketing segments | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Nadlinger | On 1 sep 2013, at 20:26, David Nadlinger <code@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 _______________________________________________ D-runtime mailing list D-runtime@puremagic.com http://lists.puremagic.com/mailman/listinfo/d-runtime |
Copyright © 1999-2021 by the D Language Foundation