Sure. But here's the thing: the gcc LTO approach involves having a
regular object with a regular symbol table, and the IR is embedded
in
the object. In other words, we do know the symbol version
information: it's in the symbol table of the object.
Wow, that seems incredibly limiting. This means that your LTO either
has to:
1) treat the object header as part of the IR, or
2) avoid making any changes that would affect exported symbols
Is that right? Why doesn't the "LTO reader" just read the symbol
info
from the ELF header and reflect it into the trees somehow?
For example, earlier Nick suggested that LLVM will not inline a weak
symbol. With ELF it is actually OK to inline a weak symbol when
generating an executable. It is not OK when generating a shared
library, unless -Bsymbolic was used on the linker command line. We
could represent these sorts of details directly in the compiler IR.
But I don't see a big advantage to doing so.