Re: Pragmas in GCC

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

 



ZeMan wrote:

> I would like to investigate the use of pragmas in GCC. What are
> pragmas, how are
> they used, what are their limitations, and how can they be used to
> carry information from
> the source code to various optimizing passes. Specifically, I would
> like to investigate how pragmas can be used to allocate variables to
> specific memory banks.
> 
> Can anybody give me a summary, or a link to a document where I can
> find such details?

gcc does not use #pragma for much of anything, if at all.  To specify
what section a function or variable should be placed in, you use
__attribute__((section("foo"))), and the linker script maps sections to
ram/rom/flash/whatever.  Likewise for optimizer hints, they are all done
with __attribute__, e.g. noreturn, used, unused, hot, cold, ...

This is all documented in the gcc manual:

http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
http://gcc.gnu.org/onlinedocs/gcc/Variable-Attributes.html
http://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html

Brian

[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