Declare dependency on sanitizer runtime libraries
Moving the last users of a sanitizer runtime library to soong was
causing the runtime library to stop getting installed. Declare
the dependency so make keeps installing it.
Test: builds
Change-Id: Ieeb9ad5c04ac8df0d1a74239da393dac5cab2b03
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 7d7bd09..ab7768a 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -16,6 +16,7 @@
import (
"fmt"
+ "io"
"strings"
"github.com/google/blueprint"
@@ -102,6 +103,8 @@
type sanitize struct {
Properties SanitizeProperties
+
+ runtimeLibrary string
}
func (sanitize *sanitize) props() []interface{} {
@@ -377,7 +380,10 @@
// ASan runtime library must be the first in the link order.
if runtimeLibrary != "" {
- flags.libFlags = append([]string{"${config.ClangAsanLibDir}/" + runtimeLibrary}, flags.libFlags...)
+ flags.libFlags = append([]string{
+ "${config.ClangAsanLibDir}/" + runtimeLibrary + ctx.toolchain().ShlibSuffix(),
+ }, flags.libFlags...)
+ sanitize.runtimeLibrary = runtimeLibrary
}
blacklist := android.OptionalPathForModuleSrc(ctx, sanitize.Properties.Sanitize.Blacklist)
@@ -389,6 +395,16 @@
return flags
}
+func (sanitize *sanitize) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
+ ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) error {
+ if sanitize.runtimeLibrary != "" {
+ fmt.Fprintln(w, "LOCAL_SHARED_LIBRARIES += "+sanitize.runtimeLibrary)
+ }
+
+ return nil
+ })
+}
+
func (sanitize *sanitize) inSanitizerDir() bool {
return sanitize.Properties.InSanitizerDir
}