3.3.5.2 How Do I Stop An Unused Function Being Removed?
The __attribute__((keep))
may be applied to a function. The
keep attribute will prevent the linker from removing the function with
--gc-sections
, even if it is unused. See the “MPLAB® XC32
Assembler, Linker and Utilities User’s Guide” (DS50002186) for more information on
section garbage collection using the --gc-sections
option.