Records in the module summary index whether the bitcode was compiled
with the option necessary to enable splitting the LTO unit
(e.g. -fsanitize=cfi, -fwhole-program-vtables, or -fsplit-lto-unit).
The information is passed down to the ModuleSummaryIndex builder via a
new module flag "EnableSplitLTOUnit", which is propagated onto a flag
on the summary index.
This is then used during the LTO link to check whether all linked
summaries were built with the same value of this flag. If not, an error
is issued when we detect a situation requiring whole program visibility
of the class hierarchy. This is the case when both of the following
conditions are met:
- We are performing LowerTypeTests or Whole Program Devirtualization.
- There are type tests or type checked loads in the code.
Note I have also changed the ThinLTOBitcodeWriter to also gate the
module splitting on the value of this flag.
I think we will need to do something about this flag for compatibility. Right now all translation units are part of the LTO unit. So that means that once this change goes in we will be unable to link old bitcode with new bitcode. We might need a way of distinguishing old bitcode from new bitcode so that we can ignore the LTO unit flag in old bitcode.