4.7.2.1 Keep Attribute

The keep attribute prevents the linker from removing unused functions, regardless of the selected compiler optimization level or any garbage collection (--gc-sections linker option) performed by the linker. For example:
void __attribute__((keep)) foo (void);