summaryrefslogtreecommitdiff
path: root/board/cr50/build.mk
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2019-02-06 17:21:59 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-02-10 21:46:24 -0800
commite99a9200a78140512bdab8e2d9248c6c84365e83 (patch)
tree323215a335832a300c55b0fdec730a8855eee4e6 /board/cr50/build.mk
parente8a5c23c859fe613dfad6166cbcf8fd79a237ec6 (diff)
downloadchrome-ec-e99a9200a78140512bdab8e2d9248c6c84365e83.tar.gz
cr50: use list of object files instead of the libraries for tpm2
In preparation to enabling link time optimizations for Cr50, modify build system to link tpm2 tree's modules directly instead of linking the archive. Also, use the special tpm2 Makefile target, 'copied_objs', which will rename .bss segment of all .o files into .bss.Tpm2_common. This will make easier to ensure that all uninitialized data of the tpm2 library is placed in the same memory block, which can be zeroed out when TPM restarts. CQ-DEPEND=CL:1457398 BRANCH=cr50, cr50-mp BUG=b:65253310 TEST=tried the following - make buildall -j succeeds - TCG tests succeed. - the size of __bss_libtpm2 section did not change. Change-Id: I5374391feb13564305519e93d60c3347aa5e4b93 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1457601 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'board/cr50/build.mk')
-rw-r--r--board/cr50/build.mk14
1 files changed, 7 insertions, 7 deletions
diff --git a/board/cr50/build.mk b/board/cr50/build.mk
index 87d1f93423..00b88694f6 100644
--- a/board/cr50/build.mk
+++ b/board/cr50/build.mk
@@ -96,16 +96,16 @@ CFLAGS += -DEMBEDDED_MODE=1
# Configure cryptoc headers to handle unaligned accesses.
CFLAGS += -DSUPPORT_UNALIGNED=1
+TPM2_OBJS = $(shell find $(out)/tpm2 -name '*.cp.o')
# Add dependencies on that library
-$(out)/RW/ec.RW.elf $(out)/RW/ec.RW_B.elf: LDFLAGS_EXTRA += -L$(out)/tpm2 -ltpm2
-$(out)/RW/ec.RW.elf $(out)/RW/ec.RW_B.elf: $(out)/tpm2/libtpm2.a
-
-#$(out)/RW/ec.RW_B.elf: $(out)/tpm2/libtpm2.a LDFLAGS_EXTRA += -L$(out)/tpm2 -ltpm2
+$(out)/RW/ec.RW.elf $(out)/RW/ec.RW_B.elf: LDFLAGS_EXTRA += $(TPM2_OBJS)
+$(out)/RW/ec.RW.elf $(out)/RW/ec.RW_B.elf: copied_objs
# Force the external build each time, so it can look for changed sources.
-.PHONY: $(out)/tpm2/libtpm2.a
-$(out)/tpm2/libtpm2.a:
- $(MAKE) obj=$(realpath $(out))/tpm2 EMBEDDED_MODE=1 OBJ_PREFIX=Tpm2_ -C $(EXTLIB)
+.PHONY: copied_objs
+copied_objs:
+ $(MAKE) obj=$(realpath $(out))/tpm2 EMBEDDED_MODE=1 \
+ -C $(EXTLIB) copied_objs
endif # BOARD_MK_INCLUDED_ONCE is nonempty