On 10/29/20 8:26 AM, Christer Solskogen via Gcc-help wrote: > I'm experimenting with LTO on a small project, but I'm not quite sure > I've got it to work properly, because the binary is bigger with LTO > rather than smaller (which is what I would expect). > > I've added "-flto" to $CFLAGS, and "-flto=4 -fuse-linker-plugin > -fuse-ld=gold" to the LDFLAGS. > > The complete CFLAGS are "-O2 -flto -pipe", and LDFLAGS are > "-Wl,--hash-style=gnu -Wl,--as-needed -O2 -flto=4 -fuse-linker-plugin > -fuse-ld=gold -Wl,--sort-common" > > Am I doing something wrong or is this The Way(tm)? In general, LTO should result in smaller executables and DSOs. I can speculate on scenarios where that may not be the case, but the only way to really know what's going on is for you to provide a complete bug report. Jeff