Commit graph

990 commits

Author SHA1 Message Date
Charisee
30332aee9b rustc-1.62.0 Build 8809119
Test: m rust
Change-Id: I6daa0f00428dc46bfb5cc1ca1ae8818fd233d708
2022-07-11 19:02:33 +00:00
Colin Cross
a8941ec69f Don't use prebuilt rust stdlibs for linux bionic
Linux bionic doesn't have rust stdlib prebuilts, don't use the prebuilts
when it is configured as the host os.

Bug: 216192129
Test: builds
Change-Id: I03425dee4b2e3659bf90c0a0c808cc286daa4b7f
2022-07-01 18:30:17 +00:00
Colin Cross
567d342ed8 Use musl rust prebuilts for USE_HOST_MUSL=true
Building rust code with musl enabled can load proc macro crates built
against musl into rustc, so we have to use a version of rustc also
built against musl.

Bug: 216192129
Test: m USE_HOST_MUSL=true host-native
Change-Id: Icd23b542a4b64a975850a8a4bb4b69183cc6c2c6
2022-07-01 02:58:14 +00:00
Colin Cross
1faf82305a Add rust musl arm and arm64 toolchains
Add rust toolchain configurations for arm-linux-musleabihf and
aarch64-linux-musl.

Bug: 236052820
Test: builds with linux musl arm64 host cross configured
Change-Id: Icfa73a75eac710e955f71a073cb4b7bb1cdfcc7a
2022-06-28 15:16:15 -07:00
Ivan Lozano
7f67c2a665 rust: Allow rust_ffi_shared in jni_libs
Allow listing rust_ffi_shared modules as a jni_libs dependency
in conjunction with platform_api: true. This allows inclusion by
android_app modules.

Bug: 237304791
Test: android_app module builds with a rust_ffi_shared dependency.
Change-Id: I3a28e1baa522ad8f9c2aa86f1d23b19ce9f967e1
2022-06-27 16:00:26 -04:00
Lukacs T. Berki
6c71676d6c Migrate sanitizers to transition mutators.
The logic is not 100% provably the same since HEAD was quite
confusing at some points, but I did make an effort to preserve
functional equivalence.

In case that effort was not enough, it should be pretty easy to
tweak the logic at HEAD since it's still quite malleable.

Bug: 231370928
Test: Presubmits.
Change-Id: I17b2efbfb5c4d0aedd922caed54ff8d857e578df
2022-06-18 06:20:28 +02:00
Chris Wailes
0a02aba00e rustc-1.61.0.p2 Build 8709792
Bug: https://issuetracker.google.com/issues/232437287
Bug: https://issuetracker.google.com/issues/216192129
Test: m rust
Change-Id: I84d4b9e70a53c0f057a286b77eb7dea6161c03a8
2022-06-13 12:05:33 -07:00
Treehugger Robot
fdc0540751 Merge "[rust/coverage] Use new flag for coverage instrumentation" 2022-06-07 23:44:02 +00:00
Pirama Arumuga Nainar
f1f6dd17d1 [rust/coverage] Use new flag for coverage instrumentation
> warning: `-Z instrument-coverage` is deprecated; use `-C
instrument-coverage`

Test: above warning is absent when running:
    $ m CLANG_COVERAGE=true NATIVE_COVERAGE_PATHS=* rust
Change-Id: I8687c04534db3c8a67f209b93ed13d54c2f86dc8
2022-06-07 11:15:59 -07:00
Charisee
2f46ea40d1 rustc-1.61.0.p1 Build 8688465
Test: m rust
Change-Id: Ic565f8d0aca4081d2afa5b6ee64ed9c3f1d30a3d
2022-06-07 01:04:42 +00:00
Charisee Chiw
2313b0c798 Merge "rustc-1.61.0 Build 8644170" 2022-06-02 15:32:37 +00:00
Charisee
65c99a27ac rustc-1.61.0 Build 8644170
Test: m rust
Bug: 232437287
Change-Id: I93add84ae6adaa8da4a68ce2608a561cbb08828a
2022-05-29 22:06:22 +00:00
Hasini Gunasinghe
783e76c738 Merge "Add system/core/trusty/keymint-rust to allow list" 2022-05-27 17:57:51 +00:00
Hasini Gunasinghe
07851ffae4 Add system/core/trusty/keymint-rust to allow list
Bug: 225036046
Test: N/A
Change-Id: I2177960dc40c79a07d3acbc798b5235a26cfa72d
2022-05-26 22:58:10 +00:00
David Drysdale
21252b460a Add new system/keymint Rust directory
Bug: 195310053
Test: build, TreeHugger
Change-Id: I5bb3c000324fb8150bdd00ec8b8ca9ed79ceba06
2022-05-25 13:57:13 +01:00
Treehugger Robot
5bec8d41ea Merge "Clean up some bp2build technical debt" 2022-05-23 18:01:04 +00:00
Lukacs T. Berki
2da6c3cc86 Keep a "sanitizer dependency" flag for each sanitizer.
This is so that we can avoid mutating state in sanitizerMutator, as
would be necessary if we only had a single bit for every sanitizer
together.

Test: Presubmits.
Change-Id: I5576367c12972fbea64342ab123118ec5a2cfeec
2022-05-19 09:48:57 +02:00
Liz Kammer
3bf97bd1c0 Clean up some bp2build technical debt
Previously we ran mutators in bp2build mode to add dependencies, now we
look up modules by name directly. Remove workarounds to allow bp2build
mode to not fail when adding/handling dependencies.

Test: m bp2build
Change-Id: Ibf6fd905150cac306e5c395902ef28f609f4df2a
2022-05-13 19:47:48 -04:00
Treehugger Robot
dd58c3fe2b Merge "Add cross-referencing support for Rust" 2022-05-03 19:10:17 +00:00
Treehugger Robot
5b70a8d677 Merge "Update clang version to clang-r450784d" 2022-05-02 18:33:32 +00:00
Yi Kong
4f6c92765d Update clang version to clang-r450784d
Test: presubmit
Bug: 219872355
Change-Id: If6c2c331044a363cb8f20a2516da894e72c4b7e7
2022-05-02 23:52:44 +08:00
Martin Geisler
507f9b26d5 Merge "Tell rustc to always use color output" 2022-05-02 13:00:40 +00:00
Matthew Maurer
e91f9d439e Merge "Allow BoringSSL's Rust bindings to build" 2022-04-29 17:40:24 +00:00
Martin Geisler
d352e3b788 Tell rustc to always use color output
By default, rustc will disable color output when it detects that its
stdin isn’t connected to a terminal. However, since we will print the
output to the user’s terminal, it makes sense to override this.

Test: Manually by triggering a compilation error. I ran
  * m pdl
  * atest --host --no-bazel-mode pdl_inline_tests
  * atest pdl_inline_tests
  and got useful color output in my terminal in each case.
Change-Id: I8b593d2eb59d13db17a3456e3fb053556fc16f07
2022-04-29 15:21:15 +02:00
Jooyung Han
10bea7d44a Put rust_test.data_libs under lib[64]
Rust test binary depending on native libraries would require them under
lib[64] directory so that the test binary can open them with default
rpath values.

Bug: 204562227
Test: presubmit
Change-Id: I029bb32c4c98fba21bd28e579a9df9f184a7f045
2022-04-28 23:55:43 +00:00
Matthew Maurer
14f26aaa4e Allow BoringSSL's Rust bindings to build
Bug: 177080016
Test: mm in boringssl
Change-Id: I3cdf031ebf7c5bafce00c078107fd7fb3a26ba2d
2022-04-27 14:28:43 -07:00
Chris Wailes
c28bd05753 Update RustDefaultVersion to 1.60.0
Test: m rust
Change-Id: I5fb8a831b77cb715679c4653d22aba78c1e19db2
2022-04-22 15:42:18 -07:00
Sasha Smundak
a76acba553 Add cross-referencing support for Rust
Bug: 222044478
Test: run TARGET_BUILD_VARIANT=userdebug TARGET_PRODUCT=cf_x86_64_phone XREF_CORPUS=googleplex-android.googlesource.com/codesearch/android build/soong/build_kzip.bash
Change-Id: Ia12eed53fafd0cbbbf2cc499fa20a0f5a40031de
2022-04-20 20:02:28 -07:00
Ivan Lozano
3736abfa01 Merge "rust: Allow rustlibs to fallback to rlibs." 2022-04-18 18:53:58 +00:00
Ivan Lozano
5e7455996e Merge "rust: set ANDROID_RUST_VERSION based on prebuilts" 2022-04-13 12:56:27 +00:00
Ivan Lozano
f1868af5d5 rust: Don't append '.vendor' to vendor modules.
Rust vendor-only modules would have the '.vendor' subname appended to
them, which meant that 'm <vendor_module>' would not work -- instead
you would need to call 'm <vendor_module>.vendor', which leads to some
confusion.

This CL fixes the behavior by using the same SubName logic as the cc
module.

Bug: 205577906
Test: m <vendor_module> # works without .vendor suffix
Change-Id: I6ba18ce1d7281a1f8342ed6014644b48009d78e0
2022-04-12 13:42:04 -04:00
Ivan Lozano
2d407633ae rust: Allow rustlibs to fallback to rlibs.
Allow adding rlib-only libraries to rustlibs by having it fallback to
selecting the rlib variant if a dylib variant is requested but not
available.

Bug: 224771894
Test: m nothing
Test: New Soong test
Change-Id: I47b19ec9dbf3da90a2b090aeda04556a0400c7d1
2022-04-12 11:30:40 -04:00
Ivan Lozano
6d14ed157e rust: set ANDROID_RUST_VERSION based on prebuilts
ANDROID_RUST_VERSION is always set to the default Rust version, rather
than than respecting the RUST_PREBUILTS_VERSION setting. This is not the
correct behavior, this CL resolves the issue.

Test: m nothing
Change-Id: I3f8a2fc3590b7313286278b77534bb669cc693d6
2022-04-12 10:29:43 -04:00
Treehugger Robot
de0d46f5e0 Merge "Add libtrusty-rs to Rust allow list" 2022-04-05 20:54:18 +00:00
David LeGare
3eee5c4d14 Add libtrusty-rs to Rust allow list
Test: Local build
Bug: 226659377
Change-Id: I00798295b0fe1df4dd782361c368f08b991351ae
2022-03-31 16:59:15 +00:00
Andrew Walbran
838febf35e Allow Rust for tombstoned client.
Bug: 226162295
Test: m libtombstoned_client_rust
Change-Id: I0a8e1f8e1c08f47e75e62f008160da746ee2e7f5
2022-03-30 14:23:04 +00:00
Colin Cross
441898c285 Switch to libunwind to remove dependency on libgcc for musl
The libgcc dependency is only used for _Unwind* symbols, remove
it now that libc_musl.so embeds libunwind.a.

Bug: 215802826
Test: m USE_HOST_MUSL=true host-native
Change-Id: I1ad4c1435fc0090c6df2d50d542d2203dfb94d7b
2022-03-29 13:35:17 -07:00
Ivan Lozano
872d579a22 rust: rust_proc_macro host snapshot support.
Adds support for capturing rust_proc_macros as part of the host
snapshot. Proc macros target the host and can be thought of as compiler
plugins. Because of this, they don't have vendor image variants and
can't be easily captured as part of the vendor snapshot. Instead we
capture them as part of the host snapshot.

This adds a rust_prebuilt_proc_macro module type.

Bug: 204304380
Test: m HOST_FAKE_SNAPSHOT_ENABLE=true host-fake-snapshot dist
Test: python3 development/vendor_snapshot/update.py --image=host
  --install-dir=vendor/vendor_name/ 31 --local out/dist
Test: Checked Android.bp for rust_prebuilt_proc_macro modules.
Change-Id: I4a8c4d9c41b7ca361b5b97d3f74973918c2a5fe3
2022-03-25 09:25:07 -04:00
Pirama Arumuga Nainar
fac98b5c8e [rust] Add path for coverage tests to allowed list
Bug: http://b/214396112

The goal is to run this smoke test in presubmit on all platform changes.

Test: build with aosp/
Change-Id: I4abb7f46905bd4160a2d628be2761874df6b1b34
2022-03-08 23:08:33 -08:00
Treehugger Robot
86ac783d8e Merge changes from topic "vsdk_ramdisk"
* changes:
  Add InstallInRoot property to snapshot binary json file.
  Fix for duplicate modules across vendor and ramdisk snapshots.
2022-03-08 17:10:54 +00:00
Andrew Walbran
1e17a78c55 Merge "Add stdlibs property for Rust build rules." 2022-03-08 16:07:16 +00:00
Colin Cross
3c66771c62 Merge "Use single module for clang runtime libraries" 2022-03-08 06:51:43 +00:00
Colin Cross
4c4c1be915 Use single module for clang runtime libraries
The clang prebuilts now provide a single module with per-architecture
variants instead of a module per architecture.

Bug: 220019988
Test: m checkbuild
Change-Id: I39e2cf8ae14edf8510276dab38011afaef85822c
Merged-In: I39e2cf8ae14edf8510276dab38011afaef85822c
2022-03-07 14:56:32 -08:00
Jose Galmes
61741e20a5 Fix for duplicate modules across vendor and ramdisk snapshots.
Bug: 215295121
Test: Generated snapshots and verified there are no duplicates.
Change-Id: I6ba7deb4941e21d87578038de19ab313f2be539c
2022-03-07 14:48:12 -08:00
Andrew Walbran
797e4be221 Add stdlibs property for Rust build rules.
This lets no_std crates depend on system crates like core and alloc.

Bug: 223152204
Test: built pVM firmware skeleton with rust_ffi_static rule
Change-Id: I0f9b0ab3f5e3289fb8ce66f28d779bcf62a7181f
2022-03-07 15:42:34 +00:00
Pirama Arumuga Nainar
b37ae58a3d Memory mapped coverage (take 2)
Add a build variable, CLANG_COVERAGE_CONTINUOUS_MODE, instead of
selecting based on paths.

Test: CLANG_COVERAGE_CONTINUOUS_MODE=true m and verify continuous mode works

Change-Id: I731172fc1f00e1cabff8efcf8b99f9a48210b446
2022-03-04 14:07:53 -08:00
Charisee
5ddec43280 Update RustDefaultVersion to 1.59.0
bug: 215232614
Test: TreeHugger and compiling with m rust
Change-Id: Ia60c77637ab2e41844010e021656fad0870013ac
2022-03-02 19:54:47 +00:00
Treehugger Robot
744c740c92 Merge "Update Rust OWNERS" 2022-02-24 21:43:15 +00:00
Stephen Hines
a982582cf8 Update Rust OWNERS
We haven't updated this in a while, and we have new team members who
should be able to edit Rust build-related rules.

Test: N/A
Change-Id: Iaf001d0718ca187e5570a1198d06a3ae4db78e4c
2022-02-23 12:05:27 -08:00
Pirama Arumuga Nainar
f80a59fac9 [rust] Update clang version used to build bindgen
Bug: http://b/214080353

Use clang-r445002

Test: presubmit
Change-Id: I8b7d5b55757838c303e3695e398e84687804e948
2022-02-23 19:35:08 +00:00
Treehugger Robot
309ee8d398 Merge "Propagate data_bins from Soong to Make" 2022-02-18 01:26:07 +00:00
yangbill
22bafec042 Propagate data_bins from Soong to Make
Write the list of a test module's data_bins value to the
`LOCAL_TEST_DATA_BINS` Makefile variable defined for each module.
This enables downstream tools to correctly set up the runtime
environment for execution. And currently only sh_test, cc_tests, and
rust_tests has this attribute in Android.bp.

Bug: 215234071
Test: m out/soong/Android-aosp_cf_x86_64_phone.mk
Change-Id: I8d47f5f9b25afdc5975c6b414405badb38dbde4b
2022-02-17 04:06:34 +00:00
Justin Yun
2b3ed6403c Fix rust snapshot to capture static libs correctly
SnapshotStaticLibs must include static libs, but it had shared libs.

Bug: 219746113
Test: build vendor snapshot
Change-Id: I0660811bb94446129ae97f52306b065dec73cabd
2022-02-16 08:15:07 +09:00
Aditya Belsare
c0bd27b3b0 Add cert_validator to allowed rust paths
Test: m libcert_request_validator works

Change-Id: I40b8027e98a775dc1b9d3a8ab4431c12d6088c12
2022-02-08 07:32:31 +00:00
Liz Kammer
0ea7998208 Update error messages for failed globs.
Currently error messages appear like:
&fs.PathError{Op:"open", Path:"..." Err:0x18}
which make them difficult to parse.

Test: CI
Change-Id: I18da18abc43230d0ea37d166179d07e585077f51
2022-02-07 08:56:47 -05:00
Treehugger Robot
7afffe6af0 Merge "Allow UWB to use Rust in reference HAL" 2022-01-28 22:08:36 +00:00
Treehugger Robot
6bf833f428 Merge changes from topic "musl_rust"
* changes:
  Support building rust modules against musl libc
  Support genrules as CrtBegin and CrtEnd in rust
  Support multiple crtbegin and crtend dependencies
2022-01-27 21:39:18 +00:00
Pirama Arumuga Nainar
1785fcb171 Merge "[rust/coverage] Remove obsolete WAR to pass -z,start-stop-gc" 2022-01-27 18:37:40 +00:00
Pirama Arumuga Nainar
668da23096 [rust/coverage] Remove obsolete WAR to pass -z,start-stop-gc
Bug: http://b/199203503

Rust's llvm-project source now includes  https://reviews.llvm.org/D97448
and we no longer need this workaround.

Test: m unicode-xid_test_src_lib and verify __llvm_prf_data section is
      present.
Change-Id: I0387bd3af8bfc765f3aba3b309bfbc7ef49d565d
2022-01-26 21:39:49 +00:00
Matthew Maurer
2f90708221 Allow UWB to use Rust in reference HAL
Bug: 216358770
Change-Id: If0be032a248f6258232e2e47c489983b5416c536
2022-01-25 22:40:12 +00:00
Colin Cross
e32f093120 Support building rust modules against musl libc
Add a rust toolchain for musl libc, use std library built from source,
and add default dependencies on musl libc.

Bug: 216192129
Test: m USE_HOST_MUSL=true host-native
Change-Id: Ic5ff4487db9693aeb08a13405f4d18465eecdc4b
2022-01-24 17:33:05 -08:00
Colin Cross
018cbebd71 Support genrules as CrtBegin and CrtEnd in rust
Musl will use a genrule output as a linker script in CrtBegin,
support genrules as Crt* dependencies.

This is equivalent to Ie384089d26459797d0b4b5fef84846507fc508ad
in cc.

Bug: 216192129
Test: m USE_HOST_MUSL=true host-native
Change-Id: Ibc08fdcff7a6bca2a1ec05b781ce929080e211bd
2022-01-24 17:33:05 -08:00
Colin Cross
fe605e14ee Support multiple crtbegin and crtend dependencies
Musl libc with an embedded linker uses multiple crtbegin dependencies,
convert rust's CrtBegin and CrtEnd to lists.

Bug: 190084016
Test: m USE_HOST_MUSL=true host-native
Change-Id: Ie843801e87b1f38ace84502d9e4f938a92ec1fa2
2022-01-24 17:33:05 -08:00
Yi Kong
7433f1d1dc Merge "AFDO for Rust" 2022-01-22 04:16:27 +00:00
Charisee
1a716de57e Update RustDefaultVersion to 1.58.1
Change-Id: Idf6b1e2a83eeb0bdace0583ab02d7c1b393b6c4c
2022-01-21 19:47:53 +00:00
Yi Kong
46c6e59415 AFDO for Rust
Bug: 195134194
Bug: 165018530
Test: build
Change-Id: I30932a22dc0b22716cdc925a3fcc5f9a169fcec4
2022-01-21 18:13:18 +08:00
Pirama Arumuga Nainar
3ae0b5a7c1 Merge "Revert memory mapped coverage" 2022-01-19 06:03:26 +00:00
Treehugger Robot
706ab94ee7 Merge "Allow tools/vendor to build rust" 2022-01-18 22:04:14 +00:00
Pirama Arumuga Nainar
aa966c5630 Revert memory mapped coverage
Bug: http://b/194128476
Bug: http://b/210012154

Reverts:
e6840726bd "[coverage] Override -Wframe-larger-than"
71d697c5cb "Enable memory-mapped coverage instrumentation"

Coverage metrics dropped for ~10 of the 40 modules.  There are also
regressions in mainline when running tests on older platform builds.

Test: presubmit
Change-Id: I4a2b005d3b54764b762b5422e03b7a9ec8727227
2022-01-18 13:13:47 -08:00
Richard Fung
3d11a5698a Allow tools/vendor to build rust
This is necessary to move the mk_payload package from
packages/modules/Virtualization/microdroid to an ARC owned directory.

Bug: 196891323
Test: m -j
Change-Id: Ifa3e509fb4ffa7861e45f69dd4654e8fbe1677ff
2022-01-18 18:26:35 +00:00
Ivan Lozano
2a1291d01d Merge "rust: Fix exported MinSdkVersion" 2022-01-14 22:39:09 +00:00
Ivan Lozano
a91ba25464 rust: Fix exported MinSdkVersion
The exported rust.MinSdkVersion always returns an empty string. Instead
it should return the Min_sdk_version property like rust.minSdkVersion.

This CL renames minSdkVersion to MinSdkVersion so the exported function
has the correct behavior.

Bug: 211858959
Test: m
Change-Id: I4fecfba711c0d3d7a22f4fdf7684924a9457b464
Merged-In: I4fecfba711c0d3d7a22f4fdf7684924a9457b464
2022-01-14 19:57:55 +00:00
Chris Wailes
57c23fa814 Update RustDefaultVersion to 1.58.0
This CL updates the RustDefaultVersion to the new prebuilt version
number and adds an argument to suppress a new linter warning,
non-send-fields-in-send-ty, that is prone to false positives.  See
https://github.com/rust-lang/rust-clippy/issues/8045 for more
information.

Test: m rust
Bug: 213921092
Change-Id: Ide568327f0a8994a6a934d14bb67b3139d0d98da
2022-01-13 17:14:17 -08:00
Treehugger Robot
e751b5355e Merge "Remove self from OWNERS" 2022-01-12 01:45:56 +00:00
Pirama Arumuga Nainar
6609484961 Merge "Enable memory-mapped coverage instrumentation" 2022-01-10 22:36:57 +00:00
Joel Galenson
bfa6a23761 Remove self from OWNERS
Test: None
Change-Id: I14317674f8c9487752ebc2d17c769ed777497ee8
2022-01-06 10:16:34 -08:00
Chih-Hung Hsieh
5140a042e1 Update clang version to clang-r437112b
Bug: 201432564
Test: make
Change-Id: I77bb074ed8dee7cad63d3b3765d9a2c3bc1b8aae
2022-01-05 16:44:51 -08:00
Treehugger Robot
9b3b15c382 Merge "rust: Register rustdoc with checkbuild" 2022-01-05 21:54:40 +00:00
Treehugger Robot
0b9b99adf2 Merge "rust: Support protobuf wrappers well known types" 2022-01-04 19:54:44 +00:00
David Duarte
b6be48d6c9 rust: Support protobuf wrappers well known types
Test: m nothing

Change-Id: I271474f59745670cbba98704182d0966eae6b0ee
2022-01-04 08:52:45 +00:00
Matthew Maurer
2e2ec0573f Merge "rust: Disable dylib vendor modules" 2021-12-20 21:40:56 +00:00
Matthew Maurer
bdda910395 rust: Disable dylib vendor modules
These modules do not currently build correctly. Support is planned but
not complete.

Bug: 204303985
Test: Presubmit + build `rust_library` with `vendor_available: true`
Change-Id: Iac7df9fe0d4eaa9a5ec0ff5a9cd5670af23df2a6
2021-12-16 23:42:47 +00:00
Colin Cross
c68db4b305 Remove InstallBypassMake and ToMakePath
InstallBypassMake and ToMakePath are obsolete, remove them.

Bug: 204136549
Test: m checkbuild
Change-Id: Ie5a6f7254b3d317ed6039e114ed6aec35e1ce273
2021-12-15 15:22:53 -08:00
Joel Galenson
f25ab75d63 Merge "rust: Fix Host multilib prop for rust_test modules." 2021-12-15 15:28:00 +00:00
Pirama Arumuga Nainar
71d697c5cb Enable memory-mapped coverage instrumentation
Bug: http://b/194128476
Bug: http://b/210012154

- pass -runtime-counter-relocation flag, which is needed to enable
memory-mapped coverage on Linux/Android.

- Include '%c' specifier in -fprofile-instr-generate compiler flag to
default to memory-mapped coverage.

- Disable continuous coverage if instrumentation is on for bionic/libc
(http://b/210012154).

Test: Run few coverage tests on Forrest.
Change-Id: Ie3a912f66470fcd3ffc2ffd73371a4e1d2b15df3
2021-12-13 14:44:32 -08:00
Matthew Maurer
c1738b449b rust: Migrate default edition to 2021
Bug: 210475268
Test: Presubmit
Change-Id: I915a8779c032dc463bf76a1a41f545d29a7be044
2021-12-13 18:20:53 +00:00
Matthew Maurer
e3803630c2 rust: Register rustdoc with checkbuild
Bug: 197237709
Test: m checkbuild, manually verify rustdoc targets built
Change-Id: Icfcc4a8c1bc7de4c5e1abbe495646504490ac927
2021-12-10 21:59:15 +00:00
Colin Cross
b435744fdc Merge changes from topic "soong-license-metadata"
* changes:
  Add dependency license annotations
  Build license metadata files in Soong
  Escape Host*Variable contents
2021-12-10 21:43:49 +00:00
Chris Wailes
bc62193c7f Replace Rust global arg with more legible alternative
Bug: 201431719
Test: m rust
Change-Id: I5e0fae74e1df02f059ddcfa004b29059126a52e0
2021-12-09 13:56:32 -08:00
Colin Cross
b674b43656 Add dependency license annotations
Add annotations to dependency tags that are dynamic or classpath
linkage.

Bug: 207445310
Test: m checkbuild
Change-Id: Ife89b8f234aa40c380c721eda7dd18cab697fbb3
2021-12-08 15:08:59 -08:00
Treehugger Robot
a85f7bde32 Merge "Support rust_toolchain_library for rust-project" 2021-12-08 14:14:34 +00:00
Thiébaud Weksteen
566eb80d3c Support rust_toolchain_library for rust-project
Bug: 209678277
Test: SOONG_GEN_RUST_PROJECT=1 m nothing; check that libstd is included
Change-Id: Ic197e00bc4695aa6dcd46b8c704a82a2e5e90460
2021-12-08 17:54:19 +11:00
Treehugger Robot
4efcb9d81a Merge "Update clang version to clang-r437112" 2021-12-08 04:00:23 +00:00
Chih-Hung Hsieh
253fd0609d Update clang version to clang-r437112
Bug: 201432564
Test: make
Change-Id: Idad9e1154b2c65eb29b7682c205f7bb50af17f0b
2021-12-07 15:24:38 -08:00
Chris Wailes
58e748d8d4 Merge "Allow users to enable local incremental Rust builds" 2021-12-07 19:33:24 +00:00
Ivan Lozano
f5c98a2fe5 rust: Fix Host multilib prop for rust_test modules.
NewRustTest will set MultilibBoth true for modules which target
devices, however modules which target both device and host
incorrectly sets MultilibBoth for the host variant. Host tests
can only produce the primary arch target. Therefore, add the
rustTestHostMultilib load hook to set MultilibFirst for the
host variant.

Test: m rust_test module with host_supported: true, check if x86 test
      produced.
Change-Id: I5b04b2a2d898823bcf326336d1d28c46945d47f5
2021-12-07 10:19:48 -05:00
Chris Wailes
d9781fd67e Allow users to enable local incremental Rust builds
This CL allows users to set the SOONG_RUSTC_INCREMENTAL environment
variable to enable incremental Rust builds.  The out/soong/rustc
directory is used for intermediate artifacts.

Test: m rust
Change-Id: Ica2587c30596325b7d3e82d8e3c1d610b92718b8
2021-12-06 15:02:20 -08:00
Yi Kong
203e6f4115 Add "-Z debug-info-for-profiling" flag for AutoFDO
Test: presubmit
Bug: 195134194
Change-Id: I0133ce99e2d5f415e553f7ae8e2ff93c739d6a32
2021-12-07 02:43:20 +08:00
Treehugger Robot
f8646fc937 Merge "Update RustDefaultVersion to 1.57.0" 2021-12-03 23:04:54 +00:00
Chris Wailes
284b7f32cc Update RustDefaultVersion to 1.57.0
Change-Id: I90e03f864541175e13701184ee74a89ffd03790b
2021-12-03 12:00:59 -08:00
Matthew Maurer
0e714da0f3 rust: Ensure unwind tables are generated
Currently, we are depending on a platform default in rustc's
android_base module to keep unwind tables generated. That default was
configured specifically to change the behavior for Firefox profiling
purposes prior to the existence of the override flag. As a result,
there's no structural reason the default will remain as is.

Bug: 193702360
Test: m
Change-Id: Ic5b57d5a31f4e67a66351a3f0efc530c95aa3836
2021-11-24 22:03:25 +00:00
Pirama Arumuga Nainar
1381dceeba Update rust prebuilt version to 1.56.1p1
Respin rust point release 1.56.1p1 with cherry-pick of
https://reviews.llvm.org/D104556 (needed for Rust coverage).

Bug: https://issuetracker.google.com/issues/206980172
Test: m rust
Change-Id: Ib63a7d8128c86ae9291c4f5275726cfc3bc15f48
2021-11-22 09:55:44 -08:00
Ivan Lozano
9fdba2844e Merge "rust: Add rust_toolchain_library module." 2021-11-17 16:59:15 +00:00
Ivan Lozano
45e0e5b012 rust: Add rust_toolchain_library module.
Adds a new rust_toolchain_library module, a module which can compute the
source path from the toolchain root.

Bug: 140642453
Test: m

Change-Id: I2d90722880279533eb93d2d946ac8c31fc0b1835
2021-11-16 08:51:48 -05:00
Ivan Lozano
aed0adfee9 Merge "rust: Add Recovery Snapshot Soong tests for rust." 2021-11-16 13:47:18 +00:00
Ivan Lozano
b993a835c3 Merge "rust: Add data_libs and data_bins to rust_test" 2021-11-16 13:46:49 +00:00
Ivan Lozano
3e1bc6cc0d Merge "Use new soong_cc_rust_prebuilt.mk" 2021-11-15 22:19:46 +00:00
Ivan Lozano
4e5f07d27b rust: Add data_libs and data_bins to rust_test
Allows defining data binaries and libraries that should be installed
alongside a rust_test module, similar to cc_test.

This refactors cc_test as well so it can define rust_ffi_shared and
rust_binary modules as data.

Bug: 171710847
Test: New Soong tests pass.
Test: Example module installs data appropriately.
Change-Id: I0b56098fb475ec54f9b7a761220d260fe68cbee1
2021-11-15 17:18:42 -05:00
Ivan Lozano
c2ca1ee83d rust: Add Recovery Snapshot Soong tests for rust.
Bug: 197866992
Test: m nothing
Change-Id: I4b5401cf2ffa0dbcc6fea60f90bad4c47a9d5e6b
2021-11-15 17:11:20 -05:00
Ivan Lozano
92a89ed1c5 Merge "rust: Skip global 'fuzzer' sanitizer static bins" 2021-11-15 19:17:54 +00:00
Ivan Lozano
602227bcb5 Merge "rust: Only apply hwasan flags once to fuzz targets" 2021-11-15 16:03:31 +00:00
Ivan Lozano
6c5b8f4e02 rust: Skip global 'fuzzer' sanitizer static bins
The 'fuzzer' sanitizer enables 'hwasan', which is not supported for Rust
static binaries. Make sure we skip applying this sanitizer to those
binaries.

Bug: 204776996
Test: SANITIZE_TARGET=fuzzer m <static_rust_executable>
Change-Id: I619cfab32b46c0811590973344eb5cdbe3f1a119
2021-11-15 09:35:12 -05:00
Ivan Lozano
f3e8fc3f0b rust: Only apply hwasan flags once to fuzz targets
On HWASAN global sanitized builds, fuzz targets had hwasanFlags applied
twice. Rust only allows llvm-args flags to be passed in once however, so
this broke compilation.

Bug: 204915322
Test: SANITIZE_TARGET='hwaddress fuzzer' m <fuzzer>
Change-Id: I4f6c35e04bc4c891d9c66e8a53c3dcb88e8670cf
2021-11-13 07:46:05 -05:00
Treehugger Robot
70275c031e Merge "Allow open-dice to build tests for generatied open-dice rust bindings." 2021-11-12 20:38:53 +00:00
Janis Danisevskis
73f2104588 Allow open-dice to build tests for generatied open-dice rust bindings.
Test: N/A
Bug: 205626417
Change-Id: Iafa79f07005b9863468252828c74ee199279c457
2021-11-12 20:33:49 +00:00
Ivan Lozano
52a3e36c92 Merge "rust: Support new rust_stdlib_prebuilt_host type" 2021-11-12 19:35:03 +00:00
Ivan Lozano
94e8a651fa Merge changes I26198187,Ia904d07b
* changes:
  rust: Support MTE memtag_heap sanitizer
  rust: Support global sanitizers
2021-11-12 19:26:04 +00:00
Ivan Lozano
d06cc748c1 Use new soong_cc_rust_prebuilt.mk
soong_{cc,rust}_prebuilt.mk has been merged. Use the new file.

Bug: N/A, clean-up
Test: m
Change-Id: I3f03e866815f6394aacd8cb0deba04f381b78c29
2021-11-12 13:27:58 -05:00
Ivan Lozano
fba2aa255c rust: Support new rust_stdlib_prebuilt_host type
Refactor Rust prebuilts to support the new rust_stdlib_prebuilt_host
module type, and change the format for depending on the prebuilt host
stdlibs.

Bug: 140642453
Test: m
Change-Id: Ifbc4741818777934e917631c788b20911856c44a
2021-11-12 08:58:17 -05:00
Treehugger Robot
09104df494 Merge "Add hardware/interfaces/security to rust allow list." 2021-11-12 00:55:52 +00:00
Matthew Maurer
739edbc0bc Merge "Update the Rust prebuilt version number to 1.56.1" 2021-11-10 23:57:44 +00:00
Ivan Lozano
aa1a9e4086 Merge "rust: Refactor stripped output file path" 2021-11-10 21:34:21 +00:00
Janis Danisevskis
a9029d1f7e Add hardware/interfaces/security to rust allow list.
Test: N/A
Bug: 205626417
Change-Id: I3a648063c8380074713ce58957e4ac062a331e40
2021-11-10 10:59:46 -08:00
Ivan Lozano
e950cdad6d rust: Add missing variation -D flags to bindgen.
rust_bindgen calls are missing a large set of -D cflags which control
how headers are interpretted for certain variations (such as
-D__ANDROID_VNDK__). This CL introduces the full set of these flags.

Bug: 205609024
Test: rust_bindgen vendor variant builds correctly.

Change-Id: Id781c1f88352e9c238c49619f0dce20f804cfc77
2021-11-10 13:28:55 -05:00
Ivan Lozano
8d10fc39af rust: Refactor stripped output file path
Rust installed files reside in "$MODULE_OUT/stripped/" when they are
stripped, otherwise they reside in "$MODULE_OUT". However, other parts
of Soong assume that installed files are always in $MODULE_OUT
(cc_modules place *unstripped* files in $MODULE_OUT/unstripped).

This notably causes problems when adding Rust modules as test data in
AndroidMkDataPaths. When Rust modules are parsed by AndroidMkDataPaths,
if they are stripped then they incorrectly get installed as test data
with the path:
<install_root>/<relative_install_path>/stripped/file.

This CL refactors how we handle Rust stripped output such that the
installed file always resides in $MODULE_OUT.

Bug: 171710847
Test: Installed files now always reside in $MODULE_OUT
Change-Id: I53a6ff57a0a5a55cd95ea78ae592ce22abfa20c9
2021-11-09 21:43:58 -05:00
Jose "Pepe" Galmes
cd3af1e52c Merge "Support for rust recovery snapshot." 2021-11-09 19:39:32 +00:00
Jose Galmes
d7d99be225 Support for rust recovery snapshot.
Bug: 197866992
Test: source build/envsetup.sh
Test: m -j nothing
Change-Id: I02bb188669cf9f17073592a4622998f96d5f54ac
2021-11-09 08:40:50 -08:00
Treehugger Robot
f50bfc9d47 Merge changes from topic "soong-rust-install"
* changes:
  Move sh_binary module installation into Soong
  Move rust module installation into Soong
2021-11-09 16:29:36 +00:00
Colin Cross
7743557a23 Move rust module installation into Soong
Move rust module installation rules into Soong by overriding
InstallBypassMake.

Bug: 204136549
Bug: 205530905
Test: m checkbuild
Test: m && acloud create --local-instance --local-image
Change-Id: Icc00c4ea5d91ae489c1d9d3b66a072c9de86c717
2021-11-08 13:31:51 -08:00
Baligh Uddin
5dd07e514e update allowlist to new path for bluetooth
BUG: 196026708
Test: TH
Merged-In: I53c4d72321c7c0aff589969989b5f1990aa0133c
Merged-In: Ia511786ea3f47f673d638bdde8581fe0a31a3cc1
Change-Id: I06e125dfa1f063903b5af9b8d37592b9446eb29e
2021-11-06 14:45:48 +00:00
Ivan Lozano
62cd0388eb rust: Support MTE memtag_heap sanitizer
This CL adds support for the MTE memtag_heap sanitizer. This is
controlled via inclusion of an ELF note.

Bug: 170672854
Test: Heap MTE-enabled Rust test binary triggers MTE
Change-Id: I2619818785e86a94667d02b30d102c83456b7925
2021-11-04 10:51:54 -04:00
Ivan Lozano
7b0781d14c rust: Emit toc files for cdylibs
Write toc files that list the exported symbols so dependents are
only rebuilt if the exported symbols change.

This exports the CC function TransformSharedObjectToToc, and also
removes an unused arg from its signature.

Bug: 178185435
Test: New Soong test passes.
Test: m <toc file path>
Change-Id: I7ab69bf7e7f32f25eb4c7ca9d18d877dac1511db
2021-11-03 15:34:50 -04:00
Ivan Lozano
5482d6a991 rust: Support global sanitizers
This CL adds Rust support for the SANITIZE_TARGET options.

This CL includes a couple small fixes to related to HWASAN, ASAN,
ensuring that the Never sanitize property is respected. Notably,
additional llvm-args are passed to ensure that HWASAN-ified Rust/C
interop works correctly.

Bug: 170672854
Bug: 204915322
Test: SANITIZE_TARGET globally applies hwasan to Rust targets
Change-Id: Ia904d07b4618f72cdc95c51f88961905c240ac53
2021-11-03 12:29:01 -04:00
Chris Wailes
60c22ec7ed Update the Rust prebuilt version number to 1.56.1
Bug: 201431381
Test: m rust
Change-Id: Ic3b428ff6eb4b1e346eb37c44468824fc1fb143d
2021-11-02 16:59:01 -07:00
Ivan Lozano
c7a4de25c1 Merge changes I2373d366,I908496d9
* changes:
  rust: Add common interface for binaries
  rust: Support whole static libraries with any name
2021-11-02 12:37:11 +00:00
Dan Willemsen
8528f4ec5e Add Darwin+Arm64 toolchain support
This just sets up the toolchain and allows Darwin+Arm64 to be specified
as a HostCross target. These variants will not be exported to Make, or
be installed on a Soong-only build. A future CL will add support for
universal binaries using these variants.

This config is a bit stranger than the regular 64/32 multilib, as it's
two primary 64-bit configs. And on a Darwin/X86 machine, the Arm64
versions are HostCross (doesn't work on the current machines), while a
Darwin/Arm64 machine, either version works (if Rosetta is installed).

Bug: 203607969
Change-Id: Iacaed77d267773672da027cd74917e33fb1c1e94
2021-11-01 15:07:37 -07:00
Ivan Lozano
21fa0a5844 rust: Add common interface for binaries
Structs embedding binaryDecorator (rust_test, rust_benchmark, rust_fuzz)
are binaries as well, but won't pass checks against *binaryDecorator,
such as the check in StaticExecutable().

Add a binaryInterface that can be checked instead to simplify these
checks and ensure we catch all binaries.

Bug: 170672854
Test: rust_test, rust_benchmark return true StaticallyLinked
Change-Id: I2373d3663373a6977260785602a02d39a41320fe
2021-11-01 14:57:44 -04:00
Ivan Lozano
fdadcd7937 rust: Support whole static libraries with any name
This CL allows binaries to depend on whole static libraries which
don't begin with the 'lib' prefix.

Bug: 170672854
Test: Whole static library that doesn't have lib prefix can be linked
Change-Id: I908496d9369c7bec3232e2feed0599f6cf6d9383
2021-11-01 14:56:59 -04:00
Treehugger Robot
2a524318e4 Merge "Add path of uwb NativeManager to rust allowlist." 2021-10-27 21:03:22 +00:00
ziyiw
f3d0222262 Add path of uwb NativeManager to rust allowlist.
Test: mmm
Bug: 197341298
Change-Id: I70a40f493efced15702dcd0f9ab50733ea23df9f
2021-10-27 11:28:17 -07:00
Treehugger Robot
e852d69f88 Merge "[rust] Switch LTO flavor to "thin"" 2021-10-26 15:47:03 +00:00
Pirama Arumuga Nainar
f77913f0de [rust] Switch LTO flavor to "thin"
Bug: http://b/202032071

Thin LTO provides similar performance gains to full LTO but takes less
time during build.

Thin LTO also doesn't cause the error with `-C lto` and `-C
llvm-args=--runtime-counter-relocation` in b/202032071.

Test: presubmit
Test: verify b/202032071
Change-Id: Id5749aaea598d4b555a9d959ed753a312ae36f26
2021-10-25 22:44:55 +00:00
Joel Galenson
d993155204 Allow writing Rust fuzzers for third-party crates.
These would ideally be upstreamed, but until then we can host them here.

Test: Run fuzzers.
Change-Id: Ie1bfd8ce6dffeaa211b85cd6340dfb435ab83c71
2021-10-21 14:28:00 -07:00
Ivan Lozano
39b0bf0326 rust: Package shared libraries with fuzzer zips
Rust fuzzers were not packaging up their CC shared dependencies.
This would lead to fuzzers using the shared libraries included on
system, which may not be sanitized, leading to incorrect behavior.

This refactors the relevant code from CC and calls it from the Rust
build logic.

Bug: 202282599
Test: output rust fuzzer zip file includes shared dependencies.
Change-Id: I92196eb0141733797a67eae24f8e9aedea94c3bc
2021-10-14 15:31:47 -04:00
Seth Moore
6ec96b8102 Merge "Flag an error on empty rust module srcs" 2021-10-14 15:25:17 +00:00
Seth Moore
3afac0b36f Flag an error on empty rust module srcs
It's an error if a rust module's srcs is empty. Prior to this change
the output was a panic that complains loudly about a slice error and
nothing else. This change doesn't stop the panic, but at least adds
a bit of context so devs who make a simple mistake can more easily
fix it.

Test: SOONG_GEN_RUST_PROJECT=1 m nothing
Change-Id: Id7d8465d533413c3000699661222a53a7c8678f3
2021-10-14 15:25:07 +00:00
Treehugger Robot
4af0d002a5 Merge "Installation routine for rust is similar to that of cc" 2021-10-12 00:05:37 +00:00
Seth Moore
af96f99d83 Include proc macro crates in rust-project.json
These crates were skipped before, leaving dependencies missing in
rust-project.json. Include them and mark them as `"is_proc_macro": true`
so that rust-analyzer can process them.

Fixes: 202290038
Test: SOONG_GEN_RUST_PROJECT=1 m nothing
Change-Id: Ia80e6f5e2f56a76608ba057075600e6b4424281b
2021-10-06 19:39:06 +00:00
Jiyong Park
d1e366a072 Installation routine for rust is similar to that of cc
This change makes the installation routine for rust be similar to that
of cc. Previously, rust.baseCompiler.install() (which internally calls
android.ModuleContext.InstallFile()) was not called when the module is
not installable. Although this may sound right at first glance, it is a
behavior different from that of cc and prevents an uninstallable rust
module from being packaged into a packaging module like
android_filesystem. This is because the packaging happens inside
InstallFile().

Fixing the issue by following the behavior of cc modules; Call
HideFromMake() or SkipInstall() when a rust module is not installable,
but call InstallFile() as long as the output file is valid.
InstallFile() internally skips the installation (but the packaging) when
HideFromMake() or SkipInstall() was called.

Bug: N/A
Test: atest MicrodroidHostTestCases
Change-Id: I15f4adc8544dac53647647d8bc4273f9f4acbeb2
2021-10-05 09:12:41 +09:00
Jiyong Park
2811e07868 rust modules respects the installable property
So far, the property wasn't respected.

Bug: N/A
Test: m
Change-Id: Ie3b011250595f02c3ab315efbac6694df3e181e7
2021-09-30 17:25:21 +09:00
Ivan Lozano
eabde18653 Merge "rust: Add require_root and vendor install base" 2021-09-24 18:39:47 +00:00
Joel Galenson
33e32f3ce5 Merge "Pass "--extern proc_macro" to rust_proc_macros." 2021-09-23 21:26:22 +00:00
Joel Galenson
ce7bbdc38a Pass "--extern proc_macro" to rust_proc_macros.
This is actually required for some code.

Test: Modify the new test so it fails and see it fail.
Test: Build crates that fail without it.
Change-Id: I527752b765e5552aa2de7e201f056955e053e1f3
2021-09-23 10:34:24 -07:00
Ivan Lozano
67eada34db rust: Refactor cfg and feature flag calculation
Move the cfg and feature flag calculation out of compilerFlags so that
it's a separate step.

The previous arrangement resulted in overridden compilerFlags which
must to set any additional cfgs/features before calling the base.
This is a bit confusing and undocumented behavior, so instead break
it out into a separate call that can itself be overriden.

Bug: N/A
Test: Soong tests pass
Change-Id: I28e4f707b3b3ca6eb621b7613c3737817f877bb8
2021-09-23 12:21:04 -04:00
Ivan Lozano
ba2226164c rust: Add require_root and vendor install base
Adds the require_root property to rust_test modules so that tests can
run as root. Also adds an install base to allow vendor tests to install
to a different path, otherwise installs to 'unrestricted' like cc_test.

Bug: 200602232
Test: test with require_root: true runs as root
Test: test installed to new base directory
Change-Id: Ifa716871ff87471f0c0caff7af558d47db85ccd1
2021-09-21 11:01:11 -04:00
Zach Johnson
5145e9d917 Add NFC to the Rust allowlist
rustfmt & preupload checks are being checked in shortly

Bug: 197333653
Test: compile
Change-Id: I91f14dc9a58d04fda6ae77de2ea5d85f481d0563
2021-09-17 12:08:44 -07:00
Treehugger Robot
6e09abdf5c Merge "Update clang version used for bindgen to r433403" 2021-09-13 18:07:44 +00:00
Christian Wailes
c3cb99e61b Merge "Update the Rust prebuilt version number to 1.55.0" 2021-09-13 16:39:37 +00:00
Chris Wailes
d23f0d07e1 Update the Rust prebuilt version number to 1.55.0
Bug: 199547393
Test: m rust
Change-Id: I05831a107b46019205c0a7d530b6f2a3b1beba75
2021-09-13 16:38:27 +00:00
Yi Kong
ef99688cff Update clang version used for bindgen to r433403
Bug: 197230471
Test: presubmit
Change-Id: If8885beb979492c0a0c6cc4e310a9e09fd86da7b
2021-09-12 15:22:28 +08:00
Colin Cross
65e8f6d765 Merge "Make rust builds hermetic" 2021-09-10 19:51:20 +00:00
Pirama Arumuga Nainar
1799f9d7b4 [rust/coverage] Pass -z,nostart-stop-gc to the linker
Bug: http://b/199203503

Upstream LLVM change 6d2d3bd0a6 made -z,start-stop-gc the default.  It
drops metadata sections like __llvm_prf_data unless they are marked
SHF_GNU_RETAIN.  https://reviews.llvm.org/D97448 marks generated
sections, including __llvm_prf_data as SHF_GNU_RETAIN.  However this
change is not in the Rust toolchain.  Since we link Rust libs with new
lld, we should use nostart-stop-gc until the Rust toolchain updates past
D97448.

Test: m unicode-xid_device_test_src_lib and verify that they have the
__llvm_prf_data section.

Change-Id: I55eb3622dae9bd789fbacfe708600316102c365f
2021-09-10 10:33:30 -07:00
Colin Cross
748c8c7e09 Make rust builds hermetic
Rust builds were picking up the crt objects and system libraries like
libc.so from /usr/lib/x86_64-linux-gnu/Scrt1.o and
/lib/x86_64-linux-gnu/libc.so.6.  Pass --sysroot to the linker to
point it to the glibc prebuilts.

Test: manual
Change-Id: I6540df8aef0e5c2258de77456d18a6052db627d4
2021-09-10 09:55:54 -07:00
Lukacs T. Berki
9f6c24a887 Rename BuildDir and NinjaBuildDir.
These are just out/ and out/soong/ and the old names were quite
confusing.

Test: Presubmits.
Merged-In: I999ca62162062f27e449f83ffb00fa580d4065b8
Merged-In: I2fcd80a9e376a6842a06aa104a9f6f5c5e16f8c7
Change-Id: Ib481d2aac40df8da1b74174dc8ec576c1cb48be0
2021-08-27 10:08:49 +02:00
Matthew Maurer
80f0eb1e01 rust: Add UWB to allowlist
Change-Id: Ic89e274412c97631f615e6e9ccd711e9300397d1
Test: None
2021-08-26 20:38:16 +00:00
Joel Galenson
a7614dd626 Add system/logging/liblog.
This is needed so it can run bindgen tests.

Test: Build
Change-Id: Iefcd1077e3b572c662474c4bb461b04dc66c6204
2021-08-23 14:02:49 -07:00
Treehugger Robot
899b98d508 Merge "rust: doc: Zip up docs when done" 2021-08-20 22:11:17 +00:00
Matthew Maurer
ca68c49621 rust: doc: Zip up docs when done
Fetching artifacts from the build server doesn't go well with large
numbers of files in nested directories.

Produce an additional rustdoc.zip artifact to make this easier.

This change also prevents ${DIST} from receiving the unpacked rustdoc
site. This can be changed if b/188822051 is fixed.

Bug: 162741284
Test: m rustdoc; check resulting zip contents manually
Change-Id: I80b6a8fa6e274d2d8c3419d8734251afd4d7dba7
2021-08-20 13:08:16 -07:00
Matthew Maurer
9f59e8db27 rust: Hook up InstallIn functions + Product
InstallIn functions must be hooked up not only to install to special
images, but also to receive special handling by android/arch.go such
that some images are implicitly multilib: first.

Also hook up more product details.

Bug: 178565008
Bug: 165791368
Test: lunch aosp_arm64; m
Change-Id: I1980d5aa9d55f78c222b98d60a404cd6ea5abbfb
2021-08-20 12:14:54 -07:00
Matthew Maurer
c6868383f4 Support Rust in Ramdisk
Bug: 178565008
Bug: 165791368
Test: Build and link a Rust library into a ramdisk binary
Change-Id: I9682b978936624133e5a62e94caace0e8958fd0f
2021-08-17 15:08:49 -07:00
Matthew Maurer
a61e31f66a Support Rust in native-bridge
Bug: 178565008
Bug: 165791368
Test: Build and link a Rust library into a native-bridge binary
Change-Id: I3546571530529203d9dbfd62777f20de18c6bd51
2021-08-17 15:08:49 -07:00
Matthew Maurer
52af5b052b Support Rust in Product
Bug: 178565008
Bug: 165791368
Test: Build and link a Rust library into a product binary
Change-Id: I9c5aa5f3a1f323af9aa2aee804635045f1b91bd4
2021-08-17 15:08:49 -07:00
Matthew Maurer
460ee9429e Support Rust in Recovery
Bug: 178565008
Bug: 165791368
Test: Build and link a Rust library into a recovery binary
Change-Id: I1c76e6204019443c567082730a4cf680f4a2a74a
2021-08-17 15:08:49 -07:00
Ivan Lozano
0ad64f50fd Merge "rust: Allow modules to use only generated sources" 2021-08-13 19:37:04 +00:00
Ivan Lozano
e4db0036d7 rust: Allow modules to use only generated sources
Removes the need for rust_test modules that test generated source to
define a source file that simply calls include()! to pull in the
generated source.

Bug: 196076408
Test: m libselinux_bindgen_test
Change-Id: I600301ab74f6ece861916fa2545b061c81b0d92d
2021-08-13 13:37:19 -04:00
Ivan Lozano
8711c5cf8c rust: Link libunwind into Rust static executables.
Rust static executables fail to build due to missing unwind symbols.
Make sure we link libunwind when building these.

Bug: 194386505
Test: rust_binary with static_executable: true builds.
Change-Id: I74bab25e186e181bc1ac8fdd608687707c662e4d
2021-08-13 13:15:31 -04:00
Ivan Lozano
dd7107c84b Merge "rust: Add support to emit certain Cargo env vars." 2021-08-12 17:05:39 +00:00
Ivan Lozano
a9a1fc0747 rust: Add support to emit certain Cargo env vars.
Some crates expect Cargo to provide certain environment variables. This
CL adds a compatability flag that emulates the behavior of Cargo by
setting these environment variables when building.

Bug: 171011485
Test: New soong tests pass
Test: quiche no longer requires patch removing CARGO_PKG_VERSION
Change-Id: I4c95c284846f6075428c6f61fe8c260f2e35fbd9
2021-08-12 13:18:34 +00:00
hamzeh
c0a671fc80 Moving common fuzzing code to fuzz package
Test: make haiku and make haiku-rust
Change-Id: Ife80cc10672f51bd6afbae7061cc9373a2a15e7d
2021-08-11 23:54:15 +00:00
Yabin Cui
60880e0517 Merge "Update clang version used for bindgen" 2021-08-11 21:12:27 +00:00
Joel Galenson
adffbe9166 Merge "Add libselinux to the Rust allowlist so we can run its test." 2021-08-11 17:20:35 +00:00
Yabin Cui
1424ea499d Update clang version used for bindgen
Bug: 190099451
Test: none
Change-Id: Ie0480288bb1be2e7d55d8dd01b8d006410bfc7a0
2021-08-10 15:13:01 -07:00
Joel Galenson
e4d6390558 Add libselinux to the Rust allowlist so we can run its test.
Test: Build and atest
Change-Id: Id828f286b35decfd16166e9cbb78cdf477014bf6
2021-08-10 11:54:14 -07:00
Chris Wailes
90c4b14a30 Removed commented out code
A previous CL commented out code instead of removing it.  This CL fixes
this grave error.

Test: TH
Change-Id: I1daeaaa1ad90230aec639d603e7cdb9b61af251a
2021-08-10 10:21:02 -07:00
Chris Wailes
353405d9fb Clean up generated rust-project.json files
This CL removes the roots section from the rust-projects.json file as it
is no longer required by the rust-analyzer tool.

Bug: 162055556
Test: prebuilts/rust/tests/rust-analyzer-integration-test.sh
Change-Id: I85c3277632c88394bc52e709ecce83f6aa1f2e0e
2021-08-09 15:50:39 -07:00
Treehugger Robot
27ac52198d Merge "Update the Rust prebuilt version number to 1.54.0" 2021-08-04 21:28:20 +00:00
Treehugger Robot
1e28e36589 Merge "[rust] [coverage] Don't pass -C link-dead-code" 2021-08-04 20:51:47 +00:00
Pirama Arumuga Nainar
b13e8ac6c8 [rust] [coverage] Don't pass -C link-dead-code
Bug: http://b/186873963

Per jgalenson@, this was added for GCOV and is not needed for clang
coverage.

Test: http://go/abtd/run/L71000000950546158
Change-Id: I352669687cbe764d938acb94d9d4fe0c24a31a56
2021-08-04 05:06:22 +00:00
Christian Wailes
99bc67a548 Merge "Conditionally apply rustdoc flags to third party crates" 2021-08-03 19:39:17 +00:00
Joel Galenson
48a7fb6afa Merge "Add librustutils to the Rust allowlist and remove libc." 2021-08-03 14:20:06 +00:00
Chris Wailes
b2703adce4 Conditionally apply rustdoc flags to third party crates
This CL changes the logic in rust/builder.go so that some rustdoc flags
are only applied to external crates.  This will allow us to since
warnings and deal with soft-failures in external crates while allowing
us to be more strict with our internal Rust code.

Bug: 195136952
Test: m rustdoc
Change-Id: Icdde304bbbb323cae9657e8f842f58ae79e811ce
2021-08-02 11:50:34 -07:00
Ivan Lozano
aa7c980002 rust: Disable dead stripping for fuzzers.
Without `-C link-dead-code`, Rust fuzzers may fail to start fuzzing.
See the cargo-fuzz issue in the code comment for details. This patch
disables dead stripping for our fuzzers by default.

Bug: 193200135
Test: Flag emitted when building Rust fuzzers.
Test: Fuzzer runs on device.
Change-Id: I530de30e9a57db206bcbf3d2d3d371628eef8934
2021-08-02 11:11:11 -04:00
Chris Wailes
3ac8f638df Update the Rust prebuilt version number to 1.54.0
This CL changes the Rust prebuilt version number from 1.53.0 to 1.54.0.

Test: m rust
Bug: 194812675
Change-Id: Icdbeab414dd39814f060e400cdca1fdb59f4f859
2021-07-30 18:10:30 +00:00
Joel Galenson
84be2fc380 Add librustutils to the Rust allowlist and remove libc.
Bug: 182498247
Test: Build
Change-Id: I0ea6c9b61cfdb667646e0067098f0ee5b9d9a2b3
2021-07-30 07:47:56 -07:00
Ivan Lozano
c4dae8eb27 Merge "rust: Prevent manually defined lib link flags." 2021-07-29 17:06:09 +00:00
Treehugger Robot
58fd4c43ea Merge "Added a flag to the rustdoc invocation" 2021-07-28 20:31:03 +00:00
Chris Wailes
9953a1999c Added a flag to the rustdoc invocation
This CL adds the '-A renamed_and_removed_lints' argument to the rustdoc
invocation.  This will allow the compiler to be updated even when
libraries have not fixed all of the new warnings in their codebase.

Bug: 194899248
Test: m rustdoc
Change-Id: Ife9fd6dbd7223c9964a8117d60e8be878c8f7332
2021-07-28 12:09:28 -07:00
Christian Wailes
3d976a7148 Merge "Update the Rust prebuilt version number" 2021-07-28 14:05:25 +00:00
Ivan Lozano
45a9e3196c rust: Prevent manually defined lib link flags.
Adds a filter to prevent modules from manually defining certain linkage
flags. These flags should only be automatically generated based on
listed dependencies.

Bug: 161942165
Test: Soong tests pass
Change-Id: Ibc014391ef1de10188c2d139d41d0241d6c68b5f
2021-07-27 15:05:13 -04:00
Ivan Lozano
6d58321f94 Merge "rust: Add vendor/ to allowed list." 2021-07-27 18:30:43 +00:00
Ivan Lozano
dca00cb76b rust: Add vendor/ to allowed list.
Bug: 191507775
Test: N/A
Change-Id: I077459f545d4a16de092a3cce27ce97afb76d514
2021-07-27 11:58:38 -04:00
Chris Wailes
dff3901c89 Update the Rust prebuilt version number
This CL changes the Rust prebuilt version number from 1.52.1 to 1.53.0.

Test: m rust
Bug: 194400612
Change-Id: Icaafda64a267742593f7745aa4e90ed81665d075
2021-07-26 19:26:02 -07:00
Colin Cross
528d67e523 Reland "Split the x86 host toolchain into glibc and musl variants"
Split the x86 host toolchain into glibc and musl variants

Create new musl toolchains that are based on the existing glibc
toolchains, and add the necessary flags for musl compiles.

This relands Ifc02f9e5afa61ff758be98b0c962f3a4b53d0546 with changes
for I46672e3a096b6ea94ff4c10e1c31e8fd010a163c.

Bug: 190084016
Change-Id: Iaa9f7a50ff601155ecd73acc5701a2c226be66dc
Test: TestArchMutator
2021-07-23 22:25:36 +00:00
Colin Cross
c5647ca16e Merge "Revert "Split the x86 host toolchain into glibc and musl variants"" 2021-07-23 22:22:11 +00:00
Colin Cross
5d6904e1cf Revert "Split the x86 host toolchain into glibc and musl variants"
This reverts commit 4fb4ef2242.

Reason for revert: crossed with aosp/1775072

Change-Id: Ied922850b810d82627ba4f9ee42f672cfe286c91
2021-07-23 22:20:29 +00:00
Colin Cross
7628e933b6 Merge changes Idbeb4819,Ifc02f9e5
* changes:
  Add dynamic_list property
  Split the x86 host toolchain into glibc and musl variants
2021-07-23 22:08:19 +00:00
Treehugger Robot
40fa08bfa7 Merge "Add a phony target for all Rust targets" 2021-07-23 20:28:02 +00:00
Treehugger Robot
02fa0c36e4 Merge "Update the Rust prebuilt version number" 2021-07-23 20:18:30 +00:00
Chris Wailes
74be764496 Add a phony target for all Rust targets
Test: m rust
Change-Id: Id347edf9998f6714622c9f173420477a9e534723
2021-07-23 10:38:01 -07:00
Colin Cross
4fb4ef2242 Split the x86 host toolchain into glibc and musl variants
Create new musl toolchains that are based on the existing glibc
toolchains, and add the necessary flags for musl compiles.

Bug: 190084016
Test: TestArchMutator
Change-Id: Ifc02f9e5afa61ff758be98b0c962f3a4b53d0546
2021-07-23 08:57:17 -07:00
Joel Galenson
850edab344 Merge "Add libc to Rust allowlist." 2021-07-23 14:46:55 +00:00
Ivan Lozano
c76c802e6a Merge "rust: Add support for bootstrap linker." 2021-07-23 14:00:23 +00:00
Colin Cross
78fd15f7d6 Merge "Replace android.BuildOs with Config.BuildOS" 2021-07-23 00:07:01 +00:00
Chris Wailes
f498417977 Update the Rust prebuilt version number
This CL changes the Rust prebuilt version number from 1.51.0 to 1.52.1.

Test: TH
Change-Id: I02bf6166323040621dcbfe9c823bb1982a2e9a36
2021-07-22 16:22:05 -07:00
Ivan Lozano
a2268635f4 rust: Add support for bootstrap linker.
Adds the 'bootstrap' property to Rust modules to set the linker to the
bootstrap linker.

Bug: 194276829
Test: set bootstrap: true on module, checked .interp section on output.
Test: bootstrapped binary runs.
Change-Id: I459c8194902cfea3c44b060e70d28a43fcba3ade
2021-07-22 14:23:27 -04:00
Kiyoung Kim
5d96f64d04 Merge changes I3574d2a1,Ifb69fb3d
* changes:
  Update prebuilt_etc available for snapshot
  Separate snapshot definition
2021-07-22 00:57:39 +00:00
Joel Galenson
0ba9cd4cc8 Add libc to Rust allowlist.
Bug: 182498247
Test: Build
Change-Id: I3049967e9736e1c0c802f7678f5cafeb6644d4aa
2021-07-21 10:34:51 -07:00
Colin Cross
0c66bc615b Replace android.BuildOs with Config.BuildOS
Replace the android.BuildOs constant with Config.BuildOS so that it
can vary based on the product config.

Bug: 190084016
Test: all Soong tests
Change-Id: Ia67f872d8b2ab788747a22e3a9659dc21c9775cd
2021-07-20 12:46:48 -07:00
Treehugger Robot
0b45f0b90f Merge "Refactoring fuzz packaging code" 2021-07-19 20:02:23 +00:00
Matthew Maurer
83a12d1f94 Merge "[rust] Add android_dylib cfg flag" 2021-07-19 19:43:56 +00:00
Kiyoung Kim
48f3778cb4 Separate snapshot definition
Current snapshot definition is located in the CC module, so it is
difficult to capture non-CC module (such as prebuilt_etc) to the
snapshot. Separate general snapshot definition from cc so other modules
can also define its own snapshot.

Bug: 192430376
Test: m nothing passed
Change-Id: Ifb69fb3d2ec555b629aa31ec03e7ce5831fd3063
2021-07-19 11:42:32 +09:00
hamzeh
41ad881e16 Refactoring fuzz packaging code
Rust and cc fuzz packaging have common. This change is to put this
common methods and fields into fuzz_common.

Test: make haiku and make haiku-rust ran locally and verify corpus,
dict and config are packaged along with the executable.

Change-Id: I04bf535cd2597ed8b2bd3d8e6ea8c28f38bdc18b
2021-07-16 17:43:33 -07:00
Ivan Lozano
2bd6cce95a Merge "rust: Remove libtest from stdlibs list" 2021-07-16 14:44:25 +00:00
Ivan Lozano
3ee74c8252 rust: Remove libtest from stdlibs list
libtest does not need to be linked for every module type, so remove it
from the stdlibs list. Instead, link it only when building benchmarks or
tests.

Bug: 193782599
Test: cd external/rust/crates/; mma
Test: Rust tests still run correctly.
Change-Id: I536be8754da0987e09340744d9ebf668b8e734d0
2021-07-15 15:45:31 -04:00
Colin Cross
0523ba2675 Rename ninja variables with Clang in the name
Rename the ninja variables that have an extraneous Clang in the name,
since there are no longer any non-Clang variables.

Bug: 68947919
Test: no change to command lines used to build mmma bionic
Change-Id: I081d5e1d423a66d55faece6cb1d265cd5e504d5f
2021-07-14 20:55:23 -07:00
Colin Cross
33bac24bb9 Remove clang indirection without affecting build.ninja
Remove cflags that are not handled by clang from the global defaults,
and remove calls to ClangFilterUnknownCflags.

Squash lists of clang-specific default flags into the main default
flags lists.

Rename Toolchain.Clang*flags to Toolchain.*flags.

Rename Go variables with Clang in the name that have no non-Clang
equivalent.

Remove unused ninja variables.

Bug: 68947919
Test: no change to build.ninja for aosp_cf_x86_64_phone-userdebug or aosp_crosshatch-userdebug
Change-Id: Id287945315d53e5eaef197adbbb4f1302f2e3680
2021-07-14 20:54:22 -07:00
Paul Duffin
d5cf92e298 Support customizing behavior around sourceOrOutputDependencyTag
Previously, modules customized behavior around the handling of
sourceOrOutputDependencyTag by comparing them to android.SourceDepTag
and retrieving the module using something like this:
    ctx.GetDirectDepWithTag(m, android.SourceDepTag)

The problem with that is it does not allow an output tag to be
specified and does not handle fully qualified names properly.

This adds the following:
* IsSourceDepTag and IsSourceDepTagWithOutputTag to check whether a
  blueprint.DependencyTag is a sourceOrOutputDependencyTag. The latter
  also checks that it has the correct output tag.
* GetModuleFromPathDep(ctx, moduleName, outputTag) as a replacement for
  ctx.GetDirectDepWithTag(m, android.SourceDepTag).

Replaces usages of:
* t == SourceDepTag with IsSourceDepTagWithOutputTag(t, "")
* ctx.GetDirectDepWithTag(m, android.SourceDepTag) with
  GetModuleFromPathDep(ctx, m, "")

It also deprecates the following:
* android.SourcDepTag - as a follow up change needs to modify the
  sourceOrOutputDependencyTag will make this useless.
* ExpandSources, ExpandsSources - copies existing deprecated messages
  from the implementation to the interface so that they can be seen
  by users of that interface.

Bug: 193228441
Test: m nothing
Change-Id: I8c397232b8d7dc1f9702c04ad45ea7819d4631ae
2021-07-09 23:54:01 +01:00
Stephen Crane
0dbfc565f0 [rust] Add android_dylib cfg flag
Adds an android_dylib cfg when building a Rust crate as a dylib. This
cfg lets us make the hack to add a dependency on std for the
panic_handler and eh_personality conditional on actually building a
dylib.

Test: m nothing
Bug: 193087363
Change-Id: Idad5b98245264f916afa327812a435b368f99321
2021-07-07 19:13:08 -07:00
Liz Kammer
187d5445e8 Remove IsDependencyRoot from interface
This is equivalent to Binary() -- reduce the interface and improve
clarity.

Test: go test soong tests
Change-Id: I770f5ce79fd4d888586d31ec5e67be88153626b6
2021-07-07 16:29:09 -04:00
Justin Yun
5e03586365 Include static lib information for the snapshot modules
snapshot modules require the list of static libs to find the NOTICE
files for the snapshot modules.
snapshot binaries must include static_executable property to check if
non static binaries have libc as a static lib.

Bug: 190690041
Test: Check NOTICE for libaudiopreprocessing.so built from snapshots.
Change-Id: I53f7549a158ab27ada87833a3f4d58620aa7c3cf
2021-07-01 11:42:28 +00:00
Ivan Lozano
6eb16f8f87 Merge "rust: Add missing Rust allow path modules." 2021-06-28 19:05:51 +00:00
Ivan Lozano
03a94c48da rust: Add missing Rust allow path modules.
Adds rust_benchmark and rust_fuzz to the list of Rust module types which
need to be in the allowed paths, and a comment about rust_bindgen and
rust_protobuf.

This also adds a downstream allow path list which helps prevent merge
conflicts if downstream wants to extend the list of allowed paths.

Bug: 191507775
Test: Paths are checked for the newly added module types.
Test: Paths in DownstreamRustAllowedPaths allow Rust modules.
Change-Id: Ida80c33a815d47ffdfb1f648125d71316a2a9d8a
2021-06-28 11:59:07 -04:00
Jiyong Park
7d55b61783 Rust module in APEX uses stub libraries across APEX boundaries
This change fixes a bug that rust module in APEX has access to private
symbols of a native library even when the native library is outside of
the APEX.

To fix this, the stub selection logic in the cc package is exctacted as
a function ChooseStubOrImpl and is used also in the rust package.

Bug: 190767845
Test: m
Merged-In: I5c4cbdd5d27f257ab329d9dadbcd87d41a87f46a
Change-Id: I5c4cbdd5d27f257ab329d9dadbcd87d41a87f46a
(cherry picked from commit 3b5f88e091)
2021-06-24 11:27:41 +09:00
Liz Kammer
ef6dfea679 Only store what's used in SharedLibraryInfo
There was a reference to the static library provider, but only the
transitive static deps were used, so only store that part. Other members
were stored but unused anywhere.

Test: go test soong tests
Test: m nothing
Change-Id: I12a6b94806c052c3f0df3cab0a10f17042af1c38
2021-06-08 16:44:23 -04:00
Ivan Lozano
3149e6ed18 Rust rlib vendor snapshot support.
Adds support for snapshotting Rust rlibs. This allows us
vendor-specific code that uses rlib-only linkage until dylib
snapshot support is added.

Bug: 184042776
Test: m nothing # new Soong tests pass
Test: Example test Rust vendor module builds
Test: m dist vendor-snapshot # includes rlibs
Change-Id: I4976d3e1efec0ee778cc97730d45be471dffb678
2021-06-03 08:36:09 -04:00
Ivan Lozano
1921e8003d Rust cdylib/statliclib support for vendor snapshot.
Adds support for platform vendor_available Rust FFI libraries and
binaries to be included in the vendor snapshot.

Because rlib and dylibs are not yet in snapshots, libstd cannot be
included in a vendor snapshot. As a result, vendor-specific Rust code
can't be guaranteed to work with the platform-provided vendor_available
modules built with a newer toolchain. For now, a check is added
indicating vendor-specific Rust code is unsupported.

This changes the linkage for vendor variants of these modules to default
to rlib linkage since dylibs cannot be included in the snapshot yet.

Bug: 184042776
Test: m nothing # new Soong tests pass
Change-Id: I502eaa4bb962eb87ff868fcf49b435f0d2f982e6
2021-06-03 08:32:05 -04:00
Justin Yun
9e13187f6b Fix ExcludeFromVendorSnapshot check
ExcludeFromVendorSnapshot() must return true if the module must not
be snapshotted and built from the vendor source tree.
The default value must be false because rust modules are provided by
the system source tree.

Bug: 184042776
Bug: 189372652
Test: m nothing
Change-Id: I267c3a5674bea966d1dd831cda73538ae94cf25f
2021-05-27 21:27:52 +09:00
Jiyong Park
bf8147ab66 Don't install rust modules that are never installable
rust modules that return false on EverInstallable don't get installed.
Currently, proc_macro modules are such ones.

Bug: 187810017
Test: m microdroid on aosp_arm64 and inspect that *.dylib.so files
from host x86_64 are not there.

Change-Id: Ia57289a04dbff6e4f2ce2733c60de5338305904c
2021-05-17 13:27:20 +09:00
Ivan Lozano
d7586b6526 Refactor vendor snapshot to use LinkableInterface.
Refactors the vendor snapshot support to use the LinkableInterface
so that support can be extended to Rust. This CL does not add
vendor snapshot support for Rust; that is left for a follow-on CL.

Bug: 184042776
Test: m nothing
Change-Id: Id0c4970ca00053484a52677d182153cbc454c301
2021-05-12 14:01:10 -04:00
Hamzeh Zawawy
0a91eab365 Merge "Add support for packaging rust fuzzers" 2021-05-03 16:43:08 +00:00
Treehugger Robot
cbaef6ff0f Merge "Add debug ramdisk variant." 2021-05-02 23:54:40 +00:00
hamzeh
c651b5295b Add support for packaging rust fuzzers
Test: make haiku-rust
Change-Id: Idd4d836d11e0ae615b59c6648d49348449589787
2021-05-01 00:55:42 -07:00
Colin Cross
e07056af41 Merge "Remove global state from vendor public libraries" 2021-04-29 16:16:42 +00:00
Inseob Kim
08758f08e9 Add debug ramdisk variant.
A module will be installed to /debug_ramdisk if debug_ramdisk is set to
true.

This is a reland of f84e9c05e2, with a fix
that removes /first_stage_ramdisk.

Bug: 184004542
Test: soong test
Change-Id: I739de63cfec6b0fec5a90f7c4741fc4d884d209c
2021-04-29 22:58:17 +09:00
Colin Cross
5423a9c513 Merge "Remove obsolete llndk_library" 2021-04-28 23:25:06 +00:00
Treehugger Robot
c0ec1dd962 Merge "Generate rustdoc index." 2021-04-28 15:42:30 +00:00
Dan Albert
b433bf7bed Generate rustdoc index.
Test: m rustdoc
Bug: http://b/162741284
Change-Id: I6e649cbae5e3ce38b43baed5d9623851e519b8d0
2021-04-27 17:12:02 -07:00
Colin Cross
5271fea26c Remove global state from vendor public libraries
Remove the global list of vendor public library modules used to rewrite
dependencies from the vendor module to the stubs for system modules,
and replace it with building the stubs directly in the system variant
of the vendor module.

Bug: 178231622
Test: vendor_public_library_test.go
Change-Id: I826e69ffd507d7e85fa3d4d85b5157428c642143
2021-04-27 16:26:00 -07:00
Colin Cross
203b421043 Remove obsolete llndk_library
Remove llndk_library in favor of cc_library with llndk.symbol_file.

Bug: 170784825
Test: m checkbuild
Test: TestLlndkLibrary
Change-Id: I43580976589a7a2a176d7442be53fa043c0c8324
2021-04-26 18:41:00 -07:00
Colin Cross
627280f091 Remove llndk_headers
Replace llndk_headers with cc_library_headers with
llndk.llndk_headers: true.

Bug: 170784825
Test: m checkbuild
Test: compare out/soong/build.ninja
Test: TestLlndkHeaders
Change-Id: I33b411cd4d474318796c2073375176b82dd8c216
2021-04-26 18:40:53 -07:00
Colin Cross
1f3f130e29 Add support for cc_library_headers to replace llndk_headers
Set llndk.llndk_headers: true to allow a cc_library_headers
module to be used by a cc_library module with llndk.symbol_file set.

Bug: 170784825
Test: TestLlndkHeaders
Change-Id: Ib65a4b70717dc9a54ae30f2991485bb1bb9b8409
2021-04-26 18:37:44 -07:00
Matthew Maurer
5fa13b8457 Merge "Enable overflow checks in Rust" 2021-04-26 20:46:21 +00:00
Ivan Lozano
e934263d18 Merge "rust: Pass additional Clang C flags from toolchain" 2021-04-23 18:13:10 +00:00
Ivan Lozano
871e34290e rust: Pass additional Clang C flags from toolchain
The set of Clang flags passed to bindgen from the toolchain was
incomplete. In addition to ToolchainClangCflags(), we also need to call
ClangCflags().

Bug: 184081465
Test: m libgrpc_bindgen
Change-Id: I0b62345fee2f55ba18b4a0c4d825f0447c99db06
2021-04-23 10:25:35 -04:00
Inseob Kim
aeb6bad073 Revert^3 "Add debug ramdisk variant"
836a8f3d61

Change-Id: If59529238e26a197bc33b10245b88f538f280ed0
2021-04-22 23:14:58 +00:00
Florian Mayer
836a8f3d61 Revert^2 "Add debug ramdisk variant"
78ea2f5eac

Change-Id: I6a6a2ee82e2807045364bab105ec03a1934b411f
2021-04-22 16:38:47 +00:00
Bowgo Tsai
78ea2f5eac Revert "Add debug ramdisk variant"
This reverts commit f84e9c05e2.

Because this breaks the usage of boot-debug.img and
vendor_boot-debug.img

Bug: 185970130
Bug: 185990198
Test: make bootimage_debug
Change-Id: I7886c971982faae1d5bc34688643de8d94d6e201
2021-04-22 09:49:24 +08:00
Treehugger Robot
f9b3e22293 Merge "Remove unnecessary android:"path" tags in rust" 2021-04-21 15:53:44 +00:00
Liz Kammer
eda9398bbf Remove unnecessary android:"path" tags in rust
Custom_bindgen is handled by adding a relevant dependency tag.
Flags and Ld_flags are not paths/references to other modules.

Test: go test soong tests
Change-Id: Ic6a69521102318b3b9f29b59560bcefbc9aff8fa
2021-04-20 16:06:02 +00:00
Treehugger Robot
62b9c5bd99 Merge "[rust] Update clang version used for bindgen" 2021-04-19 20:18:39 +00:00
Treehugger Robot
9bd39fe80d Merge "Rustdoc support." 2021-04-19 19:40:18 +00:00
Pirama Arumuga Nainar
655a7d50f4 [rust] Update clang version used for bindgen
Bug: http://b/185528062

Test: presubmit
Change-Id: I0060643b0dec998d1d4f8da2c504c79223995f98
2021-04-19 10:10:21 -07:00
Treehugger Robot
aef14db78a Merge changes from topic "tvts-test-host-jni"
* changes:
  Add jni_libs property to java tests
  Add Target to cc.SharedLibraryInfo
2021-04-17 04:35:24 +00:00
Dan Albert
06feee9352 Rustdoc support.
Adds `m rustdoc` which generates documentation for all Rust libraries
to $OUT_DIR/soong/rustdoc.

Follow up work:

* Generate an index page that lists all modules.
* Preserve the artifacts so we can have an always-up-to-date go link.

Test: m rustdoc
Bug: None
Change-Id: Id2d6b9cbab5b02e36b575567563d7cc7606b9401
2021-04-16 13:38:01 -07:00
Thiébaud Weksteen
45c647d4dc Merge changes I59439b77,I7dbaf8be
* changes:
  bloaty: measure stripped Rust binaries
  rust: do not strip static library
2021-04-15 18:46:32 +00:00
Thiébaud Weksteen
e4dd14b25f bloaty: measure stripped Rust binaries
Modify bloaty's MeasureSizeForPath to allow a module to provide multiple
paths. This is used to measure both unstripped and stripped
libraries/binaries. Add unit test to ensure correct measurements are
generated for Rust.

Test: m out/soong/binary_sizes.pb.gz
Change-Id: I59439b77dbf1cf5ad71e1c02996a6a90938536b4
2021-04-15 12:02:51 +02:00
Treehugger Robot
638830a5a0 Merge changes from topic "userdebug_plat_sepolicy.cil_Android.bp"
* changes:
  Add debug ramdisk variant
  Add path tests for ramdisk
2021-04-15 05:22:35 +00:00
Inseob Kim
f84e9c05e2 Add debug ramdisk variant
A module will be installed to debug_ramdisk (or
debug_ramdisk/first_stage_ramdisk if recovery as boot is true) if
debug_ramdisk is set to true.

Bug: 184004542
Test: soong test
Change-Id: Ic5a4d27407e506fffa462de2149e0785f11b2ac7
2021-04-15 00:56:30 +00:00
Ivan Lozano
d466b4a1f5 Merge changes from topic "rust_vendor_support"
* changes:
  Add more Rust vendor image support.
  rust: Use new common image mutator interface.
2021-04-14 19:02:49 +00:00
Ivan Lozano
e8dfbdfb59 Merge "cc: Create a common image mutator interface" 2021-04-14 18:53:18 +00:00
Thiébaud Weksteen
4fab05a2ad rust: do not strip static library
Test: m
Change-Id: I7dbaf8be625acae89b0a62ea13d0b250c6542a79
2021-04-14 19:20:07 +02:00
Tri Vo
9e7bfdae31 Merge "rust: Switch rust_fuzz to HWASan" 2021-04-14 16:49:27 +00:00
Jeffrey Vander Stoep
d587ec225a Merge changes from topic "rust_benchmark"
* changes:
  Attach rust_benchmark to atest and tradefed.
  Add rust_benchmark module to soong.
2021-04-14 08:02:46 +00:00
Tri Vo
505b0e8991 rust: Switch rust_fuzz to HWASan
Bug: 180495975
Test: example_rust_fuzzer
Change-Id: I26e6f15136ee2d5f4ed1167be5c1c6a14b19421a
2021-04-13 15:58:44 -07:00
Ivan Lozano
c08897c1e4 Add more Rust vendor image support.
This adds Rust vendor image support for all module types except
Rust prebuilts.

Bug: 184042776
Test: New Soong tests.
Test: Example cc_library vendor module can depend on rust_ffi_shared.
Test: Example rust_library vendor-only module compiles.

Change-Id: Iaa30ad51fdaedcbf14687da5472581f6af62ff59
2021-04-13 13:17:12 -04:00
Ivan Lozano
699e218324 rust: Use new common image mutator interface.
Refactor rust to use and implement the new common image mutator
interface to handle future image mutations.

Bug: 184042776
Test: m nothing
Change-Id: If6a85e2b8c6a1969d62264eaea6c6b53cae9c039
2021-04-13 13:15:21 -04:00
Ivan Lozano
3a7d000d12 cc: Create a common image mutator interface
As part of adding Vendor support to Rust, refactor the image mutator in
CC to a new common image mutator interface so this logic can be reused
across both CC and Rust.

Bug: 184042776
Test: m nothing
Change-Id: Ia55d5ad840db7cf1a64d6c65ed86487230cb8742
2021-04-13 11:04:44 -04:00
Liz Kammer
9c2108667b rust_fuzzer: add toolchain libraries if non-empty
Test: bp2build
Test: m nothing
Fixes: 185163319
Change-Id: Id8b8e5b21b71f949fa8fa27f8c8cc4aba00c1f7d
2021-04-12 18:52:29 -04:00
Tri Vo
eed4716def Merge changes I46e851c8,I2c9eb248
* changes:
  rust: Add HWASan build support
  Export CC HWASan sanitizer type
2021-04-09 22:31:09 +00:00
Ivan Lozano
1285766d3b Merge "rust: Remove stack-depth sancov" 2021-04-09 21:56:51 +00:00
Tri Vo
0a74c3e06e rust: Add HWASan build support
HWASan for static Rust executables is not supported yet.

Bug: 180495975
Test: build local test app with HWASan
Change-Id: I46e851c82a16943586ec3a789f09a58651d036e3
2021-04-09 10:59:23 -07:00
Jeffrey Vander Stoep
3e2d4d419b Merge "Disable clippy::upper-case-acronyms" 2021-04-09 17:48:43 +00:00
Jeffrey Vander Stoep
e9fb49b555 Merge "Rust: use 1.51.0 prebuilts" 2021-04-09 17:48:43 +00:00
Ivan Lozano
20fcfdf489 rust: Remove stack-depth sancov
This flag causes a linkage error between rustc and our libclang_rt. We
can remove it for now and look into reintroducing it in the future.

We'd need to define 'thread_local uintptr_t __sancov_lowest_stack' to
support this. See https://reviews.llvm.org/D36839

Bug: 180495975
Test: m <fuzzer>
Change-Id: I95c9392307b5f20a0eda0fc76eb7ef79e27ae4df
2021-04-09 13:22:27 -04:00
Jiyong Park
a417f881bd Merge "Shared lib dependencies from rlib are included in APEX" 2021-04-08 23:31:28 +00:00
Thiébaud Weksteen
a8ccbaf1e8 Merge "rust: collect file dependencies for clippy" 2021-04-08 13:31:34 +00:00
Jiyong Park
94e22fd35e Shared lib dependencies from rlib are included in APEX
This change fixes a bug that shared lib dependencies of an rlib is not
installed to the APEX even when the rlib is part of the APEX.

Bug: N/A
Test: m
Change-Id: I88fe461584499839d8018d6b4292374592e7562b
2021-04-08 18:20:39 +09:00
Thiébaud Weksteen
e54504e19c Merge "rust: Add cfgs property" 2021-04-08 08:57:22 +00:00
Bram Bonné
2b9ee14ce0 Merge "Allow Rust code in system/logging/rust" 2021-04-08 07:47:45 +00:00
Jiyong Park
84894570e5 Merge "Stripped rust bin/libs are included in APEX" 2021-04-07 17:51:32 +00:00
Thiébaud Weksteen
94c8325261 rust: collect file dependencies for clippy
Previously, the clippy rule did not keep track of the source files for
which a modification would require the target to be rebuilt. Similarly
to the rustc rule, ensure that we capture all the dependencies via the
dep-info output.

Bug: 181298002
Test: m libkeystore2; inspect generated .clippy.d
Change-Id: Icfc7074e1fca38f7782544e6c436ffbfc6c9b4e0
2021-04-07 16:07:47 +02:00
Jiyong Park
e54f07e38a Stripped rust bin/libs are included in APEX
Previously, when a rust bin or library is selected for an APEX,
OutputFile() was used to get the file to be used. However, OutputFile()
always returns the unstripped output file even when the stripped output
file is available. As a result, APEX having a rust module was very big
due to the debugging information that exists in the unstripped file.

When a rust module is directly installed to the built-in partitions, we
use the stripped one whenever it's available. To make the same happen
when the rust module is placed in an APEX, OutputFile() is modified to
return the unstripped output if it's available.

Bug: 181751814
Test: TARGET_BUILD_APPS=com.android.virt m
The size is reduced from 180MB to 43MB

Change-Id: I6f8479e6a4794aac8bf94a84afdf65d417c75db0
2021-04-07 22:23:31 +09:00
Thiébaud Weksteen
c44e7372ed rust: Add cfgs property
Rust configuration options ("--cfg") are currently defined using the
"flags" property. Adds a specific property to be able to forward these
to the rust-analyzer configuration (rust-project.json).

Bug: 183727250
Test: m libstd
Change-Id: Ida89097814bcd1a45c02a8a79ec5a8e9e59701bd
2021-04-07 15:04:10 +02:00
Jakub Kotur
546ccd5614 Attach rust_benchmark to atest and tradefed.
Automatically generate required tradefed configs for rust benchmarks so
that they're available in atest.

Test: atest <module with rust_benchmark defined>
Bug: 155309706
Change-Id: I6002100367a66b6b0555614acc6cebb00dbf435d
2021-04-06 12:40:34 +02:00
Jakub Kotur
1d640d0521 Add rust_benchmark module to soong.
This commit adds rust_benchmark and rust_benchmark_host commands to
soong. Respectively running rust benchmarks on device and host. Currently
only criterion based benchmarks are supported and criterion library is
automatically linked.

Test: atest <module with rust_benchmark defined>
Bug: 155309706
Change-Id: I6edfc2b4bf30b1163fe59b8c2ecdcd4e7125e7b9
2021-04-06 12:40:32 +02:00
Treehugger Robot
8c56183fb7 Merge changes Id33bf640,I4d67b9b9
* changes:
  Don't use incorrect version names like VER or BOARD even in tests
  SdkSpec = Scope + ApiLevel
2021-04-06 03:18:16 +00:00
Joel Galenson
1301b5ccad Merge "Add system/core/libstats to the Rust allowed list." 2021-04-05 18:50:47 +00:00
Ivan Lozano
d235269392 Merge "rust: Update libfuzzer flags for rust_fuzz" 2021-04-05 15:05:00 +00:00
Jiyong Park
f58c46e36f Don't use incorrect version names like VER or BOARD even in tests
All version names will go through ApiLevelFromUser which triggers an
error when the name is not a valid one.

Bug: 175678607
Test: m
Change-Id: Id33bf64085603914d45ad7942cb8908a4734493f
2021-04-05 09:32:06 +09:00
Ivan Lozano
c044f5bce8 rust: Update libfuzzer flags for rust_fuzz
libfuzzer-sys uses different flags in the 0.4.0 update, so update the
flags for rust_fuzz modules to align.

Test: m <example_fuzzer>
Change-Id: I0a1eb140a7843fdaf5266c05a1ecf6d3964e0f5e
2021-04-02 12:43:28 -04:00