We might not end up with a one size fits all solution, unfortunately. I can rely more on everything being built with LLVM than I can on -frtti being enabled for everything.
RTTI would only need to be enabled for the non-ThinLTO built binaries to act as a record for the unsafe types. That seems like something that could be reasonably done if the main scenario is ThinLTO being disabled on handful of targets.
RTTI as the source of truth for WPD safety is quite appealing since:
- It’s default-on for both Clang and GCC means there’s a high chance it’s already present on pre-built binaries
- Is an already existing and well-known data structure for all related tooling
If it’s do-able to use RTTI to enumerate the unsafe types in native files on your side we could have a single unified solution which would be sweet.