Page 1 of 1

Binary size difference between gcc9 and gcc10

Posted: Thu Jul 29, 2021 7:36 pm
by Guillaume227
I am giving ChibiStudio 2021-07 a spin.
First of all, thanks for the update !

I was checking the demo project RT-STM32F446RE-NUCLEO64 and noticed a significant binary size difference between the two gcc versions.

For gcc9:

Code: Select all

   text      data       bss       dec       hex   filename
  [b]46872      220    130848    177940     2b714   build/ch.elf
Done
20:28:53 Build Finished. 0 errors, 0 warnings. (took 13s.169ms)

For gcc10:

Code: Select all

   text      data       bss       dec       hex   filename
   58860      220    130848    189928     2e5e8   build/ch.elf
Done
20:33:04 Build Finished. 0 errors, 0 warnings. (took 13s.712ms)


That's the exact same project : I am opening the same workspace in two different ChibiStudios using the two gcc shortcuts (I am on Windows 10).

It might not be ChibiStudio related and instead be down to differences in gcc versions but I am still curious: has anyone seen that? Do you have an idea where that non-trivial diff might be coming from?

Re: Binary size difference between gcc9 and gcc10

Posted: Thu Jul 29, 2021 7:49 pm
by Giovanni
Hi,

GCC10 is pushing even more for speed using -O2, it is significantly faster. If you want to compare for size then use -Os.

Giovanni

Re: Binary size difference between gcc9 and gcc10

Posted: Sat Jul 31, 2021 10:24 am
by Guillaume227
Thank you Giovanni.
For reference, I recompiled using -Os, here the output that we can compare to the others :

Code: Select all

   text      data       bss       dec       hex   filename
  41740       220    130848    172808     2a308   build/ch.elf

Done
11:17:41 Build Finished. 0 errors, 0 warnings. (took 15s.792ms)


For reference here is a post about relevant gcc10 improvements.
https://community.arm.com/developer/too ... and-faster

I can see how vectorization / loop optimization can play a big role there.