15.1.2.20 section
("section-name")
Normally, the compiler places the code it generates in the
.text
section. Sometimes you need additional sections or certain
functions to appear in special sections. The section
attribute
specifies that a function lives in a particular section. For example, consider the
declaration:
extern void foobar (void) __attribute__ ((section
(".libtext")));
This puts the function foobar
in the
.libtext
section.
The linker will allocate the saved named section sequentially. This might allow you to ensure code is locally referent to each other, even across modules. This can ensure that calls are near enough to each other for a more efficient call instruction.