By default, rust uses the `legacy` mangling format. Using llvm coverage
switches it to using the new `v0` format. Rather than pushing the llvm
coverage back to `legacy` format, move Android forwards to `v0`. This
also has the added benefit that Rust symbols can be detected in the
codebase by looking for a leading "_R", aiding in demangler selection.
Test: builds, resulting object files have leading _R rather than _Z
Test: atest keystore2_test
Bug: 178565008
Change-Id: I7fcd591535d08260686c62fbfa6f7b61b31ed989
This allows tombstones to be symbolized and is consistent with C/C++
where we pass -g.
Bug: 173723155
Change-Id: I597e2bf97517407b428277f1cf7aa19b73371efa
In 1.47.0, std::env requires the STD_ENV_ARCH environment variable to be
set to the target architecture [1].
[1] 8e8939b804/library/std/src/env.rs (L866)
Bug: 171280890
Test: cd external/rust; mm
Change-Id: If4ddf4b9bad2a1a7518a358a5fb597170a97c67e
Rust is not passing the sysroot flag to Clang when invoking it as the
linker. This means files from the host may leak in, and host targets
may fail if sysroot files are not available from the host.
This patch prepends the lld flags from cc into rust linkargs. This
pulls in the sysroots flag, and also ensures that we remain in sync
with linkage flags used in cc.
The '-Wl,--no-undefined-version' from cc is overridden to avoid
missing version assignment errors for rust's generated alloc
functions.
Bug: 167690054
Test: cd external/rust; mma
Test: strace -f -e %file <host libstd.dylib.so build command> pulls
from correct sysroots.
Change-Id: Ic40597f546f3b112012155614056afed487c6ca1
This behavior is non-hermetic, but matches the behavior of the C++
support. On Linux, using lld works, but on OSX, this fails because lld
does not support Apple's new .tbd files.
Bug: 155302034
Test: On both Linux and Mac hosts:
cd external/rust; mma
Change-Id: I0ad489113d720bdb9c3b7a67cce9d1e72266f428
Add documentation on how lints are defined and used in Android. Merge
the deny_warnings attribute with a new attribute (no_lint) which can be
used to disable the default linting parameters.
Explicitly allow all lints for external/ and prebuilts/, which remove
any warning when building sysroot for the devices.
Test: cd external/rust/crates; mma
Test: add dummy internal Rust module; mma
Change-Id: I62be1c41aeda4068fb9e288038727c1de5ffe547
Rust has no backwards compatibility concerns, so no need to use
--use-android-relr-tags here.
Bug: http://b/147452927
Test: treehugger
Change-Id: I94de40bfad1ff2dcbc4241b944db90e0891bf9f3
This is no longer shipped by rustc, and wasn't really intended to be
implicitly available in the first place.
Bug: 147432625
Test: Built a sample rust device binary
Change-Id: I3c33ac3726c788debe14ed39a9ecbae7a7449351
* Edition and Deny_warnings should not be set when
constructing a BaseCompilerProperties, or the
initialized values will reject values inherited from rust_defaults.
* Use getEdition and getDenyWarnings to retrieve those properties
with defaults from config.
Bug: 141699953
Test: mm in rust projects
Change-Id: Id1ae357caeaf656cd33732bf4e54920e206f4ead
We need to pass --remap-path-prefix to Rust builds to ensure that they
are reproducible across different paths. This adds that for both host
and device builds.
Test: Verify host and device builds are reproducible with different
directories.
Change-Id: I68ba31537b2332fd05613aa0fb00a1502d78e410
* "-D warnings" means "deny all warnings" and make them errors.
* Modules with warnings should fix all warnings or use
deny_warnings: false
Bug: 141699953
Test: mm in projects with Rust modules
Change-Id: I6310dee8e34b7780937e8fc1834016a04a943a2f
Add libtest to our list of stdlib libraries, and remove some others that
are only used when generating proc_macros (which aren't dynamic).
Bug: 141207434
Test: m -j crosvm.experimental
Change-Id: I39cb030940adf1993e861d0142378eeea8b1ff5e
Adds support to Soong for building rust modules. This currently only
supports x86_64 device and x86 linux host targets. The functionality
is sufficient to build crosvm.
Bug: 136189233
Test: Test module builds.
Test: crosvm builds.
Change-Id: I6ea04615834a6d673578ab10ea1a2eb04259fe09