Clarification on section variable attribute usage [try #2]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[ example updated ]

Hi,

Since at least 3.4, the GCC manual says:

     Use the `section' attribute with an _initialized_ definition of a
     _global_ variable, as shown in the example.  GCC issues a warning
     and otherwise ignores the `section' attribute in uninitialized
     variable declarations.

but this doesn't seem correct.

For example compiling the following tiny program:

	int foo __attribute__ ((__section__ (".init.data")));
	
	int main(int argc, char **argv)
	{
	        foo = 4;
	        return 0;
	}

produces no warning and the section attribute is not ignored at all:

	$ readelf -S a.out | grep -A1 init.data
	[24] .init.data        PROGBITS         000000000060080c  0000080c
	0000000000000004  0000000000000000  WA       0     0     4

This is with 4.1.2 from fedora, but I guess other GCC give the same result.

Could anybody clarify this point ?

Thanks,
		Franck


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux