Export TSAN_RUNTIME_LIBRARY make variable

TSAN_RUNTIME_LIBRARY is used by external/clang/Android.mk to get the
name of the per-arch TSAN runtime.  This CL also factors-out common code
out of functions that construct names of the sanitizer libraries.

Test: python external/clang/build.py with all CLs in this topic

Change-Id: Ie5fac242c0d5a9296ab8936db927a4c934061aa4
This commit is contained in:
Pirama Arumuga Nainar 2017-03-27 11:00:38 -07:00
parent e28c098504
commit 16b626b827
2 changed files with 12 additions and 7 deletions

View file

@ -207,20 +207,24 @@ func inList(s string, list []string) bool {
return indexList(s, list) != -1
}
func AddressSanitizerRuntimeLibrary(t Toolchain) string {
func SanitizerRuntimeLibrary(t Toolchain, sanitizer string) string {
arch := t.SanitizerRuntimeLibraryArch()
if arch == "" {
return ""
}
return "libclang_rt.asan-" + arch + "-android.so"
return "libclang_rt." + sanitizer + "-" + arch + "-android.so"
}
func AddressSanitizerRuntimeLibrary(t Toolchain) string {
return SanitizerRuntimeLibrary(t, "asan")
}
func UndefinedBehaviorSanitizerRuntimeLibrary(t Toolchain) string {
arch := t.SanitizerRuntimeLibraryArch()
if arch == "" {
return ""
}
return "libclang_rt.ubsan_standalone-" + arch + "-android.so"
return SanitizerRuntimeLibrary(t, "ubsan_standalone")
}
func ThreadSanitizerRuntimeLibrary(t Toolchain) string {
return SanitizerRuntimeLibrary(t, "tsan")
}
func ToolPath(t Toolchain) string {

View file

@ -209,6 +209,7 @@ func makeVarsToolchain(ctx android.MakeVarsContext, secondPrefix string,
if target.Os.Class == android.Device {
ctx.Strict(secondPrefix+"ADDRESS_SANITIZER_RUNTIME_LIBRARY", strings.TrimSuffix(config.AddressSanitizerRuntimeLibrary(toolchain), ".so"))
ctx.Strict(secondPrefix+"UBSAN_RUNTIME_LIBRARY", strings.TrimSuffix(config.UndefinedBehaviorSanitizerRuntimeLibrary(toolchain), ".so"))
ctx.Strict(secondPrefix+"TSAN_RUNTIME_LIBRARY", strings.TrimSuffix(config.ThreadSanitizerRuntimeLibrary(toolchain), ".so"))
}
// This is used by external/gentoo/...