Re: PCI Express support for 2.4 kernel

From: Richard B. Johnson
Date: Mon Dec 15 2003 - 13:02:44 EST


On Mon, 15 Dec 2003, Tomas Szepe wrote:

> On Dec-15 2003, Mon, 11:55 -0500
> Richard B. Johnson <root@xxxxxxxxxxxxxxxxxx> wrote:
>
> > Easy way to remember is that if you have either a static or a global
> > variable that is initialized, it will be in the .data segment and,
> > therefore take up space in the executable. If it is not initialized,
> > it will be in the .bss segment, automatically zeroed by the loader.
> > In this case, the executable contains length information, not the data.
> > Local variables are never initialized unless there's an '=' in the
> > code.
>
> I think you guys are all missing Vladimir's point, which is that gcc
> is able to detect that an explicit initialization of a static variable
> happens to be to the value of ZERO, and place the variable in .bss
> _in spite of the initialization_.
>
> --
> Tomas Szepe <szepe@xxxxxxxxxxxxxxx>
>

Well it doesn't, and if it did, it would be broken. GCC needs to
operate according to some well-defined rules because its output
must interoperate with the object-files created by other versions
including stuff written in other languages.

Therefore you make data exist in the .data segment by initializing
it. If GCC decides to put this initialized data in the .bss segment,
then it is broken. FYI, it doesn't.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.22 on an i686 machine (797.90 BogoMips).
Note 96.31% of all statistics are fiction.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/