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

@@ -439,6 +439,7 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa
}
flags.RustFlags = append(flags.RustFlags, deps.depFlags...)
flags.LinkFlags = append(flags.LinkFlags, deps.depLinkFlags...)
flags.LinkFlags = append(flags.LinkFlags, deps.linkObjects...)
if library.dylib() {
@@ -478,7 +479,6 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa
if library.rlib() || library.dylib() {
library.flagExporter.exportLinkDirs(deps.linkDirs...)
library.flagExporter.exportDepFlags(deps.depFlags...)
library.flagExporter.exportLinkObjects(deps.linkObjects...)
}