diff --git a/cc/sanitize.go b/cc/sanitize.go index 8e0813ddd..86472a2cc 100644 --- a/cc/sanitize.go +++ b/cc/sanitize.go @@ -710,8 +710,13 @@ func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags) Flags { // Host sanitizers only link symbols in the final executable, so // there will always be undefined symbols in intermediate libraries. _, flags.Global.LdFlags = removeFromList("-Wl,--no-undefined", flags.Global.LdFlags) + } + + if !ctx.toolchain().Bionic() { + // non-Bionic toolchain prebuilts are missing UBSan's vptr and function san. + // Musl toolchain prebuilts have vptr and function sanitizers, but enabling them + // implicitly enables RTTI which causes RTTI mismatch issues with dependencies. - // non-Bionic toolchain prebuilts are missing UBSan's vptr and function san flags.Local.CFlags = append(flags.Local.CFlags, "-fno-sanitize=vptr,function") }