Pass -fno-sanitize=vptr,function for musl

The prebuilts for musl have the necessary symbols for vptr and function
sanitizers, but enabling them implicitly enables RTTI which causes RTTI
mismatch issues with dependencies.

Bug: 215802826
Test: m USE_HOST_MUSL=true host-native
Change-Id: I93edfd617d99efcac0eca58bb3f3c173c4fa121a
This commit is contained in:
Colin Cross
2022-06-02 15:11:50 -07:00
parent 567d342ed8
commit 6c18d004f2

View File

@@ -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")
}