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

--- Comment #6 from smalcom <smal.root at gmail dot com> ---
Created attachment 52050
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52050&action=edit
Generated assembly when using "LTO". avr-gcc-10.2

(In reply to Andrew Pinski from comment #4)
> If I use -Wl,--gc-sections -ffunction-sections, then all of the unused
> (non-static) functions are removed.
> 
> Also -flto is able to optimize it too.

I confirm that:
1. With set "-Wl,--gc-sections -ffunction-sections" output file do not contain
unused functions (attached gcsec.lss).
2. With "-flto" all functions are inlined and present only used code (attached
lto.lss).

Tested using gcc-10:

avr-gcc -v
Using built-in specs.
Reading specs from
/mnt/stor5/opt/сборка/avr-10.2.0/bin/../lib/gcc/avr/10.2.0/device-specs/specs-avr2
COLLECT_GCC=avr-gcc
COLLECT_LTO_WRAPPER=/mnt/stor5/opt/сборка/avr-10.2.0/bin/../libexec/gcc/avr/10.2.0/lto-wrapper
Target: avr
Configured with: ../configure --prefix=/opt/toolchain/avr-10.2.0 --target=avr
--enable-languages=c,c++ --disable-nls --disable-libssp --with-dwarf2
Thread model: single
Supported LTO compression algorithms: zlib zstd
gcc version 10.2.0 (GCC) 

Great. Thanks!

Reply via email to