AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Informational 18 Bitcoin

Merge bitcoin/bitcoin#31507: build: Use clang-cl to build on Windows natively

Public commit record

What the developer wrote

Authored by merge-script

91/100 · Strong
Merge bitcoin/bitcoin#31507: build: Use clang-cl to build on Windows natively

331902f1dda63b5b8e5e9296f9871c358bf5d2b3 doc: Rename `build-windows-msvc.md` to `build-windows-native.md` (Hennadii Stepanov)
fe2ffef6bc786e515b9fc99a4bf10792b45c6a91 doc: Add clang-cl release notes (Hennadii Stepanov)
4f1e6de6c44790c3abbaf83dfe09947610520e1e cmake: Drop support for the MSVC compiler (cl.exe) (Hennadii Stepanov)
720f381a264f8a136689bd50b29a78482e3b19f7 Couple `BSWAP_CONSTEXPR` definition to bswap implementation (Hennadii Stepanov)
4d7e07035dfd82730b8b1dcb17bee059e6102800 cmake: Adjust diagnostic flags for clang-cl (Hennadii Stepanov)
c4111989e47654db4325fbf3935228bd9385b392 cmake: Link to clang-cl builtins library on Windows (Hennadii Stepanov)
d2645f7ed486718d2af39cf5fc50f46bb8503be9 cmake: Always link `bitcoinqt` to `shlwapi` when building on Windows (Hennadii Stepanov)

Pull request description:

Building on Windows using Clang instead of the MS compiler may be beneficial, considering the issues with the latter, as outlined in https://github.com/bitcoin/bitcoin/issues/31456:

> * non-optimized codegen: [build: remove need to test for endianness #29852 (comment)](https://github.com/bitcoin/bitcoin/pull/29852#issuecomment-2049803970)
>
> * compile failure: [MSVC 17.12.0 internal compiler error #31303](https://github.com/bitcoin/bitcoin/issues/31303)
>
> * ~legal, but brittle stdlib: [util: Drop boost posix_time in ParseISO8601DateTime #31391 (comment)](https://github.com/bitcoin/bitcoin/pull/31391#issuecomment-2510762011)~
>
> * unspecified issue: [refactor: Check translatable format strings at compile-time #31061 (comment)](https://github.com/bitcoin/bitcoin/pull/31061#issuecomment-2531244463)

Additionally, MSVC does not [support](https://learn.microsoft.com/en-us/cpp/assembler/inline/inline-assembler) inline assembly on the ARM and x64 processors.

So this PR:
1. Closes https://github.com/bitcoin/bitcoin/issues/31456 (and addresses https://github.com/bitcoin/bitcoin/issues/14118).
2. Could be an alternative to https://github.com/bitcoin/bitcoin/pull/24773.
3. Closes https://github.com/bitcoin/bitcoin/issues/36153.
---

Additionally, clang-cl:
1. Produces binaries with [better](https://github.com/bitcoin-core/secp256k1/pull/1681) performance. For example:

| MSVC, block/s | clang-cl, block/s | benchmark |
|--------------:|------------------:|:----------|
| 7.40 | 11.52 | `ConnectBlockAllEcdsa`
| 7.32 | 11.81 | `ConnectBlockAllSchnorr`
| 7.38 | 11.45 | `ConnectBlockMixedEcdsaSchnorr`
| 91.86 | 143.12 | `DeserializeAndCheckBlockTest`
| 121.46 | 189.04 | `DeserializeBlockTest`

2. Builds faster on the CI:
- [MSVC](https://github.com/bitcoin/bitcoin/actions/runs/13792522864/job/38575846787) - 20m 35s
- [clang-cl](https://github.com/bitcoin/bitcoin/actions/runs/13792522864/job/38575849680) - 12m 43s

ACKs for top commit:
maflcko:
review ACK 331902f1dda63b5b8e5e9296f9871c358bf5d2b3 😈
hodlinator:
re-ACK 331902f1dda63b5b8e5e9296f9871c358bf5d2b3

Tree-SHA512: f6bad9c98db19952424f7a8789cea74bc5e5e56fe85de151da8c77295d312f98081d88e4e2709603288721a622ccbdc99de0b19044cc955dd5008c9b75943b3d
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit changes Bitcoin Core's Windows build system to use the Clang compiler (clang-cl) instead of Microsoft's own C++ compiler (MSVC/cl.exe). It is a build-toolchain change, not a fix for a security vulnerability in running code. The pull request mentions that MSVC had bugs and missing features, but those are described as development/maintenance problems, not as remotely exploitable flaws. There is no indication this patch fixes an active security issue.

Recommended action

No security response required. Treat as a normal build-system update. Reviewers may want to verify that the new clang-cl CI job and release builds produce bit-identical or otherwise expected binaries, and that the clang_rt.builtins linking does not introduce unexpected runtime dependencies.

Security signals we found

01

Build toolchain migration from MSVC to clang-cl

02

Removal of MSVC-specific non-constexpr byteswap paths

03

Re-enabling of a previously disabled static_assert test

04

No direct runtime vulnerability described in commit or PR

Risk score

Why this scored 18/100

Our methodology →
Potential impact 0/30
Exploitability 0/25
Stealth signal 0/15
Affected reach 5/15
Confidence 9/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.