From 9c993544650a3b60e3d4f819aa800f2737a36db2 Mon Sep 17 00:00:00 2001 From: Elvis Chien Date: Fri, 25 Jun 2021 01:15:17 +0800 Subject: [PATCH] Allow PRODUCT_CFI_INCLUDE_PATHS to work with blueprints also but disable it for host modules like how it's done for Android.mk Bug: 179233410 Test: m -j32 Change-Id: I246cd9163e06997a2b50cd25688370690c8929af --- cc/library.go | 2 +- cc/sanitize.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cc/library.go b/cc/library.go index 8f302fcb9..6c7102e3e 100644 --- a/cc/library.go +++ b/cc/library.go @@ -1751,7 +1751,7 @@ func (library *libraryDecorator) install(ctx ModuleContext, file android.Path) { mayUseCoreVariant = false } - if ctx.Config().CFIEnabledForPath(ctx.ModuleDir()) && ctx.Arch().ArchType == android.Arm64 { + if ctx.Config().CFIEnabledForPath(ctx.ModuleDir()) { mayUseCoreVariant = false } diff --git a/cc/sanitize.go b/cc/sanitize.go index b24439437..dd15ae13d 100644 --- a/cc/sanitize.go +++ b/cc/sanitize.go @@ -437,8 +437,8 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) { } } - // Enable CFI for all components in the include paths (for Aarch64 only) - if s.Cfi == nil && ctx.Config().CFIEnabledForPath(ctx.ModuleDir()) && ctx.Arch().ArchType == android.Arm64 { + // Enable CFI for non-host components in the include paths + if s.Cfi == nil && ctx.Config().CFIEnabledForPath(ctx.ModuleDir()) && !ctx.Host() { s.Cfi = proptools.BoolPtr(true) if inList("cfi", ctx.Config().SanitizeDeviceDiag()) { s.Diag.Cfi = proptools.BoolPtr(true)