[Issue 16291] phobosinit fails to register encodings on individual tests

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Jul 28 02:58:35 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=16291

Johannes Pfau <johannespfau at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |johannespfau at gmail.com

--- Comment #20 from Johannes Pfau <johannespfau at gmail.com> ---
> as nothing directly referring to module ctors, linker just doesn't know that it > should not optimize 'em away. maybe we can fix that by emiting some flag for .o > files, but i don't really know -- i never even read about dwarf object file
> format, so i'm not sure if such flag exists.

The constructors are referenced by the ModuleInfo. ModuleInfo is theoretically
unreferenced which will cause issues with --gc-sections, but as long as you
don't use --gc-sections that doesn't matter. (LDC has a workaround, IIRC)


The problem in this case is that the linker does not even attempt to link in
the object file though. The linker only looks at object files in a static
library if it still has some unresolved symbols. A solution is using the whole
archive linker option:
http://stackoverflow.com/questions/805555/ld-linker-question-the-whole-archive-option

As you said this will result in bigger executables though.

--


More information about the Digitalmars-d-bugs mailing list