www.digitalmars.com         C & C++   DMDScript  

D.gnu - GDC compilation bloat?

reply Kyle De'Vir <kyle.devir mykolab.com> writes:
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?
Sep 08 2018
parent reply Iain Buclaw <ibuclaw gdcproject.org> writes:
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.
Sep 08 2018
next sibling parent Kyle De'Vir <kyle.devir mykolab.com> writes:
On Saturday, 8 September 2018 at 07:55:49 UTC, Iain Buclaw wrote:
 On 8 September 2018 at 09:40, Kyle De'Vir via D.gnu 
 <d.gnu puremagic.com> wrote:
 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.
Ah, now I see! Seems obvious now. Thank you! :)
Sep 08 2018
prev sibling parent reply Kyle De'Vir <kyle.devir mykolab.com> writes:
On Saturday, 8 September 2018 at 07:55:49 UTC, Iain Buclaw wrote:
 -shared-libphobos
Also, it would be nice to officially document this somewhere. Or is still considered an unstable feature? LDC seems to dynamically link by default, now that I examine it.
Sep 08 2018
parent reply David Nadlinger <code klickverbot.at> writes:
On Saturday, 8 September 2018 at 14:44:36 UTC, Kyle De'Vir wrote:
 Also, it would be nice to officially document this somewhere. 
 Or is still considered an unstable feature? LDC seems to 
 dynamically link by default, now that I examine it.
LDC as shipped in the upstream binary packages doesn't link shared libraries by default, but some distros might be specifying `-link-defaultlib-shared` in the ldc2.conf they ship. — David
Sep 09 2018
parent Kyle De'Vir <kyle.devir mykolab.com> writes:
On Sunday, 9 September 2018 at 18:11:53 UTC, David Nadlinger 
wrote:
 LDC as shipped in the upstream binary packages doesn't link 
 shared libraries by default, but some distros might be 
 specifying `-link-defaultlib-shared` in the ldc2.conf they ship.

  — David
Hi David, I checked out my distro's LDC config defaults, and it indeed specifies that option. Is there an equivalent configuration option for GDC?
Sep 12 2018