Support all combination of static/shared libraries with Rust 1) Rename mixed_source_set/rust_source_set to *_static_library A rust crate produces the equivalent of a C++ static library: It is a set of object files for the sources (but not any deps) which will be linked in the final linking step to produce a shared library or executable. This differs from a C++ source set, which is linked directly into some C++ static library. Rust rlibs are passed along to the "link" or "solink" tool, as seen by the reference to {{rlibs}} in //build/toolchain/gcc_toolchain.gni and described in https://crbug.com/gn/276. 2) Add a test for the mixed_shared_library target type. However the test is currently disabled, because on the bots the .so file is missing from the isolate - we get a file not found for it. 3) Introduce a rust_shared_library type, which is the parallel to the rust_static_library type, along with a test. Similarly, the test is disabled for now but can be manually compiled with the full target name. 4) Export cxx-generated C++ symbols for shared_library targets always, even when not using component build. We ensure this happens by having rust_cxx read invoker.export_symbols. The invoker is the only one who knows if symbols must be exported, because it knows if the cxx bindings are going to be linked into a shared_library or not. Previously it was trying to let the invoker set it but was not doing so correctly. With this, we have a way to make a component, static lib, or shared lib that is either C++, Rust, or mixed C++-and-Rust. R=adetaylor@chromium.org Bug: 1297592 Change-Id: I113a56b1a36cdec98d6dd9bddaa49cf9e5cde12f Cq-Include-Trybots: luci.chromium.try:android-rust-arm-rel,linux-rust-x64-rel Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3496008 Reviewed-by: Adrian Taylor <adetaylor@chromium.org> Commit-Queue: danakj <danakj@chromium.org> Cr-Commit-Position: refs/heads/main@{#976312} NOKEYCHECK=True GitOrigin-RevId: 34e4fb85190a10f2dbce3fb881393a606673c5bc 1 file changed