Use single module for clang runtime libraries

The clang prebuilts now provide a single module with per-architecture
variants instead of a module per architecture.

Bug: 220019988
Test: m checkbuild
Change-Id: I39e2cf8ae14edf8510276dab38011afaef85822c
This commit is contained in:
Colin Cross 2022-02-10 11:41:18 -08:00
parent c7943da316
commit 386ee59a23
11 changed files with 32 additions and 119 deletions

View file

@ -1405,7 +1405,7 @@ func (a *apexBundle) AddSanitizerDependencies(ctx android.BottomUpMutatorContext
for _, target := range ctx.MultiTargets() {
if target.Arch.ArchType.Multilib == "lib64" {
addDependenciesForNativeModules(ctx, ApexNativeDependencies{
Native_shared_libs: []string{"libclang_rt.hwasan-aarch64-android"},
Native_shared_libs: []string{"libclang_rt.hwasan"},
Tests: nil,
Jni_libs: nil,
Binaries: nil,

View file

@ -1412,13 +1412,14 @@ func TestRuntimeApexShouldInstallHwasanIfLibcDependsOnIt(t *testing.T) {
}
cc_prebuilt_library_shared {
name: "libclang_rt.hwasan-aarch64-android",
name: "libclang_rt.hwasan",
no_libcrt: true,
nocrt: true,
stl: "none",
system_shared_libs: [],
srcs: [""],
stubs: { versions: ["1"] },
stem: "libclang_rt.hwasan-aarch64-android",
sanitize: {
never: true,
@ -1431,7 +1432,7 @@ func TestRuntimeApexShouldInstallHwasanIfLibcDependsOnIt(t *testing.T) {
"lib64/bionic/libclang_rt.hwasan-aarch64-android.so",
})
hwasan := ctx.ModuleForTests("libclang_rt.hwasan-aarch64-android", "android_arm64_armv8-a_shared")
hwasan := ctx.ModuleForTests("libclang_rt.hwasan", "android_arm64_armv8-a_shared")
installed := hwasan.Description("install libclang_rt.hwasan")
ensureContains(t, installed.Output.String(), "/system/lib64/bootstrap/libclang_rt.hwasan-aarch64-android.so")
@ -1459,13 +1460,14 @@ func TestRuntimeApexShouldInstallHwasanIfHwaddressSanitized(t *testing.T) {
}
cc_prebuilt_library_shared {
name: "libclang_rt.hwasan-aarch64-android",
name: "libclang_rt.hwasan",
no_libcrt: true,
nocrt: true,
stl: "none",
system_shared_libs: [],
srcs: [""],
stubs: { versions: ["1"] },
stem: "libclang_rt.hwasan-aarch64-android",
sanitize: {
never: true,
@ -1479,7 +1481,7 @@ func TestRuntimeApexShouldInstallHwasanIfHwaddressSanitized(t *testing.T) {
"lib64/bionic/libclang_rt.hwasan-aarch64-android.so",
})
hwasan := ctx.ModuleForTests("libclang_rt.hwasan-aarch64-android", "android_arm64_armv8-a_shared")
hwasan := ctx.ModuleForTests("libclang_rt.hwasan", "android_arm64_armv8-a_shared")
installed := hwasan.Description("install libclang_rt.hwasan")
ensureContains(t, installed.Output.String(), "/system/lib64/bootstrap/libclang_rt.hwasan-aarch64-android.so")

View file

@ -1383,7 +1383,7 @@ func isBionic(name string) bool {
}
func InstallToBootstrap(name string, config android.Config) bool {
if name == "libclang_rt.hwasan-aarch64-android" {
if name == "libclang_rt.hwasan" {
return true
}
return isBionic(name)

View file

@ -2944,13 +2944,13 @@ func TestStaticLibDepExport(t *testing.T) {
// Check the shared version of lib2.
variant := "android_arm64_armv8-a_shared"
module := ctx.ModuleForTests("lib2", variant).Module().(*Module)
checkStaticLibs(t, []string{"lib1", "libc++demangle", "libclang_rt.builtins-aarch64-android"}, module)
checkStaticLibs(t, []string{"lib1", "libc++demangle", "libclang_rt.builtins"}, module)
// Check the static version of lib2.
variant = "android_arm64_armv8-a_static"
module = ctx.ModuleForTests("lib2", variant).Module().(*Module)
// libc++_static is linked additionally.
checkStaticLibs(t, []string{"lib1", "libc++_static", "libc++demangle", "libclang_rt.builtins-aarch64-android"}, module)
checkStaticLibs(t, []string{"lib1", "libc++_static", "libc++demangle", "libclang_rt.builtins"}, module)
}
var compilerFlagsTestCases = []struct {

View file

@ -227,14 +227,7 @@ func addPrefix(list []string, prefix string) []string {
}
func LibclangRuntimeLibrary(t Toolchain, library string) string {
arch := t.LibclangRuntimeLibraryArch()
if arch == "" {
return ""
}
if !t.Bionic() {
return "libclang_rt." + library + "-" + arch
}
return "libclang_rt." + library + "-" + arch + "-android"
return "libclang_rt." + library
}
func BuiltinsRuntimeLibrary(t Toolchain) string {

View file

@ -24,11 +24,7 @@ import (
var prepareForAsanTest = android.FixtureAddFile("asan/Android.bp", []byte(`
cc_library_shared {
name: "libclang_rt.asan-aarch64-android",
}
cc_library_shared {
name: "libclang_rt.asan-arm-android",
name: "libclang_rt.asan",
}
`))

View file

@ -86,53 +86,19 @@ func commonDefaultModules() string {
}
cc_prebuilt_library_static {
name: "libclang_rt.builtins-arm-android",
defaults: ["toolchain_libs_defaults"],
native_bridge_supported: true,
vendor_ramdisk_available: true,
}
cc_prebuilt_library_static {
name: "libclang_rt.builtins-aarch64-android",
defaults: ["toolchain_libs_defaults"],
native_bridge_supported: true,
vendor_ramdisk_available: true,
}
cc_prebuilt_library_static {
name: "libclang_rt.builtins-x86_64",
defaults: ["toolchain_libs_defaults"],
host_supported: true,
}
cc_prebuilt_library_static {
name: "libclang_rt.builtins-i386",
name: "libclang_rt.builtins",
defaults: ["toolchain_libs_defaults"],
host_supported: true,
vendor_available: true,
vendor_ramdisk_available: true,
native_bridge_supported: true,
}
cc_prebuilt_library_shared {
name: "libclang_rt.hwasan-aarch64-android",
name: "libclang_rt.hwasan",
defaults: ["toolchain_libs_defaults"],
}
cc_prebuilt_library_static {
name: "libclang_rt.builtins-i686-android",
defaults: ["toolchain_libs_defaults"],
vendor_ramdisk_available: true,
native_bridge_supported: true,
}
cc_prebuilt_library_static {
name: "libclang_rt.builtins-x86_64-android",
defaults: [
"linux_bionic_supported",
"toolchain_libs_defaults",
],
native_bridge_supported: true,
vendor_ramdisk_available: true,
}
cc_prebuilt_library_static {
name: "libunwind",
defaults: [
@ -144,30 +110,7 @@ func commonDefaultModules() string {
}
cc_prebuilt_library_static {
name: "libclang_rt.fuzzer-arm-android",
defaults: ["toolchain_libs_defaults"],
}
cc_prebuilt_library_static {
name: "libclang_rt.fuzzer-aarch64-android",
defaults: ["toolchain_libs_defaults"],
}
cc_prebuilt_library_static {
name: "libclang_rt.fuzzer-i686-android",
defaults: ["toolchain_libs_defaults"],
}
cc_prebuilt_library_static {
name: "libclang_rt.fuzzer-x86_64-android",
defaults: [
"linux_bionic_supported",
"toolchain_libs_defaults",
],
}
cc_prebuilt_library_static {
name: "libclang_rt.fuzzer-x86_64",
name: "libclang_rt.fuzzer",
defaults: [
"linux_bionic_supported",
"toolchain_libs_defaults",
@ -176,17 +119,12 @@ func commonDefaultModules() string {
// Needed for sanitizer
cc_prebuilt_library_shared {
name: "libclang_rt.ubsan_standalone-aarch64-android",
name: "libclang_rt.ubsan_standalone",
defaults: ["toolchain_libs_defaults"],
}
cc_prebuilt_library_static {
name: "libclang_rt.ubsan_minimal-aarch64-android",
defaults: ["toolchain_libs_defaults"],
}
cc_prebuilt_library_static {
name: "libclang_rt.ubsan_minimal-arm-android",
name: "libclang_rt.ubsan_minimal",
defaults: ["toolchain_libs_defaults"],
}

View file

@ -450,7 +450,7 @@ var _ android.OutputFileProducer = &vndkLibrariesTxt{}
// Therefore, by removing the library here, we cause it to only be installed if libc
// depends on it.
func llndkLibrariesTxtFactory() android.SingletonModule {
return newVndkLibrariesWithMakeVarFilter(llndkLibraries, "LLNDK_LIBRARIES", "libclang_rt.hwasan-")
return newVndkLibrariesWithMakeVarFilter(llndkLibraries, "LLNDK_LIBRARIES", "libclang_rt.hwasan")
}
// vndksp_libraries_txt is a singleton module whose content is a list of VNDKSP libraries

View file

@ -121,14 +121,7 @@ func LibFuzzerRuntimeLibrary(t Toolchain) string {
}
func LibclangRuntimeLibrary(t Toolchain, library string) string {
arch := t.LibclangRuntimeLibraryArch()
if arch == "" {
return ""
}
if !t.Bionic() {
return "libclang_rt." + library + "-" + arch
}
return "libclang_rt." + library + "-" + arch + "-android"
return "libclang_rt." + library
}
func LibRustRuntimeLibrary(t Toolchain, library string) string {

View file

@ -88,13 +88,13 @@ func GatherRequiredDepsForTest() string {
export_include_dirs: ["libprotobuf-cpp-full-includes"],
}
cc_library {
name: "libclang_rt.asan-aarch64-android",
name: "libclang_rt.asan",
no_libcrt: true,
nocrt: true,
system_shared_libs: [],
}
cc_library {
name: "libclang_rt.hwasan_static-aarch64-android",
name: "libclang_rt.hwasan_static",
no_libcrt: true,
nocrt: true,
system_shared_libs: [],

View file

@ -561,7 +561,7 @@ func TestVendorSnapshotUse(t *testing.T) {
static_libs: [
"libvendor",
"libvndk",
"libclang_rt.builtins-aarch64-android",
"libclang_rt.builtins",
"note_memtag_heap_sync",
],
shared_libs: [
@ -589,7 +589,7 @@ func TestVendorSnapshotUse(t *testing.T) {
static_libs: [
"libvendor",
"libvndk",
"libclang_rt.builtins-arm-android",
"libclang_rt.builtins",
],
shared_libs: [
"libvendor_available",
@ -731,19 +731,7 @@ func TestVendorSnapshotUse(t *testing.T) {
}
vendor_snapshot_static {
name: "libclang_rt.builtins-aarch64-android",
version: "30",
target_arch: "arm64",
vendor: true,
arch: {
arm64: {
src: "libclang_rt.builtins-aarch64-android.a",
},
},
}
vendor_snapshot_static {
name: "libclang_rt.builtins-arm-android",
name: "libclang_rt.builtins",
version: "30",
target_arch: "arm64",
vendor: true,
@ -751,6 +739,9 @@ func TestVendorSnapshotUse(t *testing.T) {
arm: {
src: "libclang_rt.builtins-arm-android.a",
},
arm64: {
src: "libclang_rt.builtins-aarch64-android.a",
},
},
}
@ -967,7 +958,7 @@ func TestVendorSnapshotUse(t *testing.T) {
}
libclientAndroidMkStaticLibs := ctx.ModuleForTests("libclient", sharedVariant).Module().(*Module).Properties.AndroidMkStaticLibs
if g, w := libclientAndroidMkStaticLibs, []string{"libvendor", "libvendor_without_snapshot", "libclang_rt.builtins-aarch64-android.vendor"}; !reflect.DeepEqual(g, w) {
if g, w := libclientAndroidMkStaticLibs, []string{"libvendor", "libvendor_without_snapshot", "libclang_rt.builtins.vendor"}; !reflect.DeepEqual(g, w) {
t.Errorf("wanted libclient AndroidMkStaticLibs %q, got %q", w, g)
}
@ -1024,7 +1015,7 @@ func TestVendorSnapshotUse(t *testing.T) {
}
memtagStaticLibs := ctx.ModuleForTests("memtag_binary", "android_vendor.30_arm64_armv8-a").Module().(*Module).Properties.AndroidMkStaticLibs
if g, w := memtagStaticLibs, []string{"libclang_rt.builtins-aarch64-android.vendor", "note_memtag_heap_sync.vendor"}; !reflect.DeepEqual(g, w) {
if g, w := memtagStaticLibs, []string{"libclang_rt.builtins.vendor", "note_memtag_heap_sync.vendor"}; !reflect.DeepEqual(g, w) {
t.Errorf("wanted memtag_binary AndroidMkStaticLibs %q, got %q", w, g)
}
}