> But if I understand correctly, mixed LTO/non-LTO + whole-program is > almost never correct. So we should really emit a warning for this > specific combination. I think making this mistake would be quite easy > but hard to debug.
It's not only correct, it's essential. "Whole Program" doesn't mean that the compiler has to see all the IR for the whole program. Instead, the compiler has visibility over the whole program in the sense that it knows what variables and functions are referenced and defined by the non-LTO code. Linking your program with non-LTO code is inescapable unless we start shipping language and system libraries as archives of objects compiled with -flto (and remove all assembly code from such libraries). The plugin interface was designed to provide this essential information to the compiler about all the non-LTO code; until Gnu ld implements this or the collect2 interface provides something similar, you're simply working with an incomplete implementation, and you'll have to live with the limitations. -cary