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
This commit is contained in:
Ivan Lozano
2021-02-04 11:29:41 -05:00
parent 632f080f88
commit 3dfa12db6c
5 changed files with 46 additions and 14 deletions

View File

@@ -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