summaryrefslogtreecommitdiff
path: root/rust/snapshot_utils.go
diff options
context:
space:
mode:
author Ivan Lozano <ivanlozano@google.com> 2021-06-01 15:09:53 -0400
committer Ivan Lozano <ivanlozano@google.com> 2021-06-03 08:36:09 -0400
commit3149e6ed1882786fc9e1defd0b5540c0147a0209 (patch)
treeedee79e9487fdbc90116eb3d71f9f867746ac28a /rust/snapshot_utils.go
parentd1dec54988630cabaf15b2353e55460f79c05b0c (diff)
Rust rlib vendor snapshot support.
Adds support for snapshotting Rust rlibs. This allows us vendor-specific code that uses rlib-only linkage until dylib snapshot support is added. Bug: 184042776 Test: m nothing # new Soong tests pass Test: Example test Rust vendor module builds Test: m dist vendor-snapshot # includes rlibs Change-Id: I4976d3e1efec0ee778cc97730d45be471dffb678
Diffstat (limited to 'rust/snapshot_utils.go')
-rw-r--r--rust/snapshot_utils.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/rust/snapshot_utils.go b/rust/snapshot_utils.go
index 9d5154ce2..bd7ca7f68 100644
--- a/rust/snapshot_utils.go
+++ b/rust/snapshot_utils.go
@@ -42,9 +42,8 @@ func (mod *Module) ExcludeFromRecoverySnapshot() bool {
func (mod *Module) IsSnapshotLibrary() bool {
if lib, ok := mod.compiler.(libraryInterface); ok {
- // Rust-native dylibs and rlibs are not snapshot supported yet, so only
- // return true if this module produces a C shared or static library.
- return lib.shared() || lib.static()
+ // 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 false
}