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

Martin Schreiber mse00000 at gmail.com
Sat Apr 7 13:15:49 CEST 2012


On Saturday 07 April 2012 12:58:14 Jonas Maebe wrote:
> On 07 Apr 2012, at 12:31, Martin Schreiber wrote:
> > 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 "
>
> From http://wiki.freepascal.org/Whole_Program_Optimization#Limitations_4 :
>
> "This optimisation requires that the nm utility is installed on the system.
> For Linux binaries, objdump will also work."
>
Thanks, where can I get that "nm utility" for win32?

> > 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.
>
> On my Linux/i386 system it's 133kb after strip -s, and 261kb before. Have
> you recompiled the 2.6.0 rtl somehow?
>
The result is wit the MSEgui minimal program not the testprogram in the Wiki, 
sorry for confusion.

> > 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 :
> > "
>
> Strange. This example is tested every night in the test suite runs and
> works fine there on Linux/i386:
> http://www.freepascal.org/testsuite/cgi-bin/testsuite.cgi?action=3&run1id=1
>08780&testfileid=3122 . I've also just tested it on Linux/i386 (see above)
> and it works fine for me.
>
It is the MSEgui minimal program not the example.

> > Should whole program optimization work with FPC 2.6.0?
>
> Yes. The FPC 2.6.0 compiler binary itself is even compiled with whole
> program optimizations (although not with the symbol liveness information
> switch, because that requires smart linking and for historical reasons
> that's not enabled for the binaries we release).
>
Then I should try without symbol liveness information too?

Martin



More information about the fpc-devel mailing list