diff options
Diffstat (limited to 'rust/compiler.go')
| -rw-r--r-- | rust/compiler.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/rust/compiler.go b/rust/compiler.go index c92182420..c26f208ee 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 @@ -228,6 +232,10 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag flags.LinkFlags = append(flags.LinkFlags, "-Wl,-rpath,"+rpathPrefix+"../"+rpath) } + if ctx.RustModule().UseVndk() { + flags.RustFlags = append(flags.RustFlags, "--cfg 'android_vndk'") + } + return flags } @@ -250,7 +258,7 @@ func (compiler *baseCompiler) compilerDeps(ctx DepsContext, deps Deps) Deps { if !Bool(compiler.Properties.No_stdlibs) { for _, stdlib := range config.Stdlibs { // If we're building for the primary arch of the build host, use the compiler's stdlibs - if ctx.Target().Os == android.BuildOs && ctx.TargetPrimary() { + if ctx.Target().Os == android.BuildOs { stdlib = stdlib + "_" + ctx.toolchain().RustTriple() } |