aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVishwath Mohan <vishwath@google.com>2017-11-17 11:19:36 -0800
committerVishwath Mohan <vishwath@google.com>2017-11-21 14:08:20 -0800
commit96a130bdafa3f143f15257455f4c6aaa56155351 (patch)
tree8abb7098dcc776b604fc9e86b9203d8ac9fcce69
parentd6f229842a37988dbb2153ad18c0eb7ff3aadc79 (diff)
downloadbuild-96a130bdafa3f143f15257455f4c6aaa56155351.tar.gz
Use the .cfi variant of a static library where needed.
This CL repoints static dependencies to their .cfi variants for CFI enabled targets. It also disables CFI for host targets because the version of ar intended for hosts does not have plugin support (which CFI requires). Bug: 67507323 Test: m -j40 Change-Id: Id11afd0c8765469858f406aace2a192afff6d042
-rw-r--r--core/binary.mk16
-rw-r--r--core/config_sanitizers.mk6
2 files changed, 22 insertions, 0 deletions
diff --git a/core/binary.mk b/core/binary.mk
index bd1e601323..5fa854ef8b 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -1330,6 +1330,22 @@ $(call track-src-file-obj,$(asm_sources_asm),$(asm_objects_asm))
asm_objects += $(asm_objects_asm)
endif
+###################################################################
+## When compiling a CFI enabled target, use the .cfi variant of any
+## static dependencies (where they exist).
+##################################################################
+define use_soong_cfi_static_libraries
+ $(foreach l,$(1),$(if $(filter $(l),$(SOONG_CFI_STATIC_LIBRARIES)),\
+ $(l).cfi,$(l)))
+endef
+
+ifneq ($(filter cfi,$(my_sanitize)),)
+ my_whole_static_libraries := $(call use_soong_cfi_static_libraries,\
+ $(my_whole_static_libraries))
+ my_static_libraries := $(call use_soong_cfi_static_libraries,\
+ $(my_static_libraries))
+endif
+
###########################################################
## When compiling against the VNDK, use LL-NDK libraries
###########################################################
diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk
index 8bd92486e0..94151430f9 100644
--- a/core/config_sanitizers.mk
+++ b/core/config_sanitizers.mk
@@ -132,6 +132,12 @@ ifneq ($(filter mips mips64,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)),)
my_sanitize_diag := $(filter-out cfi,$(my_sanitize_diag))
endif
+# Disable CFI for host targets
+ifdef LOCAL_IS_HOST_MODULE
+ my_sanitize := $(filter-out cfi,$(my_sanitize))
+ my_sanitize_diag := $(filter-out cfi,$(my_sanitize_diag))
+endif
+
# Support for local sanitize blacklist paths.
ifneq ($(my_sanitize)$(my_global_sanitize),)
ifneq ($(LOCAL_SANITIZE_BLACKLIST),)