Add ubsan_standalone library name to the toolchain.
and export the library name to make. Refactor the code a bit to avoid repeating the library name
multiple times.
Bug: 22033465
Test: Ran external/clang/build.py for aosp-llvm
Change-Id: I25eb3858eb92e1dd493b09524d559802551b2547
diff --git a/cc/config/toolchain.go b/cc/config/toolchain.go
index c286a9a..5a4e032 100644
--- a/cc/config/toolchain.go
+++ b/cc/config/toolchain.go
@@ -71,7 +71,7 @@
ShlibSuffix() string
ExecutableSuffix() string
- AddressSanitizerRuntimeLibrary() string
+ SanitizerRuntimeLibraryArch() string
AvailableLibraries() []string
}
@@ -125,7 +125,7 @@
return ""
}
-func (toolchainBase) AddressSanitizerRuntimeLibrary() string {
+func (toolchainBase) SanitizerRuntimeLibraryArch() string {
return ""
}
@@ -188,3 +188,19 @@
func inList(s string, list []string) bool {
return indexList(s, list) != -1
}
+
+func AddressSanitizerRuntimeLibrary(t Toolchain) string {
+ arch := t.SanitizerRuntimeLibraryArch()
+ if arch == "" {
+ return ""
+ }
+ return "libclang_rt.asan-" + arch + "-android.so"
+}
+
+func UndefinedBehaviorSanitizerRuntimeLibrary(t Toolchain) string {
+ arch := t.SanitizerRuntimeLibraryArch()
+ if arch == "" {
+ return ""
+ }
+ return "libclang_rt.ubsan_standalone-" + arch + "-android.so"
+}