From b7e08ca83000f14653ffdd0bc4195067bb902dfc Mon Sep 17 00:00:00 2001 From: Jayant Chowdhary Date: Thu, 10 May 2018 15:29:24 -0700 Subject: [PATCH] Allow abi diffs sanitized variants of vndk libraries on production devices. Previously abi diffs were allowed only on unsanitized variants of vndk libraries. This CL allows them on all sanitized variants which go onto production devices, eg: cfi variants. Bug: 66301104 Test: Without this change, for arm64 libstagefright_foundation doesn't get an lsdump file since we don't build an unsanitized variant (aosp_arm64_ab). Test: With this change, for arm64 libstagefright_foundation does get an lsdump file (aosp_arm64_ab) Change-Id: I94f82fd84fc898e4980c3f3619df9677ed723c32 --- cc/cc.go | 6 +++--- cc/sanitize.go | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cc/cc.go b/cc/cc.go index 76e6645c3..fe337f58c 100644 --- a/cc/cc.go +++ b/cc/cc.go @@ -552,13 +552,13 @@ func (ctx *moduleContextImpl) isVndkExt() bool { // Create source abi dumps if the module belongs to the list of VndkLibraries. func (ctx *moduleContextImpl) createVndkSourceAbiDump() bool { skipAbiChecks := ctx.ctx.Config().IsEnvTrue("SKIP_ABI_CHECKS") - isUnsanitizedVariant := true + isVariantOnProductionDevice := true sanitize := ctx.mod.sanitize if sanitize != nil { - isUnsanitizedVariant = sanitize.isUnsanitizedVariant() + isVariantOnProductionDevice = sanitize.isVariantOnProductionDevice() } vendorAvailable := Bool(ctx.mod.VendorProperties.Vendor_available) - return !skipAbiChecks && isUnsanitizedVariant && ctx.ctx.Device() && ((ctx.useVndk() && ctx.isVndk() && vendorAvailable) || inList(ctx.baseModuleName(), llndkLibraries)) + return !skipAbiChecks && isVariantOnProductionDevice && ctx.ctx.Device() && ((ctx.useVndk() && ctx.isVndk() && vendorAvailable) || inList(ctx.baseModuleName(), llndkLibraries)) } func (ctx *moduleContextImpl) selectedStl() string { diff --git a/cc/sanitize.go b/cc/sanitize.go index 859d87637..a6898a2c3 100644 --- a/cc/sanitize.go +++ b/cc/sanitize.go @@ -539,6 +539,11 @@ func (sanitize *sanitize) isUnsanitizedVariant() bool { !sanitize.isSanitizerEnabled(cfi) } +func (sanitize *sanitize) isVariantOnProductionDevice() bool { + return !sanitize.isSanitizerEnabled(asan) && + !sanitize.isSanitizerEnabled(tsan) +} + func (sanitize *sanitize) SetSanitizer(t sanitizerType, b bool) { switch t { case asan: