This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: New ELF section


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;

...



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]