This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
How to get address and size of a section
- From: "LUO Sai" <sailuo at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Sat, 30 Sep 2006 13:36:47 +0800
- Subject: How to get address and size of a section
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.