Rust cdylib/statliclib support for vendor snapshot.
Adds support for platform vendor_available Rust FFI libraries and binaries to be included in the vendor snapshot. Because rlib and dylibs are not yet in snapshots, libstd cannot be included in a vendor snapshot. As a result, vendor-specific Rust code can't be guaranteed to work with the platform-provided vendor_available modules built with a newer toolchain. For now, a check is added indicating vendor-specific Rust code is unsupported. This changes the linkage for vendor variants of these modules to default to rlib linkage since dylibs cannot be included in the snapshot yet. Bug: 184042776 Test: m nothing # new Soong tests pass Change-Id: I502eaa4bb962eb87ff868fcf49b435f0d2f982e6
This commit is contained in:
@@ -137,6 +137,9 @@ func (binary *binaryDecorator) autoDep(ctx android.BottomUpMutatorContext) autoD
|
||||
// Binaries default to dylib dependencies for device, rlib for host.
|
||||
if binary.preferRlib() {
|
||||
return rlibAutoDep
|
||||
} else if mod, ok := ctx.Module().(*Module); ok && mod.InVendor() {
|
||||
// Vendor Rust binaries should prefer rlibs.
|
||||
return rlibAutoDep
|
||||
} else if ctx.Device() {
|
||||
return dylibAutoDep
|
||||
} else {
|
||||
@@ -147,6 +150,8 @@ func (binary *binaryDecorator) autoDep(ctx android.BottomUpMutatorContext) autoD
|
||||
func (binary *binaryDecorator) stdLinkage(ctx *depsContext) RustLinkage {
|
||||
if binary.preferRlib() {
|
||||
return RlibLinkage
|
||||
} else if ctx.RustModule().InVendor() {
|
||||
return RlibLinkage
|
||||
}
|
||||
return binary.baseCompiler.stdLinkage(ctx)
|
||||
}
|
||||
|
Reference in New Issue
Block a user