comp.lang.ada
 help / color / mirror / Atom feed
* binary size
@ 2002-06-04  7:52 Alexei A. P.
  2002-06-04 10:45 ` Jacob Sparre Andersen
  2002-06-04 21:39 ` Peter Bui
  0 siblings, 2 replies; 4+ messages in thread
From: Alexei A. P. @ 2002-06-04  7:52 UTC (permalink / raw)


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.












^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: binary size
  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
  1 sibling, 0 replies; 4+ messages in thread
From: Jacob Sparre Andersen @ 2002-06-04 10:45 UTC (permalink / raw)


Alexei A. P. wrote:

> Can I move this part into one shared module?

Yes. When using GNAT 3.13p on Linux/ix86 to compile a simple
program with tasking (without bothering to remove debugging
information) I get a 36�kb binary. If you get a
significantly different result, you should check the GNAT
User Guide for information on the command line parameters to
GNAT.

Jacob
-- 
"I am an old man now, and when I die and go to Heaven there
are two matters
 on which I hope enlightenment. One is quantum
electro-dynamics and the
 other is turbulence of fluids. About the former, I am
rather optimistic."
 Sir Horace Lamb.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: binary size
  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
  2002-06-05  7:37   ` Antonio Duran
  1 sibling, 1 reply; 4+ messages in thread
From: Peter Bui @ 2002-06-04 21:39 UTC (permalink / raw)


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.
>
>
>
>
>
>
>
>
>





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: binary size
  2002-06-04 21:39 ` Peter Bui
@ 2002-06-05  7:37   ` Antonio Duran
  0 siblings, 0 replies; 4+ messages in thread
From: Antonio Duran @ 2002-06-05  7:37 UTC (permalink / raw)


On SuSE Linux 8.0 using gnat 3.13p the size of the resulting
executable invoking gnatmake with no additional parameters is 19,9K.

   Antonio Duran

"Peter Bui" <peterbui@mybox.cc> wrote in message news:<zsaL8.46033$wj7.16287732@twister.socal.rr.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.
> >
> >
> >
> >
> >
> >
> >
> >
> >



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-06-05  7:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2002-06-05  7:37   ` Antonio Duran

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