From 1a8405f82714f02223c21c7e0d01ac5ee029104f Mon Sep 17 00:00:00 2001 From: Mitch Phillips Date: Mon, 1 Mar 2021 09:12:25 -0800 Subject: [PATCH] Add MTE ELF note to makefile-generated native tests. The MTE ELF note is intended to be added to all aarch64 test binaries. This is already implemented for cc_test in soong, but we should also add it to makefile-generated tests. Bug: 156029370 Bug: 181133973 Test: atest CtsBionicTestCases on QEMU+MTE, observe previously-failing tests will now succeed. Test: m camera_client_test; readelf -t /camera_client_test | grep memtag, make sure there's the elf note. Change-Id: I2e7c4d1379ccdef04f05dd7aff675e6834d4799b --- core/target_test_internal.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/target_test_internal.mk b/core/target_test_internal.mk index 40b2ba87cc..5745451917 100644 --- a/core/target_test_internal.mk +++ b/core/target_test_internal.mk @@ -39,3 +39,9 @@ ifndef LOCAL_MODULE_RELATIVE_PATH LOCAL_MODULE_RELATIVE_PATH := $(LOCAL_MODULE) endif endif + +# Implicitly run this test under MTE SYNC for aarch64 binaries. This is a no-op +# on non-MTE hardware. +ifneq (,$(filter arm64,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))) + LOCAL_WHOLE_STATIC_LIBRARIES += note_memtag_heap_sync +endif