diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2021-12-01 10:50:20 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-01 10:50:20 +0100 |
| commit | d93df5775cbbd076bf438a4063c5c98a6293addf (patch) | |
| tree | b7471352a41558a6110108957bd3952a863572a6 /src/doc | |
| parent | 2695e85c09cc70736c0e473d640bcfbf03055f46 (diff) | |
| parent | 0c57fab5fcd19244df6fa946bb504ce0601b29d1 (diff) | |
| download | rust-d93df5775cbbd076bf438a4063c5c98a6293addf.tar.gz rust-d93df5775cbbd076bf438a4063c5c98a6293addf.zip | |
Rollup merge of #91207 - richkadel:rk-bump-coverage-version, r=tmandry
Add support for LLVM coverage mapping format versions 5 and 6 This PR cherry-pick's Swatinem's initial commit in unsubmitted PR #90047. My additional commit augments Swatinem's great starting point, but adds full support for LLVM Coverage Mapping Format version 6, conditionally, if compiling with LLVM 13. Version 6 requires adding the compilation directory when file paths are relative, and since Rustc coverage maps use relative paths, we should add the expected compilation directory entry. Note, however, that with the compilation directory, coverage reports from `llvm-cov show` can now report file names (when the report includes more than one file) with the full absolute path to the file. This would be a problem for test results, but the workaround (for the rust coverage tests) is to include an additional `llvm-cov show` parameter: `--compilation-dir=.`
Diffstat (limited to 'src/doc')
| -rw-r--r-- | src/doc/unstable-book/src/compiler-flags/instrument-coverage.md | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/doc/unstable-book/src/compiler-flags/instrument-coverage.md b/src/doc/unstable-book/src/compiler-flags/instrument-coverage.md index f7c2a26f018..f4d1ca0ec69 100644 --- a/src/doc/unstable-book/src/compiler-flags/instrument-coverage.md +++ b/src/doc/unstable-book/src/compiler-flags/instrument-coverage.md @@ -20,7 +20,7 @@ This document describes how to enable and use the LLVM instrumentation-based cov When `-Z instrument-coverage` is enabled, the Rust compiler enhances rust-based libraries and binaries by: - Automatically injecting calls to an LLVM intrinsic ([`llvm.instrprof.increment`]), at functions and branches in compiled code, to increment counters when conditional sections of code are executed. -- Embedding additional information in the data section of each library and binary (using the [LLVM Code Coverage Mapping Format] _Version 4_, supported _only_ in LLVM 11 and up), to define the code regions (start and end positions in the source code) being counted. +- Embedding additional information in the data section of each library and binary (using the [LLVM Code Coverage Mapping Format] _Version 5_, if compiling with LLVM 12, or _Version 6_, if compiling with LLVM 13 or higher), to define the code regions (start and end positions in the source code) being counted. When running a coverage-instrumented program, the counter values are written to a `profraw` file at program termination. LLVM bundles tools that read the counter results, combine those results with the coverage map (embedded in the program binary), and generate coverage reports in multiple formats. @@ -123,7 +123,7 @@ 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 11 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. (`llvm-cov --version` typically shows the tool's LLVM version number.): - The LLVM tools may be installed (or installable) directly to your OS (such as via `apt-get`, for Linux). - 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-*`. |
