https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120955

--- Comment #14 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Just to make sure I am getting it right.  With avr-gcc v15.1 / trunk, I am
getting a data size of:

$ avr-size -G b-ii-15.o
      text       data        bss      total filename
      2688        194          0       2882 b-ii-15.o

whereas with avr-gcc v14.3 data is:

$ avr-size -G b-ii-14.o
      text       data        bss      total filename
      2976        128          0       3104 b-ii-14.o

This seems to be related to the .rodata section:

$ avr-size -A b-ii-15.o | grep rodata
.rodata                             194      0

$ avr-size -A b-ii-14.o | grep rodata
.rodata                             128      0

I see this for all optimization settings except -O0, though in no case I am
getting a size of 31 with v14.

I am not sure what these objects are.  With my limited knowledge they look like
vtables.  vtables live in .rodata (which lives in RAM for ATmega2560) since G++
does not implement Named Address Spaces, see PR43745.

I'd expect that at most one instance of each vtable is used in the application
by means of comdat, linkonce or similar features, though when the stuff is in
an anonymous namespace it cannot be shared across translation units of course.

What's a bit confusing is that the .rodata size goes down to 130 with -O0,
which may point to optimizations like function cloning that lead to several,
context dependent incarnations of the same object / function when optimization
is on.

Reply via email to