diff options
author | 2024-05-13 21:03:34 -0400 | |
---|---|---|
committer | 2024-05-16 13:00:43 -0400 | |
commit | 0a468a4f3b1c9dea9b31ca51cebd3db58d65e771 (patch) | |
tree | 9ee8007e83b660eb7bb4affcbf6584ea3fdab82e /rust/builder_test.go | |
parent | 28ed8f4f83551ca651dd3831eb5b0a23567f5fa6 (diff) |
rust: made-to-order rust staticlibs
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
Diffstat (limited to 'rust/builder_test.go')
-rw-r--r-- | rust/builder_test.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/rust/builder_test.go b/rust/builder_test.go index 639f6d4d4..c093ac4df 100644 --- a/rust/builder_test.go +++ b/rust/builder_test.go @@ -46,6 +46,9 @@ func TestSourceProviderCollision(t *testing.T) { } func TestCompilationOutputFiles(t *testing.T) { + + // Note: Rustdoc output is produced for the PrimaryModule, so if the variant + // order changes, then it may be produced for a different variant. ctx := testRust(t, ` rust_library { name: "libfizz_buzz", @@ -126,6 +129,16 @@ func TestCompilationOutputFiles(t *testing.T) { }, }, { + testName: "rust_ffi rlib", + moduleName: "librust_ffi", + variant: "android_arm64_armv8-a_rlib_rlib-std", + expectedFiles: []string{ + "out/soong/.intermediates/librust_ffi/android_arm64_armv8-a_rlib_rlib-std/librust_ffi.rlib", + "out/soong/.intermediates/librust_ffi/android_arm64_armv8-a_rlib_rlib-std/librust_ffi.rlib.clippy", + "out/soong/.intermediates/librust_ffi/android_arm64_armv8-a_rlib_rlib-std/meta_lic", + }, + }, + { testName: "rust_ffi shared", moduleName: "librust_ffi", variant: "android_arm64_armv8-a_shared", |