[fpc-devel] Whole Program Optimization with FPC 2.6.0?

Martin Schreiber mse00000 at gmail.com
Sat Apr 7 12:31:33 CEST 2012


Hi,
A minimal MSEgui program compiled with FPC 2.6.0 is 711KB on i386-win32 and
796KB on i386-linux.

I tried to optimize it with "Whole Program Optimization".
On win32 I get:
"
Free Pascal Compiler version 2.6.0 [2011/12/25] for i386
Copyright (c) 1993-2011 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling minimal.pas
[...]
Compiling main.pas
Compiling main_mfm.pas
Linking minimal.exe
minimal.pas(12,1) Error: Error during reading symbol liveness information 
produced by "E:\FPC\2.6.0\bin\i386-win32\objdump.exe -t "
minimal.pas(12,1) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
"
minimal.pas is
"
program minimal;
{$ifdef FPC}{$mode objfpc}{$h+}{$endif}
{$ifdef FPC}
 {$ifdef mswindows}{$apptype gui}{$endif}
{$endif}
uses
 {$ifdef FPC}{$ifdef linux}cthreads,{$endif}{$endif}
 msegui,mseforms,main;
begin
 application.createform(tmainfo,mainfo);
 application.run;
end.
"
^(12,1)

On Linux compiling works, there is a binary of 1.3MB after third run as 
described in
http://wiki.freepascal.org/Whole_Program_Optimization#Concrete_example
After "strip -s" the size is 780KB.

Running the program crashes at startup with
"
An unhandled exception occurred at $080A1045 :
EAbstractError : Abstract method called
  $080A1045
  $0809B6F5
  $0809AD8B
  $080AF2AA
  $080AEFC0
  $080AE4D2
  $0806FB92
  $0805C884
  $0804E48A
  $0805FE70
  $0804DF94
  $0804DCFD
  $0804DB2D

An unhandled exception occurred at $0804C2DF :
An unhandled exception occurred at $B7CE9B7A :
"
Should whole program optimization work with FPC 2.6.0?

Martin



More information about the fpc-devel mailing list