build: build modules from ALLHOSTMODULES for the host am: 8f541de9cc

Original change: https://android-review.googlesource.com/c/trusty/lk/trusty/+/2928631

Change-Id: I201c8537fe6e092f1a36fe0ec5b759e17d1bd2c1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/app/trusty/user-tasks.mk b/app/trusty/user-tasks.mk
index 33238a7..4adb923 100644
--- a/app/trusty/user-tasks.mk
+++ b/app/trusty/user-tasks.mk
@@ -24,6 +24,7 @@
 #
 # Input variables
 #
+#   ALLHOSTMODULES             - list of all host modules (e.g. Rust proc-macros) to be built
 #   TRUSTY_BUILTIN_USER_TASKS  - list of compiled from source user tasks to be included into final image
 #   TRUSTY_PREBUILT_USER_TASKS - list of precompiled user tasks to be included into final image
 #   	These prebuilt task modules must include a manifest binary and app elf binary, e.g.:
@@ -90,6 +91,15 @@
 TRUSTY_SDK_LICENSE := $(TRUSTY_SDK_DIR)/LICENSE
 TRUSTY_LIBRARY_BUILDDIR := $(BUILDDIR)/lib
 
+# Host modules required by userspace are built in passing as needed, as the
+# userspace build system respects MODULE_RUST_HOST_LIB. But the kernel may also
+# need some host modules, e.g. for proc-macro crates. So we explicitly iterate
+# over the set of host modules required by the kernel, generating their build
+# rules with the userspace build system.
+$(foreach lib,$(ALLHOSTMODULES),\
+	$(eval $(call trusty-build-rule,$(lib))))
+
+
 # The license file construction assumes that all projects will contain the same
 # set of SDK modules and thus the same set of respective license files. If this
 # ever changes, SDK zip construction in build.py will need to be adjusted to