[Libguestfs] [nbdkit] [filter/nozero] large binary size with GCC 9

Richard W.M. Jones rjones at redhat.com
Fri Jul 5 10:47:56 UTC 2019


On Thu, Jul 04, 2019 at 08:38:07PM +0200, Thomas Weißschuh wrote:
> Hi all,
> 
> It seems GCC 9 does not put read-only zero-initialized variables into the BSS
> section anymore; instead it is put into RODATA.
> (See the thread at [0], especially [1])
> 
> In filter/nozero a 64M large, static, zeroed, read-only array is declared.
> The new behavior of GCC puts this array as-is into the binary inflating the
> size by a factor of around 10000.
> 
> (Clang 8 and older GCCs work "correctly")
> 
> It would be possible to remove the "const" qualifier or use some compiler
> attribute trickery to get the previous behavior back.
> 
> Thanks,
> Thomas
> 
> [0] https://gcc.gnu.org/ml/gcc/2019-04/msg00034.html
> [1] https://gcc.gnu.org/ml/gcc/2019-04/msg00049.html

Thanks, I can confirm this is indeed a problem (with GCC 9.1.1):

-rwxrwxr-x. 1 rjones rjones 67141400 Jun 10 09:36 nbdkit-nozero-filter.so

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list