04.01.2015 Views

RealView Compilation Tools - ARM Information Center

RealView Compilation Tools - ARM Information Center

RealView Compilation Tools - ARM Information Center

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Compiler-specific Features<br />

4.3.13 __attribute__((section("name")))<br />

The section function attribute enables you to place code in different sections of the<br />

image.<br />

Note<br />

This function attribute is a GNU compiler extension that is supported by the <strong>ARM</strong><br />

compiler.<br />

Example<br />

In the following example, Function_Attributes_section_0 is placed into the RO section<br />

new_section rather than .text.<br />

void Function_Attributes_section_0 (void)<br />

__attribute__ ((section ("new_section")));<br />

void Function_Attributes_section_0 (void)<br />

{<br />

static int aStatic =0;<br />

aStatic++;<br />

}<br />

In the following example, section function attribute overrides the #pragma arm section<br />

setting.<br />

#pragma arm section code="foo"<br />

int f2()<br />

{<br />

return 1;<br />

} // into the 'foo' area<br />

__attribute__ ((section ("bar"))) int f3()<br />

{<br />

return 1;<br />

} // into the 'bar' area<br />

int f4()<br />

{<br />

return 1;<br />

} // into the 'foo' area<br />

#pragma arm section<br />

See also<br />

• #pragma arm section [section_sort_list] on page 4-59.<br />

4-38 Copyright © 2007-2010 <strong>ARM</strong>. All rights reserved. <strong>ARM</strong> DUI 0348C<br />

Non-Confidential,<br />

ID101213

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!