This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: New ELF section
- To: help-gcc at gnu dot org
- Subject: Re: New ELF section
- From: Matthew Majka <mmajka at cs5 dot dasd dot honeywell dot com>
- Date: Tue, 26 Oct 1999 13:03:13 -0600
- Newsgroups: gnu.gcc.help
- Organization: Verio
- References: <3815C3F4.E1A8F163@sxb.bsf.alcatel.fr>
- Xref: wodc7nx0 gnu.gcc.help:1600
On Tue, 26 Oct 1999, stephane lopez wrote:
> I am trying to make gcc generate some C variable declarations in a new
> ELF section, different from ".data". Does anybody know how to achieve
> this aim ?
>From the GCC info docs:
`section ("section-name")'
Normally, the compiler places the objects it generates
in sections
like `data' and `bss'. Sometimes, however, you need
additional
sections, or you need certain particular variables to
appear in
special sections, for example to map to special
hardware. The
`section' attribute specifies that a variable (or
function) lives
in a particular section. For example, this small
program uses
several specific section names:
struct duart a __attribute__ ((section
("DUART_A"))) = { 0 };
struct duart b __attribute__ ((section
("DUART_B"))) = { 0 };
char stack[10000] __attribute__ ((section
("STACK"))) = { 0 };
int init_data __attribute__ ((section
("INITDATA"))) = 0;
...