https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89347

--- Comment #3 from Maninder Singh <maninder1.s at samsung dot com> ---
But its not mentioned in gc-section or data-section manual pages, either that
needs updation or it need to be handled by -fdata-section flag only.


https://gcc.gnu.org/onlinedocs/gcc-8.2.0/gcc/Optimize-Options.html#Optimize-Options
 


-ffunction-sections
-fdata-sections
Place each function or data item into its own section in the output file if the
target supports arbitrary sections. The name of the function or the name of the
data item determines the section’s name in the output file.

Use these options on systems where the linker can perform optimizations to
improve locality of reference in the instruction space. Most systems using the
ELF object format have linkers with such optimizations. On AIX, the linker
rearranges sections (CSECTs) based on the call graph. The performance impact
varies.

Together with a linker garbage collection (linker --gc-sections option) these
options may lead to smaller statically-linked executables (after stripping).

On ELF/DWARF systems these options do not degenerate the quality of the debug
information. There could be issues with other object files/debug info formats.

Only use these options when there are significant benefits from doing so. When
you specify these options, the assembler and linker create larger object and
executable files and are also slower. These options affect code generation.
They prevent optimizations by the compiler and assembler using relative
locations inside a translation unit since the locations are unknown until link
time. An example of such an optimization is relaxing calls to short call
instructions.

Reply via email to