__attribute __ ((section ( "name"))) some understanding

__attribute __ ((section ( "name"))) is a compilation feature gcc compiler supports (arm compiler also supports this feature), at compile time to achieve a function / data into the data segment name.

__attribute__ mainly used for changing the characteristics of a function declaration or definition or data, it has many children, for changing the action properties of an object. Such a function, as NoLine inline expansion will be banned, the noreturn represents no return value, the return value of function other Pure indicate outside, no effect on the other by an external function (e.g., global variables, pointers). Of course, __ attribute__ certainly have a lot of usage, it uses part of section today, so we only do this for some records.

SectionTop mentioned, you should speak RO RI ZI, and after ARM compiler compiler code is divided into different sections, the RO Section (ReadOnly) storing code and constants, the RW Section (ReadWrite) static storage writable and global variables, ZI section (ZeroInit) is located in a variable initialized by RW 0.


So herein to mean a generally clear, __ attribute __ ((section ( "section_name"))), the role of which is to effect the function or data into the designated named "section_name" corresponding segment.

Guess you like

Origin www.cnblogs.com/looner/p/11598685.html