Export asan configuration to make
Test: Ninja files for ASAN'd aosp_flounder-eng identical
Change-Id: Ib29cac0bc391dadd9ff27992c7b356415182767f
diff --git a/cc/sanitize.go b/cc/sanitize.go
index bb1a2ad..2676373 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -24,6 +24,12 @@
"android/soong/cc/config"
)
+const (
+ asanCflags = "-fno-omit-frame-pointer"
+ asanLdflags = "-Wl,-u,__asan_preinit"
+ asanLibs = "libasan"
+)
+
type sanitizerType int
func boolPtr(v bool) *bool {
@@ -175,7 +181,7 @@
if ctx.Device() {
if Bool(sanitize.Properties.Sanitize.Address) {
- deps.StaticLibs = append(deps.StaticLibs, "libasan")
+ deps.StaticLibs = append(deps.StaticLibs, asanLibs)
}
if Bool(sanitize.Properties.Sanitize.Address) || Bool(sanitize.Properties.Sanitize.Thread) {
deps.SharedLibs = append(deps.SharedLibs, "libdl")
@@ -236,8 +242,8 @@
// TODO: put in flags?
flags.RequiredInstructionSet = "arm"
}
- flags.CFlags = append(flags.CFlags, "-fno-omit-frame-pointer")
- flags.LdFlags = append(flags.LdFlags, "-Wl,-u,__asan_preinit")
+ flags.CFlags = append(flags.CFlags, asanCflags)
+ flags.LdFlags = append(flags.LdFlags, asanLdflags)
// ASan runtime library must be the first in the link order.
runtimeLibrary := config.AddressSanitizerRuntimeLibrary(ctx.toolchain())