From 828d46fbbef95c33d19d0af153d48b3fe0f42759 Mon Sep 17 00:00:00 2001 From: Yo Chiang Date: Thu, 13 Aug 2020 12:45:52 +0800 Subject: [PATCH] Bypass missing required module check on ASAN SANITIZE_TARGET build ASAN SANITIZE_TARGET build may have missing dependencies due to executables being skipped, thus bypass the required module check. https://source.android.com/devices/tech/debug/asan#sanitize_target Also streamline the bypassing logic. Fix: 163802658 Test: TH Test: lunch aosp_cf_x86_pasan-userdebug && m SANITIZE_TARGET=address nothing Change-Id: Ia43c942ce7eae718bf6fcd254307535e418a70e7 --- core/main.mk | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/core/main.mk b/core/main.mk index 83bbac448b..3b13abbead 100644 --- a/core/main.mk +++ b/core/main.mk @@ -695,10 +695,23 @@ $(call select-bitness-of-target-host-required-modules,TARGET,HOST) $(call select-bitness-of-target-host-required-modules,HOST,TARGET) _nonexistent_required := $(sort $(_nonexistent_required)) +check_missing_required_modules := true +ifneq (,$(filter true,$(ALLOW_MISSING_DEPENDENCIES) $(BUILD_BROKEN_MISSING_REQUIRED_MODULES))) + check_missing_required_modules := +endif # ALLOW_MISSING_DEPENDENCIES == true || BUILD_BROKEN_MISSING_REQUIRED_MODULES == true + +# Some executables are skipped in ASAN SANITIZE_TARGET build, thus breaking their dependencies. +ifneq (,$(filter address,$(SANITIZE_TARGET))) + check_missing_required_modules := +endif # SANITIZE_TARGET has ASAN + # HOST OS darwin build is broken, disable this check for darwin for now. -# TODO(b/162102724): Remove this -ifeq (,$(filter $(HOST_OS),darwin)) -ifeq (,$(filter true,$(ALLOW_MISSING_DEPENDENCIES) $(BUILD_BROKEN_MISSING_REQUIRED_MODULES))) +# TODO(b/162102724): Remove this when darwin host has no broken dependency. +ifneq (,$(filter $(HOST_OS),darwin)) + check_missing_required_modules := +endif # HOST_OS == darwin + +ifeq (true,$(check_missing_required_modules)) ifneq (,$(_nonexistent_required)) $(warning Missing required dependencies:) $(foreach r_i,$(_nonexistent_required), \ @@ -708,8 +721,7 @@ ifneq (,$(_nonexistent_required)) $(warning Set BUILD_BROKEN_MISSING_REQUIRED_MODULES := true to bypass this check if this is intentional) $(error Build failed) endif # _nonexistent_required != empty -endif # ALLOW_MISSING_DEPENDENCIES != true && BUILD_BROKEN_MISSING_REQUIRED_MODULES != true -endif # HOST_OS != darwin +endif # check_missing_required_modules == true define add-required-deps $(1): | $(2)