diff options
Diffstat (limited to 'rust/binary.go')
-rw-r--r-- | rust/binary.go | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/rust/binary.go b/rust/binary.go index 9fc52cdb8..d287a06ef 100644 --- a/rust/binary.go +++ b/rust/binary.go @@ -24,9 +24,6 @@ func init() { } type BinaryCompilerProperties struct { - // passes -C prefer-dynamic to rustc, which tells it to dynamically link the stdlib - // (assuming it has no dylib dependencies already) - Prefer_dynamic *bool } type binaryDecorator struct { @@ -60,10 +57,6 @@ func NewRustBinary(hod android.HostOrDeviceSupported) (*Module, *binaryDecorator return module, binary } -func (binary *binaryDecorator) preferDynamic() bool { - return Bool(binary.Properties.Prefer_dynamic) -} - func (binary *binaryDecorator) compilerFlags(ctx ModuleContext, flags Flags) Flags { flags = binary.baseCompiler.compilerFlags(ctx, flags) @@ -76,9 +69,6 @@ func (binary *binaryDecorator) compilerFlags(ctx ModuleContext, flags Flags) Fla "-Wl,--no-undefined-version") } - if binary.preferDynamic() { - flags.RustFlags = append(flags.RustFlags, "-C prefer-dynamic") - } return flags } @@ -86,7 +76,7 @@ func (binary *binaryDecorator) compilerDeps(ctx DepsContext, deps Deps) Deps { deps = binary.baseCompiler.compilerDeps(ctx, deps) if ctx.toolchain().Bionic() { - deps = binary.baseCompiler.bionicDeps(ctx, deps) + deps = bionicDeps(deps) deps.CrtBegin = "crtbegin_dynamic" deps.CrtEnd = "crtend_android" } @@ -106,13 +96,13 @@ func (binary *binaryDecorator) nativeCoverage() bool { func (binary *binaryDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) android.Path { fileName := binary.getStem(ctx) + ctx.toolchain().ExecutableSuffix() - srcPath, paths := srcPathFromModuleSrcs(ctx, binary.baseCompiler.Properties.Srcs) - deps.SrcDeps = paths + srcPath, _ := srcPathFromModuleSrcs(ctx, binary.baseCompiler.Properties.Srcs) outputFile := android.PathForModuleOut(ctx, fileName) binary.unstrippedOutputFile = outputFile flags.RustFlags = append(flags.RustFlags, deps.depFlags...) + flags.LinkFlags = append(flags.LinkFlags, deps.linkObjects...) outputs := TransformSrcToBinary(ctx, srcPath, deps, flags, outputFile, deps.linkDirs) binary.coverageFile = outputs.coverageFile @@ -133,8 +123,9 @@ func (binary *binaryDecorator) coverageOutputZipPath() android.OptionalPath { return binary.coverageOutputZipFile } -func (binary *binaryDecorator) autoDep() autoDep { - if binary.preferDynamic() { +func (binary *binaryDecorator) autoDep(ctx BaseModuleContext) autoDep { + // Binaries default to dylib dependencies for device, rlib for host. + if ctx.Device() { return dylibAutoDep } else { return rlibAutoDep |