https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120955
Bug ID: 120955
Summary: 50 % increase in data segment size on avr-gcc for -Os
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: fiesh at zefix dot tv
Target Milestone: ---
For our software that controls various machinery in our factory, we have the
following sizes:
Commit 0c83096f19b:
text data bss dec hex filename
212830 1398 3760 217988 35384 /p_o2/phacility
text data bss dec hex filename
152420 1834 3767 158021 26945 /p_os/phacility
Commit 12de1942a0a:
text data bss dec hex filename
250090 1140 3760 254990 3e40e /p_o2/phacility
text data bss dec hex filename
142112 2742 3767 148621 2448d /p_os/phacility
(o2 refers to an -O2 build with LTO, os refers to an -Os build with LTO)
So 12de1942a0a caused:
For O2:
* The text section to become 17.5 % larger
* The data section to become 18.5 % smaller
For Os:
* The text section to become 6.8 % smaller
* The data section to become 49.5 % larger
Please note that since this is a Harvard architecture, data and bss occupy RAM
and thus reduce the available stack size.
(In our case, we now can use neither O2 nor Os. One has too big a text
segment, the other has data + bss leave too little stack for our software to
work.)
Alas I do not have a single translation unit to reproduce this easily. But I'm
happy to share the project code that reproduces this to anyone who can do
something with it or help in any other way. Please let me know and sorry for
the lack of a testcase.