4.3.11. __attribute__((used))

This function attribute informs the compiler that a function is to be retained in the object, even if it is unreferenced.

Function marked as used are emitted to a single section, in the order they are declared. You can specify the section functions are placed in using __attribute__((section)).

Note

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

Note

Variables might also be marked as used, using the corresponding variable attribute __attribute__((used)).

Example

int lose_this(int);
int keep_this(int) __attribute__((used));     // retained in object file
int keep_this_too(int) __attribute__((used)); // retained in object file

See also

Copyright © 2007, 2010 ARM Limited. All rights reserved.ARM DUI 0348A
Non-Confidential