summaryrefslogtreecommitdiff
path: root/rust/compiler.go
diff options
context:
space:
mode:
author Andrew Walbran <qwandor@google.com> 2022-03-07 15:41:53 +0000
committer Andrew Walbran <qwandor@google.com> 2022-03-07 15:42:34 +0000
commit797e4be221578593037ae4ac70f20d4e3c9a3eb1 (patch)
treeb9e0826982b344778cc8147ce3e2407789ef1040 /rust/compiler.go
parent7010c53c5057fdbc7b035b6768291eac7968fcb3 (diff)
Add stdlibs property for Rust build rules.
This lets no_std crates depend on system crates like core and alloc. Bug: 223152204 Test: built pVM firmware skeleton with rust_ffi_static rule Change-Id: I0f9b0ab3f5e3289fb8ce66f28d779bcf62a7181f
Diffstat (limited to 'rust/compiler.go')
-rw-r--r--rust/compiler.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/rust/compiler.go b/rust/compiler.go
index c5d40f4dc..19499fa36 100644
--- a/rust/compiler.go
+++ b/rust/compiler.go
@@ -121,6 +121,12 @@ type BaseCompilerProperties struct {
// include all of the static libraries symbols in any dylibs or binaries which use this rlib as well.
Whole_static_libs []string `android:"arch_variant"`
+ // list of Rust system library dependencies.
+ //
+ // This is usually only needed when `no_stdlibs` is true, in which case it can be used to depend on system crates
+ // like `core` and `alloc`.
+ Stdlibs []string `android:"arch_variant"`
+
// crate name, required for modules which produce Rust libraries: rust_library, rust_ffi and SourceProvider
// modules which create library variants (rust_bindgen). This must be the expected extern crate name used in
// source, and is required to conform to an enforced format matching library output files (if the output file is
@@ -360,6 +366,7 @@ func (compiler *baseCompiler) compilerDeps(ctx DepsContext, deps Deps) Deps {
deps.StaticLibs = append(deps.StaticLibs, compiler.Properties.Static_libs...)
deps.WholeStaticLibs = append(deps.WholeStaticLibs, compiler.Properties.Whole_static_libs...)
deps.SharedLibs = append(deps.SharedLibs, compiler.Properties.Shared_libs...)
+ deps.Stdlibs = append(deps.Stdlibs, compiler.Properties.Stdlibs...)
if !Bool(compiler.Properties.No_stdlibs) {
for _, stdlib := range config.Stdlibs {