Use -target-feature for MTE
Instead of setting -march, use clang's -target-feature functionality
to enable MTE. Some projects set -march which may conflict with MTE's
usage. Using -target-feature to enable MTE removes any clang command
line ordering issues.
History:
* Originally submitted as 94d296d3d75428daceb03a55c01d77b4538d10ad
* reverted in b77d695fa1a4a1691b00db2d5f59e8fc1ef368ab due to
bug 371029823
* Prematurely resubmitted as 0feac37f1f21b135889758c4b866bba5de457838
and then subsequently reverted in
159860c848a709cac23ec7d448c6dfa6bfd8781b as the fix for bug 371029823
had not yet landed.
* Reapplied as eba30c35f8564f46a36825e443b531b1df2b5a6e and
subsequently reverted in 3f685cd5c3e87fee3aa2b1ff8ca51f1734b4f2c6
due to bug 399925046 (build timeout issue), which was resolved in
bug 401292715 (re-client upgrade).
Let's try again. 4th time's the charm.
Bug: 366222162
Test: compiles and boots
Change-Id: Ied4606b96cb2967af8edcbb4184981e09c807564
diff --git a/cc/sanitize.go b/cc/sanitize.go
index db99a53..b704ef4 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -79,7 +79,7 @@
minimalRuntimeFlags = []string{"-fsanitize-minimal-runtime", "-fno-sanitize-trap=integer,undefined",
"-fno-sanitize-recover=integer,undefined"}
- memtagStackCommonFlags = []string{"-march=armv8-a+memtag"}
+ memtagStackCommonFlags = []string{"-Xclang -target-feature -Xclang +mte"}
memtagStackLlvmFlags = []string{"-dom-tree-reachability-max-bbs-to-explore=128"}
hostOnlySanitizeFlags = []string{"-fno-sanitize-recover=all"}