https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107950
--- Comment #9 from Jan Hubicka <hubicka at ucw dot cz> --- > > Feel free to grab my initial patch in c#0 and upstream it. I tried that some > time ago in the following email thread: > https://gcc.gnu.org/pipermail/gcc/2021-May/236096.html Actually I was shooting for partial linking LTO streams just to make individual WPAs chaper. With -flinker-output=nolto-rel we are effectively disabling most of benefits of LTO. My main problem was arranging the partial link only when stage1/2 compiler is used so bootstrap works with older GCCs which suports LTO but not partial linking yet. > > > > > I also think it is the case where partial linking makes the symbol to be > > pulled into LTO binary at the initial link time. It should be optimized > > away if linker was not complaining. > > Optimize away during the partial linking? So you think it's a GCC issue when > it > comes to partial linking? No with partial linking you merge all the individual object files into single. So if lto frontned is not using some of libbackend entry point, you still get that code biult into it. So I think it is correct behaviour.