Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2020-07

Binary size discrepancy with -a

10 messages · 5 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

J. Gareth Moreton

Hi everyone,

I've noticed something a bit weird with the Free Pascal Compiler when you use the the -a option to dump the compiled assembly files... the resultant binaries are sometimes smaller.  I recently tried it with Lazarus under x86_64-win64 (using "make distclean all install" with FPCOPT):

(-O4 -OoCONSTPROP)
241,010,289 bytes - lazarus.exe

(-a -O4 -OoCONSTPROP)
235,655,062 bytes - lazarus.exe

Anyone else noticed this? Logically, shoudn't the EXE files be completely identical?

Gareth aka. Kit

This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

Reply by email

Alexander Grotewohl
to J. Gareth Moreton

would -a disable optimizations? i guess it'd depend on the intended use of the listings it generated

Alexander Grotewohl https://dcclost.com ________________________________
Earlier message 28 lines
From: fpc-devel on behalf of J. Gareth Moreton Sent: Saturday, July 18, 2020 11:09:29 PM To: FPC developers' list Subject: [fpc-devel] Binary size discrepancy with -a Hi everyone, I've noticed something a bit weird with the Free Pascal Compiler when you use the the -a option to dump the compiled assembly files... the resultant binaries are sometimes smaller. I recently tried it with Lazarus under x86_64-win64 (using "make distclean all install" with FPCOPT): (-O4 -OoCONSTPROP) 241,010,289 bytes - lazarus.exe (-a -O4 -OoCONSTPROP) 235,655,062 bytes - lazarus.exe Anyone else noticed this? Logically, shoudn't the EXE files be completely identical? Gareth aka. Kit -- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

Reply by email

J. Gareth Moreton
to Alexander Grotewohl

-a shouldn't disable just dumps the
intermediate assembly language into .s files.

Gareth aka. Kit

Alexander Grotewohl wrote 44 lines
would -a disable optimizations? i guess it'd depend on the intended use of the listings it generated -- Alexander Grotewohl https://dcclost.com ------------------------------------------------------------------------ *From:* fpc-devel on behalf of J. Gareth Moreton *Sent:* Saturday, July 18, 2020 11:09:29 PM *To:* FPC developers' list *Subject:* [fpc-devel] Binary size discrepancy with -a Hi everyone, I've noticed something a bit weird with the Free Pascal Compiler when you use the the -a option to dump the compiled assembly files... the resultant binaries are sometimes smaller.  I recently tried it with Lazarus under x86_64-win64 (using "make distclean all install" with FPCOPT): (-O4 -OoCONSTPROP) 241,010,289 bytes - lazarus.exe (-a -O4 -OoCONSTPROP) 235,655,062 bytes - lazarus.exe Anyone else noticed this? Logically, shoudn't the EXE files be completely identical? Gareth aka. Kit -- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus _______________________________________________ fpc-devel maillist  -  https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel _______________________________________________ fpc-devel maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Benito van der Zander
to J. Gareth Moreton: I've noticed something a bit weird with the Free Pascal Compiler when you use the the -a…

Hi J. Gareth,

I once added -a to debug my Android app, and then it did not start anymore on some devices...

Bye,
Benito

J. Gareth Moreton wrote 20 lines
Hi everyone, I've noticed something a bit weird with the Free Pascal Compiler when you use the the -a option to dump the compiled assembly files... the resultant binaries are sometimes smaller.  I recently tried it with Lazarus under x86_64-win64 (using "make distclean all install" with FPCOPT): (-O4 -OoCONSTPROP) 241,010,289 bytes - lazarus.exe (-a -O4 -OoCONSTPROP) 235,655,062 bytes - lazarus.exe Anyone else noticed this? Logically, shoudn't the EXE files be completely identical? Gareth aka. Kit

Reply by email

Sven Barth
to J. Gareth Moreton: I've noticed something a bit weird with the Free Pascal Compiler when you use the the -a…

J. Gareth Moreton schrieb am So., 19. Juli
2020, 05:09:

Show quoted text 17 lines
Hi everyone, I've noticed something a bit weird with the Free Pascal Compiler when you use the the -a option to dump the compiled assembly files... the resultant binaries are sometimes smaller. I recently tried it with Lazarus under x86_64-win64 (using "make distclean all install" with FPCOPT): (-O4 -OoCONSTPROP) 241,010,289 bytes - lazarus.exe (-a -O4 -OoCONSTPROP) 235,655,062 bytes - lazarus.exe Anyone else noticed this? Logically, shoudn't the EXE files be completely identical?

On x86 the difference is that this switches to the external assembler instead of using the internal one. That can result in differently generated files. You could compare the generated *.o files or use -Xm to compare the linker maps.

Regards,
Sven

Reply by email

J. Gareth Moreton
to Sven Barth

Ah, of course!  It's still a remarkable difference though and I wonder if the internal assembler could use an update in that case.

Gareth aka. Kit

Sven Barth wrote 33 lines
J. Gareth Moreton < > schrieb am So., 19. Juli 2020, 05:09: Hi everyone, I've noticed something a bit weird with the Free Pascal Compiler when you use the the -a option to dump the compiled assembly files... the resultant binaries are sometimes smaller.  I recently tried it with Lazarus under x86_64-win64 (using "make distclean all install" with FPCOPT): (-O4 -OoCONSTPROP) 241,010,289 bytes - lazarus.exe (-a -O4 -OoCONSTPROP) 235,655,062 bytes - lazarus.exe Anyone else noticed this? Logically, shoudn't the EXE files be completely identical? On x86 the difference is that this switches to the external assembler instead of using the internal one. That can result in differently generated files. You could compare the generated *.o files or use -Xm to compare the linker maps. Regards, Sven _______________________________________________ fpc-devel maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Sven Barth
to J. Gareth Moreton

J. Gareth Moreton schrieb am So., 19. Juli
2020, 11:20:

Ah, of course! It's still a remarkable difference though and I wonder if the internal assembler could use an update in that case.

Feel free to find out where the difference comes from. ;)

Regards,
Sven

Reply by email

Florian Klämpfl
to Sven Barth
Sven Barth wrote 8 lines
J. Gareth Moreton < > schrieb am So., 19. Juli 2020, 11:20: Ah, of course!  It's still a remarkable difference though and I wonder if the internal assembler could use an update in that case. Feel free to find out where the difference comes from. ;)

I think there is bug report about too lazy section alignment of the internal writer which could explain part of it.

Reply by email

J. Gareth Moreton
to Sven Barth: J. Gareth Moreton schrieb am So., 19. Juli 2020, 11:20: Feel free to find out where the…

I'm sure I'll have a look at it at some point!  Maybe later though.  At the moment I'm getting ready to submt a couple of new peephole optimisations, with some future extensions to them down the line - I'm just waiting for the regression tests to finish.

Gareth aka. Kit

Sven Barth wrote 15 lines
J. Gareth Moreton < > schrieb am So., 19. Juli 2020, 11:20: Ah, of course!  It's still a remarkable difference though and I wonder if the internal assembler could use an update in that case. Feel free to find out where the difference comes from. ;) Regards, Sven _______________________________________________ fpc-devel maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

J. Gareth Moreton
to J. Gareth Moreton

And uploaded the new peephole optimisations. #37389 and #37390.

J. Gareth Moreton wrote 28 lines
I'm sure I'll have a look at it at some point!  Maybe later though.  At the moment I'm getting ready to submt a couple of new peephole optimisations, with some future extensions to them down the line - I'm just waiting for the regression tests to finish. Gareth aka. Kit On 19/07/2020 13:54, Sven Barth via fpc-devel wrote: > J. Gareth Moreton < > > schrieb am So., 19. Juli 2020, 11:20: > > Ah, of course!  It's still a remarkable difference though and I > wonder if the internal assembler could use an update in that case. > > Feel free to find out where the difference comes from. ;) > > Regards, > Sven > > > _______________________________________________ > fpc-devel maillist > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel _______________________________________________ fpc-devel maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email