comp.lang.ada
 help / color / mirror / Atom feed
From: Tony <tony7@tele2.se>
Subject: Re: Size of linked program increasing with new version of GNAT.
Date: Sat, 27 Dec 2014 10:25:46 -0800 (PST)
Date: 2014-12-27T10:25:46-08:00	[thread overview]
Message-ID: <db4a0ed9-d5e8-40ea-8def-0683c98584fb@googlegroups.com> (raw)
In-Reply-To: <lyegrlr3st.fsf@pushface.org>

On Saturday, December 27, 2014 7:43:14 AM UTC+1, Simon Wright wrote:
> A main program with a null body, compiled with -O2 and stripped,
> resulted in executable size 83540;

I'd expect that program to be compiled into a single machine code return instruction.

I managed to create a 12 KB version of Hello-World, by excluding runtime and Ada.Text_Io and calling Win32 functions directly:

pragma No_Run_Time;
with System;
procedure Hello is

   function Writeconsole
      (Hconsoleoutput        : Integer;
      Lpbuffer               : System.Address;
      Nnumberofcharstowrite  : Integer;
      Lpnumberofcharswritten : Integer;
      Lpreserved             : Integer) return Integer;

   pragma Import (Stdcall, Writeconsole, "WriteConsoleA");

   function Getstdhandle (Nstdhandle : Integer) return Integer;

   pragma Import (Stdcall, Getstdhandle, "GetStdHandle");

   Std_Output_Handle : constant := -11;

   S : constant String := "Hello, World!" & Ascii.Lf;
   Dummy : Integer;

begin
   Dummy := Writeconsole(Getstdhandle(Std_Output_Handle), S'Address, S'Length, 0, 0);
end;




  reply	other threads:[~2014-12-27 18:25 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-25 17:44 Size of linked program increasing with new version of GNAT Tony
2014-12-25 17:57 ` Björn Lundin
2014-12-25 18:36   ` tony7
2014-12-25 19:41     ` Björn Lundin
2014-12-25 20:04       ` Shark8
2014-12-25 20:15       ` tony7
2014-12-25 21:23         ` Shark8
2014-12-25 22:48           ` Peter Chapin
2014-12-27  1:39             ` Randy Brukardt
2014-12-27  6:43               ` Simon Wright
2014-12-27 18:25                 ` Tony [this message]
2014-12-27 23:18                   ` Simon Wright
2014-12-29 23:56                   ` Randy Brukardt
2014-12-30 15:21                     ` Björn Lundin
2014-12-30 17:45                     ` Tony
2014-12-30 21:58                       ` Randy Brukardt
2014-12-30 23:51                         ` Shark8
2014-12-31 12:08                     ` Jean François Martinez
2014-12-31 12:45                       ` Dmitry A. Kazakov
2015-01-01 12:28                         ` Georg Bauhaus
2014-12-26 14:32 ` Pascal Obry
2014-12-26 15:48   ` J-P. Rosen
2014-12-26 15:55   ` Simon Clubley
2014-12-26 20:14     ` Tony
2014-12-27  1:48       ` Randy Brukardt
2014-12-27  9:35     ` Pascal Obry
2014-12-27 21:17     ` Jean François Martinez
replies disabled

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