This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Putting an all-zero variable into BSS


Hi,

There is a large increase in rodata size for derived types in gfortran
starting with gcc 8 due to the presence of large initializers for
derived types. Among other things, this affects SPEC tonto (PR 84487),
but there are also other bug reports which mention this behavior.

The large default initializers are all filled with zeros which end up in
the rodata section, like this:

        .text
        .globl  __types_module_MOD___def_init_types_module_Archive_type
        .section        .rodata
        .align 32
.type __types_module_MOD___def_init_types_module_Archive_type, @object .size __types_module_MOD___def_init_types_module_Archive_type, 262144
__types_module_MOD___def_init_types_module_Archive_type:
        .zero   262144

... and so on. To reduce the size of the executable, it would make more
sense to put this into the BSS section.

Question: How?  It would be possible to determine from the Fortran
front end which variables would end up all zeros, and mark them in
some way. Alternatively, the middle or back end could do this,
maybe unter the control of a specal option we can then set from
gfortran (-fzero-initialized-in-bss does not do the trick).

What could be the best path forward?

Regards

	Thomas


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]