Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6c18d004 authored by Colin Cross's avatar Colin Cross
Browse files

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
parent 567d342e
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -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")
		}