diff options
author | Ivan Lozano <ivanlozano@google.com> | 2020-12-08 14:43:00 -0500 |
---|---|---|
committer | Ivan Lozano <ivanlozano@google.com> | 2020-12-09 09:55:12 -0500 |
commit | ea08613dd35bf8ae9f41e61e6c80a8fe255ce155 (patch) | |
tree | 5abd2eea941cf451a44a9926aa4d7f92848d9201 /rust/binary.go | |
parent | 110d13bef3bd302a22facf16677a9ee893a0486c (diff) |
Move prefer_rlib from binary to base compiler.
Moves the prefer_rlib property out from being exclusively a binary
property to one thats part of the base compiler properties. This
provides a little more control over the libstd linkage in our libraries.
Specifically, this enables a usecase where rust_ffi_shared needs to link
against libstd statically rather than dynamically.
Bug: 175121262
Test: New Soong tests pass.
Change-Id: If68014c684a75ba70e9d7dacbb01c7d360dc25a1
Diffstat (limited to 'rust/binary.go')
-rw-r--r-- | rust/binary.go | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/rust/binary.go b/rust/binary.go index af39d383d..c2d97f3ab 100644 --- a/rust/binary.go +++ b/rust/binary.go @@ -24,11 +24,6 @@ func init() { } type BinaryCompilerProperties struct { - // Change the rustlibs linkage to select rlib linkage by default for device targets. - // Also link libstd as an rlib as well on device targets. - // Note: This is the default behavior for host targets. - Prefer_rlib *bool `android:"arch_variant"` - // Builds this binary as a static binary. Implies prefer_rlib true. // // Static executables currently only support for bionic targets. Non-bionic targets will not produce a fully static @@ -115,7 +110,7 @@ func (binary *binaryDecorator) nativeCoverage() bool { } func (binary *binaryDecorator) preferRlib() bool { - return Bool(binary.Properties.Prefer_rlib) || Bool(binary.Properties.Static_executable) + return Bool(binary.baseCompiler.Properties.Prefer_rlib) || Bool(binary.Properties.Static_executable) } func (binary *binaryDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) android.Path { @@ -156,8 +151,7 @@ func (binary *binaryDecorator) autoDep(ctx BaseModuleContext) autoDep { // Binaries default to dylib dependencies for device, rlib for host. if binary.preferRlib() { return rlibAutoDep - } - if ctx.Device() { + } else if ctx.Device() { return dylibAutoDep } else { return rlibAutoDep |