On 8 September 2018 at 09:40, Kyle De'Vir via D.gnu <d.gnu@puremagic.com> wrote: > Maybe I'm missing something, but the binary size that GDC outputs on > compilation, for a very simple Hello World example, is very large, even > after stripping it. > > Comparison between DMD and GDC, all after stripping, plus compilation > commands: > > dmd -mcpu=native -O -release -inline -boundscheck=off -of=main main.d > 669 KiB > > gdc -frelease -march=native -O3 -pipe -fstack-protector-strong -fno-plt -o > main main.d > 1.4 MiB > > Why are they so different? Is that how large GDC produced binaries usually > are?
The runtime makes use of libgcc, backtrace and atomic libraries that dmd wouldn't have. I'd consider it quite safe to build with -shared-libphobos so you don't have all dependencies pulled in statically.