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/androidmk.go b/cc/androidmk.go
index f853b13..cba8782 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -76,6 +76,9 @@
c.subAndroidMk(&ret, c.compiler)
c.subAndroidMk(&ret, c.linker)
+ if c.sanitize != nil {
+ c.subAndroidMk(&ret, c.sanitize)
+ }
c.subAndroidMk(&ret, c.installer)
if c.vndk() {
diff --git a/cc/config/toolchain.go b/cc/config/toolchain.go
index 5270437..fc0282b 100644
--- a/cc/config/toolchain.go
+++ b/cc/config/toolchain.go
@@ -212,7 +212,7 @@
if arch == "" {
return ""
}
- return "libclang_rt." + sanitizer + "-" + arch + "-android.so"
+ return "libclang_rt." + sanitizer + "-" + arch + "-android"
}
func AddressSanitizerRuntimeLibrary(t Toolchain) string {
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
}