| |||
Home > 컴파일러 관련 기능 > 함수 특성 > __attribute__((section)) | |||
section 함수 특성을 사용하면 이미지의 여러 섹션에 코드를 배치할
수 있습니다.
이 함수 특성은 ARM 컴파일러에서 지원하는 GNU 컴파일러 확장입니다.
다음 예제에서 Function_Attributes_section_0은 .text가
아니라 RO 섹션 new_section으로 배치됩니다.
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