How to get address and size of a section

LUO Sai sailuo@gmail.com
Sat Sep 30 05:36:00 GMT 2006


Hi all.

Does anyone know how to get the address and size of a section in gcc
in a somewhat portable way without using linking script? I mean
portable because I want to compile the program using icc(intel c
compiler) too.

for example.
int a __attribute__(section(".extra")) = 1;
int b __attribute__(section(".extra")) = 2;
int c __attribute__(section(".extra")) = 3;

Does gcc provides any directive to get the address and size of
".extra" section, or is inline assembly available? I want to access
variables in ".extra" section in batches. And can I specify the layout
of the section that a is laid before b, and b before c, that's,
&a+1==&b and &b+1==&c ?


--
Sai.



More information about the Gcc-help mailing list