| package { |
| default_applicable_licenses: ["Android-Apache-2.0"], |
| } |
| |
| // The hierarchy of Soong modules to produce a vmbase-based binary is |
| // |
| // 0. rlibs may be used to provide high-level code (see "vmbase_rlib_defaults"); |
| // 1. rust_ffi_static packages low-level Rust code and any rlib into a static |
| // library (see "vmbase_ffi_defaults") that cc_binary supports; |
| // 2. cc_library_static may be used for extra C code (see "vmbase_cc_defaults"); |
| // 3. cc_binary produces an ELF from the (single) Rust-wrapping static library, |
| // optional extra C libraries, and linker script (see "vmbase_elf_defaults"); |
| // 4. raw_binary strips the ELF into an image that can be loaded to memory; |
| |
| // Used by intermediate rust_library_rlib for vmbase-based binaries. |
| rust_defaults { |
| name: "vmbase_rlib_defaults", |
| defaults: ["avf_build_flags_rust"], |
| edition: "2021", |
| prefer_rlib: true, |
| host_supported: false, |
| enabled: false, |
| no_stdlibs: true, |
| stdlibs: [ |
| "libcompiler_builtins.rust_sysroot", |
| "libcore.rust_sysroot", |
| ], |
| target: { |
| android_arm64: { |
| enabled: true, |
| }, |
| }, |
| } |
| |
| // Used by the "top-level" rust_ffi_static of vmbase-based binaries. |
| rust_defaults { |
| name: "vmbase_ffi_defaults", |
| defaults: ["vmbase_rlib_defaults"], |
| } |
| |
| // Used by extra cc_library_static linked into the final ELF. |
| cc_defaults { |
| name: "vmbase_cc_defaults", |
| defaults: ["avf_build_flags_cc"], |
| nocrt: true, |
| no_libcrt: true, |
| system_shared_libs: [], |
| stl: "none", |
| installable: false, |
| enabled: false, |
| target: { |
| android_arm64: { |
| enabled: true, |
| }, |
| }, |
| sanitize: { |
| hwaddress: false, |
| }, |
| native_coverage: false, |
| // TODO(b/346974429): Workaround pvmfw failure when enabling full LTO |
| lto_O0: true, |
| } |
| |
| // Used by cc_binary when producing the ELF of a vmbase-based binary. |
| cc_defaults { |
| name: "vmbase_elf_defaults", |
| defaults: ["vmbase_cc_defaults"], |
| static_executable: true, |
| static_libs: [ |
| "libvmbase_entry", |
| ], |
| } |
| |
| rust_library_rlib { |
| name: "libvmbase", |
| defaults: ["vmbase_rlib_defaults"], |
| crate_name: "vmbase", |
| srcs: ["src/lib.rs"], |
| rustlibs: [ |
| "libaarch64_paging", |
| "libbuddy_system_allocator", |
| "libcstr", |
| "libfdtpci", |
| "liblibfdt", |
| "liblog_rust_nostd", |
| "libonce_cell_nostd", |
| "libsmccc", |
| "libspin_nostd", |
| "libstatic_assertions", |
| "libtinyvec_nostd", |
| "libuuid_nostd", |
| "libvirtio_drivers", |
| "libzerocopy_nostd", |
| "libzeroize_nostd", |
| ], |
| whole_static_libs: [ |
| "librust_baremetal", |
| ], |
| // TODO(b/277859415, b/277860860): Drop "compat_android_13". |
| features: [ |
| "compat_android_13", |
| "cpu_feat_hafdbs", |
| ], |
| } |
| |
| cc_library_static { |
| name: "libvmbase_entry", |
| defaults: ["vmbase_cc_defaults"], |
| srcs: [ |
| "entry.S", |
| "exceptions.S", |
| "exceptions_panic.S", |
| ], |
| } |
| |
| filegroup { |
| name: "vmbase_sections", |
| srcs: ["sections.ld"], |
| } |