Re: PCI Express support for 2.4 kernel

Kevin P. Fleming
2003-12-15T16:08:18Z

Vladimir Kondratiev wrote:

> To illustrate zero cost, I did the following test:
> [tmp]$ cat t.c; gcc -S t.c; cat t.s
> static int a1=0;
> static int a2;
> /* EOF */
>
> .file "t.c"
> .local a1
> .comm a1,4,4
> .local a2
> .comm a2,4,4
> .section .note.GNU-stack,"",@progbits
> .ident "GCC: (GNU) 3.3.1 20030811 (Red Hat Linux 3.3.1-1)"
>
> As you can see, assembly code is identical, compiler did this trivial
> optimization for me.

You've missed the point, though. Initializing a static variable to zero
causes space to be consumed in the resulting object file (not
instruction code to be generated). This is wasted space, because if you
don't initialize to zero the variable will be allocated out of space
that is _automatically_ zeroed for you. This reduces the size of the
kernel image by not filling it with unnecessary zeroes.