aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitch Phillips <mitchp@google.com>2019-11-11 09:10:01 -0800
committerandroid-build-merger <android-build-merger@google.com>2019-11-11 09:10:01 -0800
commite276889771ddd979e4c153d1bed082b7e82f94a1 (patch)
treef4b39b43b07396473f46e888e6faac8cefd9d4d5
parent8f581c1de430cdc38089085ce29f2353fdbb1f95 (diff)
parent6462bbf0ba4fc6e07104cd0b286c36e9e94c6cb9 (diff)
downloadbuild-e276889771ddd979e4c153d1bed082b7e82f94a1.tar.gz
Merge "Make backend for shared library fuzzing." am: eed4e1324e
am: 6462bbf0ba Change-Id: I8331740dbe99a5edbbda84126846cd9698c0ad17
-rw-r--r--core/Makefile15
-rw-r--r--core/clear_vars.mk1
-rw-r--r--core/soong_cc_prebuilt.mk6
3 files changed, 21 insertions, 1 deletions
diff --git a/core/Makefile b/core/Makefile
index e3964c3559..3a0c0cd1dd 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -5097,6 +5097,19 @@ include $(TOPDIR)development/build/tools/sdk_repo.mk
endif
# -----------------------------------------------------------------
+# Soong generates the list of all shared libraries that are depended on by fuzz
+# targets. It saves this list as a source:destination pair to
+# FUZZ_TARGET_SHARED_DEPS_INSTALL_PAIRS, where the source is the path to the
+# build of the unstripped shared library, and the destination is the
+# /data/fuzz/$ARCH/lib (for device) or /fuzz/$ARCH/lib (for host) directory
+# where fuzz target shared libraries are to be "reinstalled". The
+# copy-many-files below generates the rules to copy the unstripped shared
+# libraries to the device or host "reinstallation" directory. These rules are
+# depended on by each module in soong_cc_prebuilt.mk, where the module will have
+# a dependency on each shared library that it needs to be "reinstalled".
+FUZZ_SHARED_DEPS := $(call copy-many-files,$(strip $(FUZZ_TARGET_SHARED_DEPS_INSTALL_PAIRS)))
+
+# -----------------------------------------------------------------
# The rule to build all fuzz targets, and package them.
# Note: The packages are created in Soong, and in a perfect world,
# we'd be able to create the phony rule there. But, if we want to
@@ -5107,5 +5120,5 @@ endif
# directory`, because kati will see 'fuzz' as being a file, not a
# phony target.
.PHONY: fuzz
-fuzz: $(SOONG_FUZZ_PACKAGING_ARCH_MODULES)
+fuzz: $(SOONG_FUZZ_PACKAGING_ARCH_MODULES) $(ALL_FUZZ_TARGETS)
$(call dist-for-goals,fuzz,$(SOONG_FUZZ_PACKAGING_ARCH_MODULES))
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 4818c01172..9ff978bee1 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -106,6 +106,7 @@ LOCAL_FULL_LIBS_MANIFEST_FILES:=
LOCAL_FULL_MANIFEST_FILE:=
LOCAL_FULL_TEST_CONFIG:=
LOCAL_FUZZ_ENGINE:=
+LOCAL_FUZZ_INSTALLED_SHARED_DEPS:=
LOCAL_GCNO_FILES:=
LOCAL_GENERATED_SOURCES:=
# Group static libraries with "-Wl,--start-group" and "-Wl,--end-group" when linking.
diff --git a/core/soong_cc_prebuilt.mk b/core/soong_cc_prebuilt.mk
index 20950ca21e..2d5089d0e0 100644
--- a/core/soong_cc_prebuilt.mk
+++ b/core/soong_cc_prebuilt.mk
@@ -220,3 +220,9 @@ installed_static_library_notice_file_targets := \
$(notice_target): | $(installed_static_library_notice_file_targets)
$(LOCAL_INSTALLED_MODULE): | $(notice_target)
+
+# Reinstall shared library dependencies of fuzz targets to /data/fuzz/ (for
+# target) or /data/ (for host).
+ifdef LOCAL_IS_FUZZ_TARGET
+$(LOCAL_INSTALLED_MODULE): $(LOCAL_FUZZ_INSTALLED_SHARED_DEPS)
+endif