Re: data type & sections

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

 



stefano carucci wrote:
> 
> Hello all,
> 
> my question is:
> Is it possible to set a data type (for example, the type
> "Matrix",customized by means of a struct, or a standard type, as "int")
> in a certain section (defined in the linker script, as ".data") in order
> for every Matrix-items (for example) to be placed in a dedicated memory?
> maybe, by means of a #pragma...?

Gcc supports various attributes to assign linker sections (such as
__attribute__((section, ".mysection")), take a look in the manuals),
which is in general a more flexible mechanism than #pragmas.

Unfortunately, the section attribute can be applied only to
variable/function definitions, not to type definition. Hence, it is not
possible to define a "default section" for all (static) variable
instances of a particular type, even though such feature would be *very*
useful.

If you have full control over the source code you may use a
pre-processor macro as workaround, which instantiates Matrix-items with
  the proper attributes.


Daniel

[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