Export no sanitize link runtime flag
Bug: 294219797
Test: Unit tests
Change-Id: Id4bbf78e9ba3893fb857b85e6b7261b11404ebf0
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 626005b..957a873 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -91,6 +91,8 @@
hostOnlySanitizeFlags = []string{"-fno-sanitize-recover=all"}
deviceOnlySanitizeFlags = []string{"-fsanitize-trap=all", "-ftrap-function=abort"}
+
+ noSanitizeLinkRuntimeFlag = "-fno-sanitize-link-runtime"
)
type SanitizerType int
@@ -426,6 +428,8 @@
exportedVars.ExportString("CfiExportsMapFilename", cfiExportsMapFilename)
exportedVars.ExportString("CfiAssemblySupportFlag", cfiAssemblySupportFlag)
+ exportedVars.ExportString("NoSanitizeLinkRuntimeFlag", noSanitizeLinkRuntimeFlag)
+
android.RegisterMakeVarsProvider(pctx, cfiMakeVarsProvider)
android.RegisterMakeVarsProvider(pctx, hwasanMakeVarsProvider)
}
@@ -927,7 +931,7 @@
// Bionic and musl sanitizer runtimes have already been added as dependencies so that
// the right variant of the runtime will be used (with the "-android" or "-musl"
// suffixes), so don't let clang the runtime library.
- flags.Local.LdFlags = append(flags.Local.LdFlags, "-fno-sanitize-link-runtime")
+ flags.Local.LdFlags = append(flags.Local.LdFlags, noSanitizeLinkRuntimeFlag)
} else {
// Host sanitizers only link symbols in the final executable, so
// there will always be undefined symbols in intermediate libraries.