From 924adc4d17edc3f56101b26ae5e22ae27f226b60 Mon Sep 17 00:00:00 2001 From: Yi Kong Date: Fri, 31 Aug 2018 14:27:44 -0700 Subject: [PATCH] Add BuiltinsRuntimeLibrary ... and rename SanitizerRuntimeLibrary to LibclangRuntimeLibrary since some of them are not sanitizers. Bug: 29275768 Test: m Change-Id: Id638adea42d22b02438fce26120aa155bea14d42 --- cc/config/arm64_device.go | 2 +- cc/config/arm_device.go | 2 +- cc/config/mips64_device.go | 2 +- cc/config/mips_device.go | 2 +- cc/config/toolchain.go | 30 +++++++++++++++++------------- cc/config/x86_64_device.go | 2 +- cc/config/x86_device.go | 2 +- 7 files changed, 23 insertions(+), 19 deletions(-) diff --git a/cc/config/arm64_device.go b/cc/config/arm64_device.go index f4125838f..6fdd524f7 100644 --- a/cc/config/arm64_device.go +++ b/cc/config/arm64_device.go @@ -238,7 +238,7 @@ func (t *toolchainArm64) ToolchainClangCflags() string { return t.toolchainClangCflags } -func (toolchainArm64) SanitizerRuntimeLibraryArch() string { +func (toolchainArm64) LibclangRuntimeLibraryArch() string { return "aarch64" } diff --git a/cc/config/arm_device.go b/cc/config/arm_device.go index 4719fb715..4135179d1 100644 --- a/cc/config/arm_device.go +++ b/cc/config/arm_device.go @@ -397,7 +397,7 @@ func (t *toolchainArm) ClangInstructionSetFlags(isa string) (string, error) { } } -func (toolchainArm) SanitizerRuntimeLibraryArch() string { +func (toolchainArm) LibclangRuntimeLibraryArch() string { return "arm" } diff --git a/cc/config/mips64_device.go b/cc/config/mips64_device.go index 6fa25714b..0c4640ba5 100644 --- a/cc/config/mips64_device.go +++ b/cc/config/mips64_device.go @@ -160,7 +160,7 @@ func (t *toolchainMips64) ClangLldflags() string { return "${config.Mips64ClangLdflags}" } -func (toolchainMips64) SanitizerRuntimeLibraryArch() string { +func (toolchainMips64) LibclangRuntimeLibraryArch() string { return "mips64" } diff --git a/cc/config/mips_device.go b/cc/config/mips_device.go index b815fc663..eb44fd5be 100644 --- a/cc/config/mips_device.go +++ b/cc/config/mips_device.go @@ -210,7 +210,7 @@ func (t *toolchainMips) ClangLldflags() string { return "${config.MipsClangLdflags}" } -func (toolchainMips) SanitizerRuntimeLibraryArch() string { +func (toolchainMips) LibclangRuntimeLibraryArch() string { return "mips" } diff --git a/cc/config/toolchain.go b/cc/config/toolchain.go index 39b5df4da..fefe7c2c3 100644 --- a/cc/config/toolchain.go +++ b/cc/config/toolchain.go @@ -79,7 +79,7 @@ type Toolchain interface { ShlibSuffix() string ExecutableSuffix() string - SanitizerRuntimeLibraryArch() string + LibclangRuntimeLibraryArch() string AvailableLibraries() []string @@ -156,7 +156,7 @@ func (toolchainBase) WindresFlags() string { return "" } -func (toolchainBase) SanitizerRuntimeLibraryArch() string { +func (toolchainBase) LibclangRuntimeLibraryArch() string { return "" } @@ -214,44 +214,48 @@ func addPrefix(list []string, prefix string) []string { return list } -func SanitizerRuntimeLibrary(t Toolchain, sanitizer string) string { - arch := t.SanitizerRuntimeLibraryArch() +func LibclangRuntimeLibrary(t Toolchain, library string) string { + arch := t.LibclangRuntimeLibraryArch() if arch == "" { return "" } - return "libclang_rt." + sanitizer + "-" + arch + "-android" + return "libclang_rt." + library + "-" + arch + "-android" +} + +func BuiltinsRuntimeLibrary(t Toolchain) string { + return LibclangRuntimeLibrary(t, "builtins") } func AddressSanitizerRuntimeLibrary(t Toolchain) string { - return SanitizerRuntimeLibrary(t, "asan") + return LibclangRuntimeLibrary(t, "asan") } func HWAddressSanitizerRuntimeLibrary(t Toolchain) string { - return SanitizerRuntimeLibrary(t, "hwasan") + return LibclangRuntimeLibrary(t, "hwasan") } func HWAddressSanitizerStaticLibrary(t Toolchain) string { - return SanitizerRuntimeLibrary(t, "hwasan_static") + return LibclangRuntimeLibrary(t, "hwasan_static") } func UndefinedBehaviorSanitizerRuntimeLibrary(t Toolchain) string { - return SanitizerRuntimeLibrary(t, "ubsan_standalone") + return LibclangRuntimeLibrary(t, "ubsan_standalone") } func UndefinedBehaviorSanitizerMinimalRuntimeLibrary(t Toolchain) string { - return SanitizerRuntimeLibrary(t, "ubsan_minimal") + return LibclangRuntimeLibrary(t, "ubsan_minimal") } func ThreadSanitizerRuntimeLibrary(t Toolchain) string { - return SanitizerRuntimeLibrary(t, "tsan") + return LibclangRuntimeLibrary(t, "tsan") } func ProfileRuntimeLibrary(t Toolchain) string { - return SanitizerRuntimeLibrary(t, "profile") + return LibclangRuntimeLibrary(t, "profile") } func ScudoRuntimeLibrary(t Toolchain) string { - return SanitizerRuntimeLibrary(t, "scudo") + return LibclangRuntimeLibrary(t, "scudo") } func ToolPath(t Toolchain) string { diff --git a/cc/config/x86_64_device.go b/cc/config/x86_64_device.go index ba0309450..5e2dc4931 100644 --- a/cc/config/x86_64_device.go +++ b/cc/config/x86_64_device.go @@ -227,7 +227,7 @@ func (t *toolchainX86_64) YasmFlags() string { return "${config.X86_64YasmFlags}" } -func (toolchainX86_64) SanitizerRuntimeLibraryArch() string { +func (toolchainX86_64) LibclangRuntimeLibraryArch() string { return "x86_64" } diff --git a/cc/config/x86_device.go b/cc/config/x86_device.go index 15188cf33..ffdf8ea8a 100644 --- a/cc/config/x86_device.go +++ b/cc/config/x86_device.go @@ -251,7 +251,7 @@ func (t *toolchainX86) YasmFlags() string { return "${config.X86YasmFlags}" } -func (toolchainX86) SanitizerRuntimeLibraryArch() string { +func (toolchainX86) LibclangRuntimeLibraryArch() string { return "i686" }