Forum Discussion
Altera_Forum
Honored Contributor
13 years agoYou can also put the section attribute before the function name, eg:
static __attribute__((section(".text.foo"))) int
foo(void)
{
/* function body */
} (It can go either side of the return type, not sure which is preferred.) For non-static functions this rather depends on whether you want the section info in the .c file or the .h one. For data, the section in an 'extern' is used to determine whether to use 'small data' (%gp relative) addressing (.sdata or .sbss). The location of the data itself depends on the actual definition.