comp.lang.ada
 help / color / mirror / Atom feed
From: "Peter Bui" <peterbui@mybox.cc>
Subject: Re: binary size
Date: Tue, 04 Jun 2002 21:39:43 GMT
Date: 2002-06-04T21:39:43+00:00	[thread overview]
Message-ID: <zsaL8.46033$wj7.16287732@twister.socal.rr.com> (raw)
In-Reply-To: al_K8.117776$%o.11491889@bin3.nnrp.aus1.giganews.com

I faced this problem too, but after some messing around, I found a way to
reduce the executable file size.  Try:

gnatmake -O2 -fno-inline --GNATBIND='gnatbind -shared' sourcefile.adb

Replace sourcefile.adb with your file.  The key here is the
"--GNATBIND='gnatbind -shared' ", which tells the compiler to use the shared
library rather than the static.  I'm not sure if the "-O2" or the
"-fno-inline" really do much, but I haven't really experimented too much
with them.

Anyways, after you compile using the line above you should get an executable
about ~15 kb or something in that neighborhood.  To further reduce the
executable filesize, run:

strip executable

using this I have been able to get a simple Hello World program down to ~6kb
which is a significant reduction.

BTW, I am using Gnat 3.14p on Linux
Good Luck!

"Alexei A. P." <apolkhanov@novus-tele.net> wrote in message
news:al_K8.117776$%o.11491889@bin3.nnrp.aus1.giganews.com...
> Given two programs one in C another in Ada95. Simple "HEllo world" program
> takes as much as 300K !, same time C program with same functionality only
> 14K .
> Looking at symbol table of both executables I can see that Ada runtime
> consumes 90
> % of it, then I've got a simple question: Can I move this part into one
> shared module ? I
> am using GNAT on Linux and I am wondering if this is a right way to go ?
> Posibly there is
> another, standard, way to make runtime libraries shared ? And Should
things
> like Text_IO
> be included in it as well ?
>
> Alexei.
>
>
>
>
>
>
>
>
>





  parent reply	other threads:[~2002-06-04 21:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-04  7:52 binary size Alexei A. P.
2002-06-04 10:45 ` Jacob Sparre Andersen
2002-06-04 21:39 ` Peter Bui [this message]
2002-06-05  7:37   ` Antonio Duran
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox