You copied the Doc URL to your clipboard.

Arm Compiler armclang Reference Guide : __attribute__((section("name"))) function attribute

__attribute__((section("name"))) function attribute

The section function attribute enables you to place code in different sections of the image.

Example

In the following example, the function foo is placed into an RO section named new_section rather than .text.

int foo(void) __attribute__((section ("new_section")));
int foo(void)
{
  return 2;
}

Note

Section names must be unique. You must not use the same section name for different section types. If you use the same section name for different section types, then the compiler merges the sections into one and gives the section the type of whichever function or variable is first allocated to that section.
Was this page helpful? Yes No