0

I am trying to better understand link-time optimization in GCC and -fuse-linker-plugin seems to matter in that context. However, I do not exactly understand how.

Suppose my compilation with link-time optimization looks like this:

gcc a.c -c -o a.o -flto -fno-fat-lto-objects
gcc b.c -c -o b.o -flto -fno-fat-lto-objects
gcc main.c -o main.out a.o b.o

What would be a good use case for enabling -fuse-linker-plugin?

I found the official GCC documentation somewhat confusing on that point. They suggest that -fuse-linker-plugin matters only for archive files (.a) but most conversation I have seen mentions that option without discussing archive files.

shuhalo
  • 5,732
  • 12
  • 43
  • 60
  • https://stackoverflow.com/questions/15606993/g-optimization-flags-fuse-linker-plugin-vs-fwhole-program – KamilCuk Oct 21 '22 at 10:12
  • @KamilCuk That question is related but does not answer what `-fuse-linker-plugin` actually does. The GCC documentation suggests that this option only matters for archive files, but most conservation I have seen does not speak of archives at all. – shuhalo Oct 21 '22 at 11:00

0 Answers0