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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |INVALID

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to doug mcilroy from comment #6)
> The waste of time and space happens in the assembler, but the assembler only
> does what it is told to do. There must be a way for gcc to tell it to put
> array a in a partially filled ELF section.

There is no way to do that in ELF that the compiler could use.  
Sections only have address/size/offset and whether they are allocated or not,
there is no such thing as sections partially backed by the object and partially
zero filled.  The only thing that is there is that some sections might be
instead of the usual @progbits @nobits instead, and that is what you get if
you'll have the variable completely filled with zeros.
For your case, where a variable is partially initialized with non-zeros and
mostly zeros afterwards, you can do it by hand in assembler by making the
variable go from one named section to another one, and arranging that the
linker emits those two sections next to each other, but that isn't something
the compiler can arrange.
In ELF, the segments can be partially backed by data and rest zero initialized.

Reply via email to