Commit graph

547 commits

Author SHA1 Message Date
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
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