1package { 2 default_applicable_licenses: ["Android-Apache-2.0"], 3} 4 5// The hierarchy of Soong modules to produce a vmbase-based binary is 6// 7// 0. rlibs may be used to provide high-level code (see "vmbase_rlib_defaults"); 8// 1. rust_ffi_static packages low-level Rust code and any rlib into a static 9// library (see "vmbase_ffi_defaults") that cc_binary supports; 10// 2. cc_library_static may be used for extra C code (see "vmbase_cc_defaults"); 11// 3. cc_binary produces an ELF from the (single) Rust-wrapping static library, 12// optional extra C libraries, and linker script (see "vmbase_elf_defaults"); 13// 4. raw_binary strips the ELF into an image that can be loaded to memory; 14 15// Used by intermediate rust_library_rlib for vmbase-based binaries. 16rust_defaults { 17 name: "vmbase_rlib_defaults", 18 defaults: ["avf_build_flags_rust"], 19 edition: "2021", 20 prefer_rlib: true, 21 host_supported: false, 22 enabled: false, 23 no_stdlibs: true, 24 stdlibs: [ 25 "libcompiler_builtins.rust_sysroot", 26 "libcore.rust_sysroot", 27 ], 28 target: { 29 android_arm64: { 30 enabled: true, 31 }, 32 }, 33} 34 35// Used by the "top-level" rust_ffi_static of vmbase-based binaries. 36rust_defaults { 37 name: "vmbase_ffi_defaults", 38 defaults: ["vmbase_rlib_defaults"], 39} 40 41// Used by extra cc_library_static linked into the final ELF. 42cc_defaults { 43 name: "vmbase_cc_defaults", 44 defaults: ["avf_build_flags_cc"], 45 nocrt: true, 46 no_libcrt: true, 47 system_shared_libs: [], 48 stl: "none", 49 installable: false, 50 enabled: false, 51 target: { 52 android_arm64: { 53 enabled: true, 54 }, 55 }, 56 sanitize: { 57 hwaddress: false, 58 }, 59 native_coverage: false, 60 // TODO(b/346974429): Workaround pvmfw failure when enabling full LTO 61 lto_O0: true, 62} 63 64// Used by cc_binary when producing the ELF of a vmbase-based binary. 65cc_defaults { 66 name: "vmbase_elf_defaults", 67 defaults: ["vmbase_cc_defaults"], 68 static_executable: true, 69 static_libs: [ 70 "libvmbase_entry", 71 ], 72} 73 74rust_library_rlib { 75 name: "libvmbase", 76 defaults: ["vmbase_rlib_defaults"], 77 crate_name: "vmbase", 78 srcs: ["src/lib.rs"], 79 rustlibs: [ 80 "libaarch64_paging", 81 "libbuddy_system_allocator", 82 "libcfg_if", 83 "libcstr", 84 "libhypervisor_backends", 85 "liblibfdt_nostd", 86 "liblog_rust_nostd", 87 "libonce_cell_nostd", 88 "libsmccc", 89 "libspin_nostd", 90 "libstatic_assertions", 91 "libtinyvec_nostd", 92 "libuuid_nostd", 93 "libvirtio_drivers", 94 "libzerocopy_nostd", 95 "libzeroize_nostd", 96 ], 97 whole_static_libs: [ 98 "librust_baremetal", 99 ], 100 // TODO(b/277859415, b/277860860): Drop "compat_android_13". 101 features: [ 102 "compat_android_13", 103 "cpu_feat_hafdbs", 104 ], 105} 106 107cc_library_static { 108 name: "libvmbase_entry", 109 defaults: ["vmbase_cc_defaults"], 110 srcs: [ 111 "entry.S", 112 "exceptions.S", 113 "exceptions_panic.S", 114 ], 115} 116 117filegroup { 118 name: "vmbase_sections", 119 srcs: ["sections.ld"], 120} 121