Commit graph

4 commits

Author SHA1 Message Date
Ivan Lozano
2b0811310e rust: Add libstd linkage mutator for rlibs.
The current state of linkage is that device targets always link
libstd dynamically except for rust_ffi_static which requires a static
libstd linkage. However this prevents producing rust_ffi_static
modules which depend on other Rust libraries as those dependencies
will link libstd dynamically and cause a collision. We also want our
rust_test modules to statically link in libstd as well.

This adds a linkage mutator for rlibs that creates a variant for each
libstd linkage. Dependent modules can then select the variant that
matches their linkage of libstd.

Also fixes an issue where installation paths were being generated for
rlibs and static libs even though they weren't being installed. This broke
when adding the linkage mutator as Make would complain about multiple
targets producing the same output.

Bug: 168729404
Test: rust_ffi_static module with other rustlib dependency can be built.
Change-Id: I955b484bf5809e8fc5517750c7f8df82d3ca8895
2020-09-18 16:35:14 -04:00
Joel Galenson
6945e9b650 Migrate away from removed option
Upstream removed the -Z no-landing-pads option in
https://github.com/rust-lang/rust/pull/70175, which we picked up in
our latest toolchain update.

Fixes: 166317885
Test: Build and TreeHugger
Change-Id: I51c0ef671bf6a334b2b7223da42cab547e4407d3
2020-08-25 15:27:15 -07:00
Matthew Maurer
2ae0513a8e rust: Change default variants
rust_library now produces only rlib and dylib variants.
rust_library_foreign now produces static and shared variants.

This change was made because both are common cases, but all four
together essentially never happens. This allows us to have fewer repeat
module definitions.

Bug: 143217452
Test: cd external/rust; mma
Change-Id: Iaf69e8da38f7c12710331c51464699cf7cbbb656
2020-07-01 11:27:12 -07:00
Ivan Lozano
a0cd8f9acb Add gcov coverage support to Rust modules.
This adds gcov coverage support for Rust device library and binary
modules (including test modules). Support is provided to pass Rust
static library gcno files to CC modules and visa versa.

Additional changes:
 * Begin mutator added for Rust modules.
 * SuffixInList added to android package.
 * CoverageEnabled added to Coverage interface.
 * CoverageFiles added to LinkableLibrary interface.
 * Fix in coverage mutator for non-CC modules which marked the wrong
   variant as the coverage variant.
 * Added coverage libraries to the cc.GatherRequiredDepsForTest.

Bug: 146448203
Test: NATIVE_COVERAGE=true COVERAGE_PATHS='*' m -j <rust_module>
Change-Id: If20728bdde42a1dd544a35a40f0d981b80a5835f
2020-05-05 10:30:15 -04:00