1、section 函数属性使您能够将代码放置在图像的不同部分中。
2、这个函数属性是ARM编译器支持的GNU编译器扩展。
3、例程
在下面的示例中,Function_Attributes_section_0 被放置到RO section new_section 中,而不是 .text 中。
void Function_Attributes_section_0 (void) __attribute__((section ("new_section")));
void Function_Attributes_section_0 (void)
{
static int aStatic =0;
aStatic++;
}
在下面的例子中,section 函数属性覆盖了 #pragma arm section 设置。
#pragma arm section code="foo"
int f2()
{
return 1;
} // into the 'foo' area
__attribute__((section ("bar"))) int f3()
{
return 1;
} // into the 'bar' area
int f4()
{
return 1;
} // into the 'foo' area
#pragma arm section