Update instrument-coverage documentation to document stability and LLVM versions

The instrument-coverage option is stable; the details of the profile
data format are not.

Recommend llvm-tools-preview as the preferred alternative to obtain a
compatible version of the LLVM tools, rather than finding LLVM tools
elsewhere.
This commit is contained in:
Josh Triplett 2021-10-26 13:16:31 +02:00
parent 760c13f48d
commit c840003979
2 changed files with 7 additions and 3 deletions

View file

@ -182,6 +182,10 @@ The default depends on the [opt-level](#opt-level):
This option enables instrumentation-based code coverage support. See the
chapter on [instrumentation-based code coverage] for more information.
Note that while the `-C instrument-coverage` option is stable, the profile data
format produced by the resulting instrumentation may change, and may not work
with coverage tools other than those built and shipped with the compiler.
## link-arg
This flag lets you append a single extra argument to the linker invocation.

View file

@ -117,11 +117,11 @@ If `LLVM_PROFILE_FILE` contains a path to a non-existent directory, the missing
## Installing LLVM coverage tools
LLVM's supplies two tools—`llvm-profdata` and `llvm-cov`—that process coverage data and generate reports. There are several ways to find and/or install these tools, but note that the coverage mapping data generated by the Rust compiler requires LLVM version 12 or higher. (`llvm-cov --version` typically shows the tool's LLVM version number.):
LLVM's supplies two tools—`llvm-profdata` and `llvm-cov`—that process coverage data and generate reports. There are several ways to find and/or install these tools, but note that the coverage mapping data generated by the Rust compiler requires LLVM version 12 or higher, and processing the *raw* data may require exactly the LLVM version used by the compiler. (`llvm-cov --version` typically shows the tool's LLVM version number, and `rustc --verbose --version` shows the version of LLVM used by the Rust compiler.)
- You can install the LLVM tools from your operating system distribution, or from your distribution of LLVM.
- You can install compatible versions of these tools via the `rustup` component `llvm-tools-preview`. This component is the recommended path, though it's still considered experimental. In this case, you may also find `cargo-binutils` useful as a wrapper around these tools.
- You can install a compatible version of LLVM tools from your operating system distribution, or from your distribution of LLVM.
- If you are building the Rust compiler from source, you can optionally use the bundled LLVM tools, built from source. Those tool binaries can typically be found in your build platform directory at something like: `rust/build/x86_64-unknown-linux-gnu/llvm/bin/llvm-*`.
- You can install compatible versions of these tools via the `rustup` component `llvm-tools-preview`, though this is still considered experimental. In this case, you may also find `cargo-binutils` useful as a wrapper around these tools.
The examples in this document show how to use the llvm tools directly.