rust: Add vendor and recovery dylib support.

Adds dylib support for vendor and recovery images.

This changes the default linkage for vendor and recovery images to
dylib, which matches the platform default linkage. This also means that
by default, dylib-std variants are used for rlib dependencies.

Bug: 204303985
Test: Soong tests.
Test: m dist vendor-snapshot
Test: RECOVERY_SNAPSHOT_VERSION=current m dist recovery-snapshot
Change-Id: If84074b8615a70c45e7e162abeb853dc8c34d49a
This commit is contained in:
Ivan Lozano
2023-07-13 11:01:41 -04:00
parent e3c11d0aad
commit add122a828
14 changed files with 378 additions and 147 deletions

View File

@@ -42,8 +42,7 @@ func (mod *Module) ExcludeFromRecoverySnapshot() bool {
func (mod *Module) IsSnapshotLibrary() bool {
if lib, ok := mod.compiler.(libraryInterface); ok {
// Rust-native dylibs are not snapshot supported yet. Only snapshot the rlib-std variants of rlibs.
return lib.shared() || lib.static() || (lib.rlib() && lib.rlibStd())
return lib.shared() || lib.static() || lib.rlib() || lib.dylib()
}
return false
}
@@ -61,6 +60,14 @@ func (mod *Module) SnapshotStaticLibs() []string {
return mod.Properties.SnapshotStaticLibs
}
func (mod *Module) SnapshotRlibs() []string {
return mod.Properties.SnapshotRlibs
}
func (mod *Module) SnapshotDylibs() []string {
return mod.Properties.SnapshotDylibs
}
func (mod *Module) Symlinks() []string {
// TODO update this to return the list of symlinks when Rust supports defining symlinks
return nil