dynamic_cast error detection

Hi all,

I’m trying to convert our code base from GCC 4.0 to LLVM (on mac OS X), and ran into a problem. In the past we used mach_override and the dynamic_cast source in GCC to override the built-in dynamic_cast operator to detect shared library issues (http://gcc.gnu.org/faq.html#dso). Basically we’d assert at runtime when a duplicated RTTI is found, giving us a chance to backtrace the offending class.

I’m looking for a better solution with llvm; I know about -Wweak–vtables, but compiling with it gives me hundreds of errors, and some of them are false positives.
So is there any “legal” way of catching dynamic_cast problems? Maybe dyld_interposing? I’d like to avoid replacing all dynamic_casts with another call if possible (because there are several hundreds of those calls).

Thanks in advance, Akos