digitalmars.D.ldc - dmd verus ldmd2 -lib option
I noticed that dmd -lib breaks up a module into separate .o's when building a static library. This is could help make smaller executables (I am thinking smart phones) when linking with phobos because it will only pull in to .o's needed to satisfy what is referenced. ldmd2 -lib doesn't split into multiple .o's like dmd. Does it seem like a good idea to do the same (I am thinking so). Example: file testlib.d gets split into four .o's cat >testlib.d <<eof void foo() {} void bar() {} void xyzzy() {} eof $ dmd -lib -oflibtest.a testlib.d $ nm libtest.a libtest.a(testlib.o): 0000000000000050 D _D7testlib12__ModuleInfoZ 0000000000000030 T _D7testlib15__unittest_failFiZv 0000000000000000 T _D7testlib7__arrayZ 0000000000000018 T _D7testlib8__assertFiZv U __d_array_bounds U __d_assertm U __d_unittestm libtest.a(testlib_1_144.o): 0000000000000000 S _D7testlib3fooFZv libtest.a(testlib_2_135.o): 0000000000000000 S _D7testlib3barFZv libtest.a(testlib_3_25e.o): 0000000000000000 S _D7testlib5xyzzyFZv
Feb 01 2014
On Saturday, 1 February 2014 at 23:51:06 UTC, Dan Olson wrote:I noticed that dmd -lib breaks up a module into separate .o's when building a static library. This is could help make smaller executables (I am thinking smart phones) when linking with phobos because it will only pull in to .o's needed to satisfy what is referenced. ldmd2 -lib doesn't split into multiple .o's like dmd. Does it seem like a good idea to do the same (I am thinking so). Example: file testlib.d gets split into four .o's cat >testlib.d <<eof void foo() {} void bar() {} void xyzzy() {} eof $ dmd -lib -oflibtest.a testlib.d $ nm libtest.a libtest.a(testlib.o): 0000000000000050 D _D7testlib12__ModuleInfoZ 0000000000000030 T _D7testlib15__unittest_failFiZv 0000000000000000 T _D7testlib7__arrayZ 0000000000000018 T _D7testlib8__assertFiZv U __d_array_bounds U __d_assertm U __d_unittestm libtest.a(testlib_1_144.o): 0000000000000000 S _D7testlib3fooFZv libtest.a(testlib_2_135.o): 0000000000000000 S _D7testlib3barFZv libtest.a(testlib_3_25e.o): 0000000000000000 S _D7testlib5xyzzyFZvHi Dan, that's a in ldmd2. Could you please create an issue? https://github.com/ldc-developers/ldc/issues?state=open Thanks!!! Regards, Kai
Feb 03 2014
https://github.com/ldc-developers/ldc/issues/579
Feb 04 2014