SLAU646F September 2015 – June 2020
The -ffunction-sections and -fdata-sections options instruct the GCC compiler to create a new output section for each function and data object. When used with the --gc-sections linker option, these options ensure that the linker can perform garbage collection of unused function and data objects in your program.
Typically, this reduces overall program size. However, if there is not a significant number of sections the linker can remove, these options may actually increase the size of your program and reduce performance. This is because the GCC compiler cannot perform certain optimizations when these options are enabled. We recommend that you experiment with these options to determine the overall effect they have on your program size.