summaryrefslogtreecommitdiff
path: root/rust/compiler.go
diff options
context:
space:
mode:
authorIvan Lozano <ivanlozano@google.com>2021-02-04 11:29:41 -0500
committerIvan Lozano <ivanlozano@google.com>2021-02-04 16:29:02 -0500
commit3dfa12db6c643672b1c41e577c95ef527ebdb0af (patch)
treedf5033090649a20666d70c7cfc51d0b8df01b889 /rust/compiler.go
parent632f080f8830e2ded22d2e65fdf69cbbe6df40d8 (diff)
rust: Pass cc static libs to rustc.
Pass static libraries to rustc via the "-lstatic" flag so that rustc can reason how to handle these libraries. This means that these static libraries get bundled into rlibs, reducing the need to redeclare these dependencies in dependent modules. Additionally, exported depFlags were never used anywhere, so remove this from flagExporter. Bug: 175886967 Bug: 179122837 Test: m Test: Checked that static symbols aren't duplicated in a resulting binary when it appears in a dependency graph more than once. Change-Id: Ifeb3c384e4fad8704206997242a0156ddcb87d2c
Diffstat (limited to 'rust/compiler.go')
-rw-r--r--rust/compiler.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/rust/compiler.go b/rust/compiler.go
index c92182420..586063e91 100644
--- a/rust/compiler.go
+++ b/rust/compiler.go
@@ -96,7 +96,11 @@ type BaseCompilerProperties struct {
// list of C shared library dependencies
Shared_libs []string `android:"arch_variant"`
- // list of C static library dependencies
+ // list of C static library dependencies. Note, static libraries prefixed by "lib" will be passed to rustc
+ // along with "-lstatic=<name>". This will bundle the static library into rlib/static libraries so dependents do
+ // not need to also declare the static library as a dependency. Static libraries which are not prefixed by "lib"
+ // cannot be passed to rustc with this flag and will not be bundled into rlib/static libraries, and thus must
+ // be redeclared in dependents.
Static_libs []string `android:"arch_variant"`
// crate name, required for modules which produce Rust libraries: rust_library, rust_ffi and SourceProvider