From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,344332f209947007 X-Google-Attributes: gid103376,public From: Andi Kleen Subject: Re: Gnat Executable Size Date: 1998/10/12 Message-ID: #1/1 X-Deja-AN: 400318913 Distribution: world Sender: andi@fred.muc.de References: <6volj0$250$1@uuneo.neosoft.com> <362091CF.594AA72D@icon.fi> Organization: [posted via] Leibniz-Rechenzentrum, Muenchen (Germany) Newsgroups: comp.lang.ada Date: 1998-10-12T00:00:00+00:00 List-Id: Corey Minyard writes: > Niklas Holsti writes: > > > Robert B. Love wrote: > > > > > > Over in the Modula-2 newsgroup somebody was asking about free compilers. > > > Another person pointed out GNAT as suitable for his task and free. > > > Ada vs. M2 wasn't the issue. The original poster said he'd tried GNAT > > > on a simple "hello world" program and was surprised to see a 200K > > > executable. Others said their favorite M2 compiler yielded about 10K > > > executables for this. > > > > > > I tried a simple Put_Line program myself with GNAT under Linux and > > > got an 84K program. I've played with Pragma Optimze(Space) and > > > Pragma Supress (All_Checks) but it stays about 84K. > > > > > > I then run strip on the GNAT generated executable and get it down to > > > about 47K. > > > > > > How small can GNAT get "Hello World"? What compiler options and pragmas > > > would you use for this? > > > > On my i486 Slackware Linux 2.0.0, GNAT 3.05 generates an executable > > for Put_Line("Hello world!") of 22842 bytes (not stripped) or 10400 > > bytes (stripped). Compiler options were "-c -g". Seems comparable > > to the M2 sizes. Source code below. > > > > With 3.11b I get 57832 after stripping no matter how I compile it > (optimiation at any level, with or without runtime checks) on my Linux > box. Which makes sense because there's nothing to check or optimize. The standard GNAT binary distribution on Linux seems to generate statically linked libraries, while other distributions generate shared linked libraries (to a libgnat.so). This can explain the size difference. -Andi