rust-lang / rust-lang/rust

aarch64-pc-windows-msvc: -Cprofile-generate binary segfaults during PGO training

Open
#156,675 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-LLVM A-PGO needs-triage O-AArch64 O-windows O-windows-msvc
Dominant language
Rust
Stars
119k
Forks
16.2k
PR merge metrics
PR metrics pending

Description

Summary

On aarch64-pc-windows-msvc, a Rust binary built with -Cprofile-generate segfaults during ordinary execution. The same project built as a normal LTO release binary (cargo build --release --locked) runs and self-checks successfully.

This was observed while building release artifacts for https://github.com/vjovanov/grund. The failure looks specific to the PGO-instrumented binary or profiling runtime: the instrumented executable builds successfully, then crashes during the PGO training run. llvm-profdata then reports malformed .profraw files.

I am filing this against rust-lang/rust first because the user-visible trigger is rustc -Cprofile-generate; this may ultimately belong in LLVM/compiler-rt.

Not transient

This reproduced in three separate GitHub Actions runs on windows-11-arm / windows-11-arm64:

  1. Failed release run: https://github.com/vjovanov/grund/actions/runs/26000032777/job/76421409507
  2. Recovery release run, with fallback added after PGO failure: https://github.com/vjovanov/grund/actions/runs/26000896601/job/76423823987
  3. Fresh non-publishing dry-run release to re-check transience: https://github.com/vjovanov/grund/actions/runs/26001277253/job/76424832805

All three runs used:

Image: windows-11-arm64
Image Version: 20260510.38.1
Runner version: 2.334.0
rustc 1.95.0 (59807616e 2026-04-14)
host: aarch64-pc-windows-msvc
LLVM version: 22.1.2

The same PGO pipeline passed on Linux x86_64/aarch64, macOS x86_64/aarch64, and Windows x86_64 in the same workflow runs.

Reproducer

On Windows ARM64 with Git Bash available:

git clone https://github.com/vjovanov/grund.git
cd grund
git checkout v0.2.0

rustup toolchain install 1.95.0-aarch64-pc-windows-msvc
rustup override set 1.95.0
rustup component add llvm-tools-preview

bash scripts/pgo-build.sh

The script does the following:

  1. Builds the binary with RUSTFLAGS=-Cprofile-generate=<target/pgo-data> cargo build --release --locked.
  2. Runs the freshly built target/release/grund.exe against this repository as its PGO training workload.
  3. Merges the generated .profraw files with llvm-profdata.
  4. Rebuilds with -Cprofile-use.

The failure happens in step 2. A more direct manual reduction from the script is:

repo="$PWD"
pgo_dir="$repo/target/pgo-data"
rm -rf "$pgo_dir"
mkdir -p "$pgo_dir"

# On Git Bash, rustc wants a Windows-style profile path.
pgo_dir_rustc="$(cygpath -m "$pgo_dir")"
RUSTFLAGS="-Cprofile-generate=$pgo_dir_rustc" cargo build --release --locked

./target/release/grund.exe list "$repo"

Observed: the instrumented grund.exe segfaults.

Expected: the instrumented binary should run normally and emit valid .profraw profile data, as it does on the other release targets.

CI log excerpts

Fresh dry-run release, run 26001277253:

PGO binary (windows-11-arm) Set up job
Current runner version: '2.334.0'
Runner Image Provisioner Version: 20260415.520
Image: windows-11-arm64
Version: 20260510.38.1

rustc 1.95.0 (59807616e 2026-04-14)
host: aarch64-pc-windows-msvc
LLVM version: 22.1.2

==> 1/3  build instrumented binary (-Cprofile-generate)
Finished `release` profile [optimized] target(s) in 52.76s
==> 2/3  training run — the §AR-benchmarks workload
scripts/pgo-build.sh: line 66:   324 Segmentation fault         "$grund" list "$repo" > /dev/null 2>&1
scripts/pgo-build.sh: line 66:   325 Segmentation fault         "$grund" show FS-check --brief "$repo" > /dev/null 2>&1
scripts/pgo-build.sh: line 66:   326 Segmentation fault         "$grund" show FS-check "$repo" > /dev/null 2>&1
scripts/pgo-build.sh: line 66:   327 Segmentation fault         "$grund" show FS-check --full "$repo" > /dev/null 2>&1
scripts/pgo-build.sh: line 66:   328 Segmentation fault         "$grund" refs GOAL-fast-feedback "$repo" > /dev/null 2>&1
scripts/pgo-build.sh: line 66:   329 Segmentation fault         "$grund" cover "$repo" > /dev/null 2>&1
scripts/pgo-build.sh: line 66:   330 Segmentation fault         "$grund" fmt --check "$repo" > /dev/null 2>&1
scripts/pgo-build.sh: line 66:   331 Segmentation fault         "$grund" check "$repo" > /dev/null 2>&1
...
warning: C:/a/grund/grund/target/pgo-data/default_2211884963031461884_0.profraw: malformed instrumentation profile data: symbol name is empty
error: no profile can be merged

Original failed release, run 26000032777:

Image: windows-11-arm64
Version: 20260510.38.1
rustc 1.95.0 (59807616e 2026-04-14)
host: aarch64-pc-windows-msvc
LLVM version: 22.1.2

==> 2/3  training run — the §AR-benchmarks workload
scripts/pgo-build.sh: line 66:  1286 Segmentation fault         "$grund" list "$repo" > /dev/null 2>&1
scripts/pgo-build.sh: line 66:  1287 Segmentation fault         "$grund" show FS-check --brief "$repo" > /dev/null 2>&1
scripts/pgo-build.sh: line 66:  1288 Segmentation fault         "$grund" show FS-check "$repo" > /dev/null 2>&1
...
warning: C:/a/grund/grund/target/pgo-data/default_15662148217428528836_0.profraw: malformed instrumentation profile data: symbol name is empty
warning: C:/a/grund/grund/target/pgo-data/default_6987841190259789436_0.profraw: malformed instrumentation profile data: symbol name is empty
warning: C:/a/grund/grund/target/pgo-data/default_2211884963031461884_0.profraw: malformed instrumentation profile data: symbol name is empty
error: no profile can be merged

Recovery release, run 26000896601, reproduced the same PGO failure and then succeeded with the workflow's non-PGO fallback:

Image: windows-11-arm64
Version: 20260510.38.1
rustc 1.95.0 (59807616e 2026-04-14)
host: aarch64-pc-windows-msvc
LLVM version: 22.1.2

==> 2/3  training run — the §AR-benchmarks workload
scripts/pgo-build.sh: line 66:  1371 Segmentation fault         "$grund" list "$repo" > /dev/null 2>&1
scripts/pgo-build.sh: line 66:  1372 Segmentation fault         "$grund" show FS-check --brief "$repo" > /dev/null 2>&1
...
warning: C:/a/grund/grund/target/pgo-data/default_15662148217428528836_0.profraw: malformed instrumentation profile data: symbol name is empty
warning: C:/a/grund/grund/target/pgo-data/default_6987841190259789436_0.profraw: malformed instrumentation profile data: symbol name is empty
warning: C:/a/grund/grund/target/pgo-data/default_2211884963031461884_0.profraw: malformed instrumentation profile data: symbol name is empty
error: no profile can be merged

Build LTO release binary fallback:
cargo build --release --locked
Finished `release` profile [optimized] target(s) in 44.33s
Additional notes
  • The repo has no Windows-active unsafe in this path. The only unsafe found is a Unix-only SIGPIPE restore guarded by #[cfg(unix)].
  • The non-PGO fallback binary built immediately after the PGO failure passed the repo self-check in CI.
  • I searched for existing reports in rust-lang/rust and llvm/llvm-project with terms around aarch64-pc-windows-msvc, profile-generate, segfault, malformed instrumentation profile data, and symbol name is empty, and did not find an obvious duplicate.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure on aarch64-pc-windows-msvc using scripts/pgo-build.sh and the direct -Cprofile-generate command in the issue. Compare the instrumented training run with the successful cargo build --release --locked fallback, then inspect the llvm-profdata output. Done means the PGO binary completes training without segfaults and produces valid .profraw data that can be merged.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.