5.7.7.15 Data-sections Option

The -fdata-sections option places each object in its own section to assist with garbage collection and potential code size reductions.

When enabled, this option has each object placed in its own section named after the object. When used in conjunction with garbage collection performed by the linker (enabled using the-Wl,--gc-sections driver option) the final output might be smaller. It can, however, negatively impact other code generation optimizations, so confirm whether this option is of benefit with each project.

The -fno-data-sections form of this option does not force each object to a unique section. This is the default action if no option is specified.