Loading rust/rust.go +11 −8 Original line number Diff line number Diff line Loading @@ -896,6 +896,8 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps { exportDep := false switch { case cc.IsStaticDepTag(depTag): // Only pass -lstatic for rlibs as it results in dylib bloat. if lib, ok := ctx.Module().(*Module).compiler.(libraryInterface); ok && lib.rlib() { // Link cc static libraries using "-lstatic" so rustc can reason about how to handle these // (for example, bundling them into rlibs). // Loading @@ -905,6 +907,7 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps { if libName, ok := libNameFromFilePath(linkObject.Path()); ok { depPaths.depFlags = append(depPaths.depFlags, "-lstatic="+libName) } } // Add this to linkObjects to pass the library directly to the linker as well. This propagates // to dependencies to avoid having to redeclare static libraries for dependents of the dylib variant. Loading rust/rust_test.go +2 −1 Original line number Diff line number Diff line Loading @@ -213,6 +213,7 @@ func TestDepsTracking(t *testing.T) { name: "librlib", srcs: ["foo.rs"], crate_name: "rlib", static_libs: ["libstatic"], } rust_proc_macro { name: "libpm", Loading @@ -230,7 +231,7 @@ func TestDepsTracking(t *testing.T) { } `) module := ctx.ModuleForTests("fizz-buzz", "linux_glibc_x86_64").Module().(*Module) rustc := ctx.ModuleForTests("fizz-buzz", "linux_glibc_x86_64").Rule("rustc") rustc := ctx.ModuleForTests("librlib", "linux_glibc_x86_64_rlib_rlib-std").Rule("rustc") // Since dependencies are added to AndroidMk* properties, we can check these to see if they've been picked up. if !android.InList("libdylib", module.Properties.AndroidMkDylibs) { Loading Loading
rust/rust.go +11 −8 Original line number Diff line number Diff line Loading @@ -896,6 +896,8 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps { exportDep := false switch { case cc.IsStaticDepTag(depTag): // Only pass -lstatic for rlibs as it results in dylib bloat. if lib, ok := ctx.Module().(*Module).compiler.(libraryInterface); ok && lib.rlib() { // Link cc static libraries using "-lstatic" so rustc can reason about how to handle these // (for example, bundling them into rlibs). // Loading @@ -905,6 +907,7 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps { if libName, ok := libNameFromFilePath(linkObject.Path()); ok { depPaths.depFlags = append(depPaths.depFlags, "-lstatic="+libName) } } // Add this to linkObjects to pass the library directly to the linker as well. This propagates // to dependencies to avoid having to redeclare static libraries for dependents of the dylib variant. Loading
rust/rust_test.go +2 −1 Original line number Diff line number Diff line Loading @@ -213,6 +213,7 @@ func TestDepsTracking(t *testing.T) { name: "librlib", srcs: ["foo.rs"], crate_name: "rlib", static_libs: ["libstatic"], } rust_proc_macro { name: "libpm", Loading @@ -230,7 +231,7 @@ func TestDepsTracking(t *testing.T) { } `) module := ctx.ModuleForTests("fizz-buzz", "linux_glibc_x86_64").Module().(*Module) rustc := ctx.ModuleForTests("fizz-buzz", "linux_glibc_x86_64").Rule("rustc") rustc := ctx.ModuleForTests("librlib", "linux_glibc_x86_64_rlib_rlib-std").Rule("rustc") // Since dependencies are added to AndroidMk* properties, we can check these to see if they've been picked up. if !android.InList("libdylib", module.Properties.AndroidMkDylibs) { Loading