Run $(AR) with LLVMgold.so plugin for CFI targets.

Bug: 34623182
Test: add LOCAL_SANITIZE:=cfi to some static libraries under libstagefright
Change-Id: I4f0d8cbd794e0ce4737c59a4617e93c7a5defec1
This commit is contained in:
Evgenii Stepanov 2017-01-23 16:57:38 -08:00
parent 2d7fb30207
commit e1b96f3ae5
3 changed files with 4 additions and 0 deletions

View file

@ -57,6 +57,7 @@ my_generated_sources := $(LOCAL_GENERATED_SOURCES)
my_additional_dependencies := $(LOCAL_ADDITIONAL_DEPENDENCIES)
my_export_c_include_dirs := $(LOCAL_EXPORT_C_INCLUDE_DIRS)
my_export_c_include_deps := $(LOCAL_EXPORT_C_INCLUDE_DEPS)
my_arflags :=
ifneq (,$(strip $(foreach dir,$(subst $(comma),$(space),$(COVERAGE_PATHS)),$(filter $(dir)%,$(LOCAL_PATH)))))
my_native_coverage := true
@ -1736,6 +1737,7 @@ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDFLAGS := $(my_ldflags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDLIBS := $(my_ldlibs)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TIDY_CHECKS := $(my_tidy_checks)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TIDY_FLAGS := $(my_tidy_flags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ARFLAGS := $(my_arflags)
# this is really the way to get the files onto the command line instead
# of using $^, because then LOCAL_ADDITIONAL_DEPENDENCIES doesn't work

View file

@ -145,6 +145,7 @@ endif
ifneq ($(filter cfi,$(my_sanitize)),)
my_cflags += -flto -fsanitize-cfi-cross-dso -fvisibility=default
my_ldflags += -flto -fsanitize-cfi-cross-dso -fsanitize=cfi -Wl,-plugin-opt,O1 -Wl,-export-dynamic-symbol=__cfi_check
my_arflags += --plugin $(LLVM_PREBUILTS_PATH)/../lib64/LLVMgold.so
endif
# If local or global modules need ASAN, add linker flags.

View file

@ -1581,6 +1581,7 @@ define transform-o-to-static-lib
$(extract-and-include-target-whole-static-libs)
$(call split-long-arguments,$($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_AR) \
$($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_ARFLAGS) \
$(PRIVATE_ARFLAGS) \
$@,$(PRIVATE_ALL_OBJECTS))
endef