Age | Commit message (Collapse) | Author |
|
If a cc_library_static has a whole_static dependency against a
rust_ffi_static module, we need to ensure that rust_* dependents of the
cc_library_static don't just throw away the rlibs the cc_library_static
module is intending to include whole (and does so by propagating them
down to dependents to be included in the generated Rust staticlib).
This reuses the plumbing we have in cc to generate a Rust staticlib
from the propagated dependencies.
Bug: 395915782
Test: m rust
Change-Id: I413c8d2476e0b2a1c623581fdbfb5734a62ae455
|
|
This reverts commit ce48f5f396e37516e8f29680f4b5c7071375f2fc.
Reason for revert: Droidmonitor created revert due to b/393452310. Will be verified through ABTD for standarrd investigation.
Change-Id: I6a4ce6bcb23a4c515aba1ef4eb9995d85a5fdda8
|
|
Test: TH
Bug: 289094772
Change-Id: I4221a398a2afd3c83298ee9935634b7a6189f487
|
|
`rustc` added an unstable feature that makes `--extern` do what we
originally wanted - it links the provided library, *even* if the source
code does not reference it.
The primary use case for this is that it makes it possible for us to
build dylibs out of `#![no_std]` crates without modifying the source,
because we can pass in `--extern force:path/to/libstd.dylib.so`.
Bug: 168927099
Test: m, TH
Change-Id: Ibc3b75012d54b73e40ae609784cdc74e02e8f008
|
|
This allows Rust modules to define a version_script for shared library
variants.
This requires using a wrapper for the linker (clang++) to intercept
the flags which rustc emits.
This also adds the ability to export additional symbols in addition
to those exported by rustc by default, e.g. whole_static_library
symbols.
Bug: 314309643
Test: New Soong tests pass.
Test: m
Test: m <simple version script module>
Test: m <simple extra symbols module>
Change-Id: I93c9552e5e1181df4663d194c4df4b7053553dd4
|
|
Some modules may have very long module names. Combined with the
intermediates produced by rustc, this may result in filepaths that are
too long. We can mitigate this somewhat by changing the generated crate
name for the staticlib to not be based on the parent module name.
Bug: 376452102
Test: m blueprint_tests
Test: m
Change-Id: I2d6210d32f7f65ddfa4d1cf1be433c1610b24949
|
|
This CL modifies Soong to pass the `--cfg soong` flag to the rustdoc
tool.
Test: m rustdoc
Bug: 303116432
Change-Id: I089edebe3c0450b9f9d4f97404bafb7e90ed1f8a
|
|
This adds an option to disable LTO when building a Rust module. This is
mostly intended to speedu p local prototyping, and LTO should not
normally be disabled for production builds.
Bug: 339628497
Test: m blueprint_tests && m rust
Change-Id: I21d5d4513a259a56f101ce8906e2bef7404e4efb
|
|
Whenever any two Rust static libraries are included
as static libraries anywhere in a CC dependency tree, we sometimes
get duplicate symbol errors. To avoid this, we no longer
directly link multiple rust static libs to CC modules.
Instead, we build rust_ffi_rlib modules and produce the actual
static library that gets linked against the CC module based on
that CC module's full list of Rust rlib dependencies.
This introduces a new static_rlibs property for cc modules to
define the rust_ffi_rlib dependencies, which are then used to
generate the module above.
This CL is intended to deprecate rust_ffi_static. It leaves
rust_ffi_static and rust_ffi static variants in place until
the remaining rust_ffi_static declarations and uses can be
removed. In the meantime, rust_ffi_static produces
rust_ffi_rlib variants as well to make the transition easier.
Bug: 254469782
Test: m # with no changes
Test: m libapexsupport # with static_rlibs
Test: m libunwindstack # with static_rlibs
Test: m netsimd # with static_rlibs, no duplicate symbols
Test: m blueprint_tests # New Soong tests
Change-Id: I47e27ac967ef0cad46d398ebf59d8275929ae28a
|
|
Refactor transformSrctoCrate and the functions it calls to not rely
on rust.ModuleContext, preparing it to be callable from soong-cc
context to build a Rust staticlib.
This also refactors out common default flags used when building
libraries, again to prepare for building a Rust staticlib from
a soong-cc context.
Bug: 254469782
Test: m blueprint_tests && m
Change-Id: I678f6fee989c61bb15c340b9887e4d1934991907
|
|
Replicate cfeec1c2dd9cab5530952cac961bdd74225525ec in the Clippy rule.
Bug: 333445551
Change-Id: I84134569af0f28730a483f091e6da4c78de83b9c
|
|
Modules with special characters wouldn't build correctly because $out
was being double escaped -- once in the build command and once by Soong
itself.
Remove the escape in the build command and just let Soong escape as
necessary.
Bug: 320578837
Test: Module with @ in name builds
Change-Id: Ic2554b9c07f37783287e1ebdeb06ef8b7b66a296
|
|
This reverts commit e3da5ea86b96d2c489e2ae925975925ecf4f7022.
Reason for revert: b/326108486
Change-Id: Ia99c6024f41f863d7a2a2eaea0567c330c2b1a89
|
|
This reverts commit af9fc549ca6ba53b80813bd16aac4924e716dbe7, reversing
changes made to f617e18741a070ed1ff2bed2074ff98ccd30cb94.
Additionally, patch set #2 adds a fix for b/b/325547632. We should not
pass the `-Z dylib-lto` flag.
Test: m rust
Test: ABTD rialto_test
Bug: https://b.corp.google.com/issues/289094772
Change-Id: I0b7cb62866391968029a23ab2daade28628944ea
|
|
This reverts commit 6146cf4b989f69def35dec62723d50ac2b385e8c.
Reason for revert: <b/325547632>
Change-Id: Ifd3619c5db5b989edb4aa2c37f85e5cd88d0c633
|
|
This CL makes the following changes when building an eng variant to
speed up compilation, possibly at the expense of the performance of the
generated binary:
* Disables LTO
* Enables incremental compilation
* Sets codegen units to 256 to increase parallelism (default set when
enabling incremental compilation)
These changes reduce the time taken to compile all of Android's Rust
code from 16m20s to 12m10s.
Test: lunch aosp_oriole-eng && m clean && m rust
Bug: https://b.corp.google.com/issues/289094772
Change-Id: I97f1675c67ded69120b0c0e0fb5608aa9314a866
|
|
These methods aren't used outside, and probably shouldn't be.
Bug: 309943184
Test: m nothing
Change-Id: Ia7dd5220ccd10c0136aa16f5e21149eaf7a03ea1
|
|
ctx.ModuleDir is much cheaper than android.PathForModuleSrc(ctx).String().
Test: builds
Change-Id: I81819088d9564b06a0336a59a45f2b110b0bd9d6
|
|
aosp/2768553 reverted aosp/2518976, but there was some code that was
moved in between these two commits. This commit removes a code block
for some envvars that were moved in aosp/2638675, and adds back the code
for the ANDROID_RUST_DARWIN envvar.
Change-Id: I9ac09c608fe64340535ac493ab7f07ecb9b9c335
|
|
This CL changes the handling of Rust flags to only pass one of either
incremental or codegen-units. This is necessary because incremental
implies a codegen-units value of 128 and it may be overridden by the
separate codegen-units argument.
Test: TH
Change-Id: Ia474e4f9fc071d5054cb479ec9de550fa886677e
|
|
This reverts commit e7c71c344d462cac998b37d551bd78baa892082d.
The intermediates created by the separated rust compile steps are very
large, on the order of 60GB. This is more than CI can support for now,
revert the split into compile and link phases. This comes at the expense
of incremental build time, especially when modifying C/C++ sources that
are dependencies of rust modules.
Bug: 293349612
Test: builds
Change-Id: I81169e7d0727330c8de5e7688dcdc87fe7b8d3b5
|
|
Prepare for changing rust rules by testing that output file names will
match. A build failure in b/301463284 was partially caused by output paths changing and resulting in old files building up on buildbots which filled the disk. This unit test will ensure that the file paths of rust modules do not change and cause the same failure.
Bug: 301463284
Bug: 286077158
Change-Id: I1baba2c63ad29a2c98e378fce0a2ed32bc319c1e
|
|
Revert submission 2629131-sandbox-rust-inputs
Reason for revert: Fail on android build.
Reverted changes: /q/submissionid:2629131-sandbox-rust-inputs
Change-Id: Ifd9aa46e80a12d8f4ffa0a2daa74b96727cbb7e6
|
|
Revert submission 2758566
Reason for revert: b/301463284
Reverted changes: /q/submissionid:2758566
Change-Id: I54f0ecbbd922deb23009ca89ff79689e128f4f31
|
|
Prebuilt modules for some clang tools were created in aosp/2746469, but they do not exist for darwin builds. Adding the same modules in prebuilts/clang/host/darwin-x86/Android.bp results in duplicate module names. Instead we can just get a path to these files directly in Soong.
Test: CI
Test: https://android-build.googleplex.com/builds/abtd/run/L90700000963131594
Change-Id: I620cfd7b1ab34bd0959feea562d599b963717198
|
|
This commit adds support for compiling rust rules inside the sbox
sandbox. To compile a rust module with sandboxing enabled, the entry
point to the crate must be specified via the `crate_root` property, and
all input sources and compile-time data must be specified via the `srcs`
and `compile_data` properties.
Bug: 286077158
Change-Id: I8c9dc5cf7578037a583b4be2e2f73cf20ffd4408
|
|
- Don't pass `--as-needed` to the linker on Mac OS which is unsupported
there
- Use `--force_load` rather than `--Wl,--whole-archive` on Mac OS
- Scan `rustc`'s linker arguments for `-dylib` and `-dynamiclib`, which
it can use instead of `-shared` on Mac OS:
https://github.com/rust-lang/rust/blob/7bd81ee1902c049691d0a1f03be5558bee51d100/compiler/rustc_codegen_ssa/src/back/linker.rs#L319
Test: m libhalf serde_derive
Bug: 291164566
Change-Id: Iecd6c2532fa31c9476834f49b109de98cbd2dccf
|
|
Add support for CARGO_PKG_VERSION_{MAJOR,MINOR,PATCH}.
Bug: 293602526
Test: m
Test: check build flags for cargo_env_compat module
Change-Id: I6b2796656e3a489cd077c2f42b0bbd04de610ba4
|
|
Test: m rustdoc
Bug: 288151817
Bug: 288129815
Change-Id: I7fbf9eaea243fa2832f3dff717deb7889e0ed17c
|
|
Technically cargo package names and crate names can be different, but
this is rare and usually only a matter of presentation. Adding basic
support in this fashion lets several crates build without adding
significant machinery.
Bug: 276464273
Test: Build a crate which uses this environment variable
Change-Id: I4f4c8c9e277789de7a63be2457f00090e8c3e973
|
|
This CL removes the custom_inner_attributes and mixed_integer_ops
features from the allow-list. This also allows us to remove the `-A
stable-features` flag.
Bug: 267698452
Test: m rust
Change-Id: I4770c2e9477337f112732c354bf477a99d11a467
|
|
Teach rustc to generate object files instead of a linked executable
for binary and shared library crates. This lets us skip the lengthy
Rust compilation phase when only the C++ dependencies of these crates
have changed.
This works using a Python script that replaces the linker invoked by
rustc and converts the linker command line into a rspfile that can be
used during the link phase. The script makes certain assumptions about
how rustc invokes the linker, but since we control the version of Rust
we use, we can update the script if those assumptions ever break. I've
asked the Rust developers about adding an official way to do this so
hopefully we won't need to rely on this hack in the future.
The rustc rule for Kythe has been altered to pass linker=true, somewhat
consistent with the main rustc rule, which now doesn't invoke the actual
linker either. `m xref_rust` still succeeds, but hopefully we can find
someone who knows more about the rest of the Kythe pipeline who can let
us know whether it should still work. Otherwise, let's use this CL as
an opportunity to find out whether the rest of the pipeline is happy
with linker=true, since otherwise we will find it hard to maintain the
Kythe rule in the future.
Change-Id: Ifb9c8689c1bd78c0afcf6fdfd111140d20377536
|
|
|
|
Some Rust crates with no src_deps have generated files checked in in an
"out" subdirectory and included via a reference to $OUT_DIR, such as
external/rust/crates/userfaultfd-sys.
Astonishingly, some people must be leaving $OUT_DIR set to the default
value of "out", because with $OUT_DIR set to this value, building these
crates would presumably succeed. For everyone else, the build fails
when building one of these crates because it will attempt to load from
the wrong directory. Presumably these crates should be using src_deps
instead (and once that's fixed, we should probably *unset* $OUT_DIR in
rustc invocations to prevent the same thing from happening again), but
for now, fix the build with non-default OUT_DIR by explicitly setting
OUT_DIR to "out" if there are no src_deps.
Change-Id: I09f99424fc01a1e42e910622c77ab8f7312819bd
|
|
This CL removes the `default_alloc_error_handler` feature from the
allowed feature set passed to rustc. This feature was stabilized in
Rust 1.68.0 and now that that has been deployed we can remove the
feature annotations from our codebase.
Bug: 267698452
Test: m rust
Change-Id: Ifc543ec83d3221cc8bcb6c83658abe09696b51ea
|
|
The library file for a cc_shared_library dependency is added to the linkFlags of the rustc compilation action, but no explicit dependency was made on it from a Ninja perspective if a TOC was also present. This change adds the explicit dependency on the library file whether or not a TOC is present.
Test: m crosvm
Bug: 275416061
Change-Id: I625b62762d9ba7b4fd2b8362285528e47f728dd4
|
|
Test: m rust
Test: TH
Bug: 267698452
Change-Id: Ida4f4889d036392518639ce976d82ce6f19db1fd
|
|
Test: m rust
Test: TH
Change-Id: I2257fe9fce1457821a5cf7df644c73f3137a62bb
|
|
This CL adds a set of allowed unstable featuers for Rust code. The goal
is to get this down to an empty list.
Bug: 267698452
Test: m rust
Change-Id: I09e61bf19594101f064bdf67dc81c3b4d1236266
|
|
Test: m rustdoc
Change-Id: I25599845b2bec76d92fd325b62132aeac9dd74c4
|
|
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
|
|
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
|
|
* changes:
Support building rust modules against musl libc
Support genrules as CrtBegin and CrtEnd in rust
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
|
|
Bug: 195134194
Bug: 165018530
Test: build
Change-Id: I30932a22dc0b22716cdc925a3fcc5f9a169fcec4
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|