From 70bfe07e6c01c6547e2164463e1c6be8a9f71f11 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 5 Sep 2019 14:27:02 -0700 Subject: [PATCH] Support injecting boringssl hash in Make Add LOCAL_INJECT_BSSL_HASH for the two modules in Make that statically link libcrypto. Bug: 137267623 Test: m checkbuild Change-Id: I5d21c262ff388aeb2dbd02595706c5531a628b7e --- core/clear_vars.mk | 1 + core/dynamic_binary.mk | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/core/clear_vars.mk b/core/clear_vars.mk index b98027ddec..3cadcc2ae8 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -115,6 +115,7 @@ LOCAL_HEADER_LIBRARIES:= LOCAL_HOST_PREFIX:= LOCAL_HOST_REQUIRED_MODULES:= LOCAL_INIT_RC:= +LOCAL_INJECT_BSSL_HASH:= LOCAL_INSTALLED_MODULE:= LOCAL_INSTALLED_MODULE_STEM:= LOCAL_INSTRUMENTATION_FOR:= diff --git a/core/dynamic_binary.mk b/core/dynamic_binary.mk index 0accdc0fe7..27ff2c9698 100644 --- a/core/dynamic_binary.mk +++ b/core/dynamic_binary.mk @@ -39,6 +39,17 @@ include $(BUILD_SYSTEM)/use_lld_setup.mk include $(BUILD_SYSTEM)/binary.mk ################################### +ifdef LOCAL_INJECT_BSSL_HASH +inject_module := $(intermediates)/INJECT_BSSL_HASH/$(notdir $(my_installed_module_stem)) +LOCAL_INTERMEDIATE_TARGETS += $(inject_module) +$(inject_module): $(SOONG_HOST_OUT)/bin/bssl_inject_hash +$(inject_module): $(linked_module) + @echo "target inject BSSL hash: $(PRIVATE_MODULE) ($@)" + $(SOONG_HOST_OUT)/bin/bssl_inject_hash -in-object $< -o $@ +else +inject_module := $(linked_module) +endif + ########################################################### ## Store a copy with symbols for symbolic debugging ########################################################### @@ -47,7 +58,7 @@ my_unstripped_path := $(TARGET_OUT_UNSTRIPPED)/$(patsubst $(PRODUCT_OUT)/%,%,$(m else my_unstripped_path := $(LOCAL_UNSTRIPPED_PATH) endif -symbolic_input := $(linked_module) +symbolic_input := $(inject_module) symbolic_output := $(my_unstripped_path)/$(my_installed_module_stem) $(symbolic_output) : $(symbolic_input) @echo "target Symbolic: $(PRIVATE_MODULE) ($@)" @@ -59,7 +70,7 @@ $(symbolic_output) : $(symbolic_input) ifeq ($(BREAKPAD_GENERATE_SYMBOLS),true) my_breakpad_path := $(TARGET_OUT_BREAKPAD)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_module_path)) -breakpad_input := $(linked_module) +breakpad_input := $(inject_module) breakpad_output := $(my_breakpad_path)/$(my_installed_module_stem).sym $(breakpad_output) : $(breakpad_input) | $(BREAKPAD_DUMP_SYMS) $(PRIVATE_READELF) @echo "target breakpad: $(PRIVATE_MODULE) ($@)" @@ -133,6 +144,7 @@ endif # my_strip_module $(cleantarget): PRIVATE_CLEAN_FILES += \ $(linked_module) \ + $(inject_module) \ $(breakpad_output) \ $(symbolic_output) \ $(strip_output)