You copied the Doc URL to your clipboard.

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

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


This function attribute is a GNU compiler extension that the ARM compiler supports.


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;