Recent

Author Topic: Whole Program Optimization  (Read 2181 times)

Josh

  • Hero Member
  • *****
  • Posts: 1274
Re: Whole Program Optimization
« Reply #15 on: October 13, 2022, 09:33:32 pm »
yes all 4 images, for *nix and windows, I assume the fpc snippets are not correct also..

The best way to get accurate information on the forum is to post something wrong and wait for corrections.

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Whole Program Optimization
« Reply #16 on: October 13, 2022, 09:40:13 pm »
I assume the fpc snippets are not correct also..

All those like this ?

Under "Compiler Options | Custom Options", add the Custom Options "-OWall -FWtemplinux.wpo -Xs- -CX"

But maybe we miss something, the "-" was wanted, I dont understand why ( it seems to me that adding "-" is equivalent to not add -Xs at all )
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Whole Program Optimization
« Reply #17 on: October 13, 2022, 09:54:43 pm »
Hum, in fact I think the wiki is OK.
For the WPO phases (to collect the infos) the program must NOT be stripped.
And the  -Xs- parameter force to not use stripping, even if -Xs was added in the parameters.

Maybe.
 
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Josh

  • Hero Member
  • *****
  • Posts: 1274
Re: Whole Program Optimization
« Reply #18 on: October 13, 2022, 10:01:38 pm »
That make sense for Pass 1 , but surely stripping is required for Pass 2
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Whole Program Optimization
« Reply #19 on: October 13, 2022, 10:09:06 pm »
but surely stripping is required for Pass 2

In my case, I strip ( -Xs ) always the releases (but i know that it is at my own risk and this is not the best academical practice).  :-[
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Josh

  • Hero Member
  • *****
  • Posts: 1274
Re: Whole Program Optimization
« Reply #20 on: October 13, 2022, 10:26:26 pm »
I also have the project option/debugging Strip Symbols From Execs enabled in release builds, so I assume -Xs- turns this off in Pass 1 (makes sure symbols are NOT stripped), but to reduce the exe size in Pass 2 it needs to be -Xs (Strip Symbols).

Of course I could be totally wrong.. %)
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Whole Program Optimization
« Reply #21 on: October 13, 2022, 10:37:37 pm »
I also have the project option/debugging Strip Symbols From Execs enabled in release builds, so I assume -Xs- turns this off in Pass 1 (makes sure symbols are NOT stripped), but to reduce the exe size in Pass 2 it needs to be -Xs (Strip Symbols).

Of course I could be totally wrong.. %)

Quote
-Xs (Strip Symbols).

I have to check it, but for stripping, is it a external program that is used (strip), just after compilation or is it done by fpc himself  ?
[EDIT] It is done by a fpc tool strip.exe after compilation.
So it must be safe.

So yes, I dont see why -Xs- in Phase 2.
« Last Edit: October 13, 2022, 11:02:08 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Josh

  • Hero Member
  • *****
  • Posts: 1274
Re: Whole Program Optimization
« Reply #22 on: October 13, 2022, 11:06:41 pm »
Hi
I renamed my strip.exe to oldstrip.exe in \fpc\bin\i386-win32 and fpcbootstrap(using fpcupdeluxe) no other strip on machine and strip in cmd prompt  says no file found so nothing in path , it still creates a small exe, so don't think strip is called.
« Last Edit: October 13, 2022, 11:09:21 pm by Josh »
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Whole Program Optimization
« Reply #23 on: October 13, 2022, 11:11:56 pm »
Hi
I renamed my strip.exe to oldstrip.exe in \fpc\bin\i386-win32 and fpcbootstrap(using fpcupdeluxe) no other strip on machine and strip in cmd prompt  says no file found so nothing in path , it still creates a small exe, so don't think strip is called.

So, imho, there is a bug in the wiki for Phase 2.
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Whole Program Optimization
« Reply #24 on: October 13, 2022, 11:35:27 pm »
About https://wiki.freepascal.org/Whole_Program_Optimization

After re-reading carefully the wiki, it seems to me that there is no error.
The mode WPA Pass 1 and WPA Pass 2 need -Xs-.

And should not be used for release.

IMHO there is missing the last chapter:
Building your release after WPO and there add the -Xs parameter.
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

 

TinyPortal © 2005-2018