Export no sanitize link runtime flag

Bug: 294219797
Test: Unit tests
Change-Id: Id4bbf78e9ba3893fb857b85e6b7261b11404ebf0
This commit is contained in:
Trevor Radcliffe
2023-08-02 20:24:29 +00:00
parent a263005e30
commit da64d91d2e

View File

@@ -91,6 +91,8 @@ var (
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 @@ func init() {
exportedVars.ExportString("CfiExportsMapFilename", cfiExportsMapFilename)
exportedVars.ExportString("CfiAssemblySupportFlag", cfiAssemblySupportFlag)
exportedVars.ExportString("NoSanitizeLinkRuntimeFlag", noSanitizeLinkRuntimeFlag)
android.RegisterMakeVarsProvider(pctx, cfiMakeVarsProvider)
android.RegisterMakeVarsProvider(pctx, hwasanMakeVarsProvider)
}
@@ -927,7 +931,7 @@ func (s *sanitize) flags(ctx ModuleContext, flags Flags) Flags {
// 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.