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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,6575b47ba54cee7c X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!wn13feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail Newsgroups: comp.lang.ada From: anon@anon.org (anon) Subject: Re: Reducing the size of executables produced by GNAT Reply-To: anon@anon.org (anon) References: <40e9c01a-8d31-4554-9d9b-18cce7834d56@s12g2000prg.googlegroups.com> X-Newsreader: IBM NewsReader/2 2.0 Message-ID: Date: Wed, 13 Feb 2008 16:19:44 GMT NNTP-Posting-Host: 12.65.54.94 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1202919584 12.65.54.94 (Wed, 13 Feb 2008 16:19:44 GMT) NNTP-Posting-Date: Wed, 13 Feb 2008 16:19:44 GMT Organization: AT&T Worldnet Xref: g2news1.google.com comp.lang.ada:19773 Date: 2008-02-13T16:19:44+00:00 List-Id: The answer is a multi part answer. 1. The GNAT Ada Run-Time Libraries and compiler system. 2. The GNU GCC Linker and C Libraries that GNAT uses. Note: This is because GNU GCC and GNAT was and is written for use in a multi-platform world. That is you write and compile your code on one platform and simple recompile it on another with no modifications. Other than maybe the filenames (because characters like '$' are illegal on some OSs) and the directory separators used ('/' unix style or '\' windows style). If you rewrite the GNAT RT Libraries system so that it only uses the routines that you need with direct OS Interface packages you can get a program like "Hello" down to the bare minimum of 256 bytes (1 sector on a floppy) or less. It is easy to do but for most people that too much work. In <40e9c01a-8d31-4554-9d9b-18cce7834d56@s12g2000prg.googlegroups.com>, Hibou57 writes: >Hallo, > >My first question here. > >For a long time ago I'm looking for a way to reduce th esize of Ada >programs compiled with GNAT. > >With a simple Hello-World I cannot go below 45KB, which is very much >for a so simple program. > >I'm afraid of what it means : take long to initialize at startup ? (I >need fast application, for CGI on a Linux server), many unusefull >dependencies on external library ? etc, etc > >Further more, as usualy, dynamic linking on Linux fall into many >troubles, and to make it work properly, I need to compile it >statically linked. And there, I got a simple Hello-World which weight >120KB! > >Why is it so big ? > >What can I do ? Are there some hidden magic compiler switch to reduce >this size ? > >What are the conscenquences of this size ? Does it execute all of this >120KB of code before starting the application main work ? > >I have a look at the GNAT manual, then used gnatelim as suggested, but >this is not better (same size). I have a look at all gnatmake, >gnatbind and gnatlink options, but something good. I have a look at an >exemple at wikibook wihicj pretend to reduce the size of an hello work >downto 10K (which is still big, but really better), but while they >pretend to be able to do this.... they do not indicates a sole advice >to do it (strange...). I've tryed to compile with "pragma >No_Run_Time", but then compilation fails as soon as there is a sole >exception statement in the code (I need exceptions). I've tryed >"pragma Restricted_Run_Time" and "pragma Profile (Restricted)", but >this not better (always the same size). > >So GNAT = big-big binaries : is it a rule ? > >Many thanks for any concret advice, for any indications of any useful >compiler switch. > >N.B. I do not need multitasking, I just need exception support, file I/ >O, while in the mean time, if really necessary, I could create my own >package for IO.