refactor: Add missing explicit instantiations of function templates #37007

Manually merged
hebasto merged 1 commit from 261129-module-local into master 2026-11-30 12:42:46 +00:00 AGit
hebasto commented 2026-11-29 10:18:17 +00:00 (Migrated from github.com)

The SignatureHash and SignatureHashSchnorr function templates are defined in interpreter.cpp but are also used from other translation units, which have relied on implicit instantiations being emitted in that file. The standard does not guarantee that.

This PR adds the missing explicit instantiations. It fixes linker errors (see the nightly builds with libstdc++ and libc++) when building with Clang 24, where module-local optimizer hints are now enabled by default. The change was introduced in https://github.com/llvm/llvm-project/pull/238529.

A successful build of this branch with Clang 24 is available here: https://github.com/hebasto/bitcoin-core-nightly/pull/496.

As a workaround, Clang's previous behavior can be restored with the -fno-module-local-hints flag.

The `SignatureHash` and `SignatureHashSchnorr` function templates are defined in `interpreter.cpp` but are also used from other translation units, which have relied on implicit instantiations being emitted in that file. The standard does not guarantee that. This PR adds the missing explicit instantiations. It fixes linker errors (see the nightly builds with [libstdc++](https://cdash.fish.foo/builds/941/build) and [libc++](https://cdash.fish.foo/builds/951/build)) when building with Clang 24, where module-local optimizer hints are now enabled by default. The change was introduced in https://github.com/llvm/llvm-project/pull/238529. A successful build of this branch with Clang 24 is available here: https://github.com/hebasto/bitcoin-core-nightly/pull/496. As a workaround, Clang's previous behavior can be [restored](https://github.com/hebasto/bitcoin-core-nightly/pull/495) with the `-fno-module-local-hints` flag.
DrahtBot commented 2026-11-29 10:18:27 +00:00 (Migrated from github.com)

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

External sites

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
ACK maflcko, sedited

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

<!--e57a25ab6845829454e8d69fc972939a--> The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. <!--006a51241073e994b41acfe9ec718e94--> ### External sites * Code coverage & benchmarks: https://corecheck.dev/bitcoin/bitcoin/pulls/37007 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/37007.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/37007#author-ralph <!--021abf342d371248e50ceaed478a90ca--> ### Reviews See [the guideline](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#code-review) and [AI policy](https://github.com/bitcoin/bitcoin/blob/master/doc/AI_POLICY.md) for information on the review process. | Type | Reviewers | | ---- | --------- | | ACK | [maflcko](https://github.com/bitcoin/bitcoin/pull/37007#issuecomment-7272540692), [sedited](https://github.com/bitcoin/bitcoin/pull/37007#pullrequestreview-6111339124) | If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore. <!--5faf32d7da4f0f540f40219e4f7537a3-->
First-time contributor

I found no actionable issues in this static review.


Reviewed: 7ec6081ecab2 · Review report · Previous reports

permalink

<!-- forgejo-review-bot:bitcoin/bitcoin --> <!-- ralph-engine:current:312ddb2095238aa2ca395a9cc39b05ab5a38a7177afbdb0d69098df9c3e0bef9:9a7f127b15c6116c267953d38288a9f17ec7c7bcd3a975fb71a2db8bfd974dbf --> <!-- ralph-base:afedb19cca4c3b40d89514fb0c66b0c20e4f5d62 --> <!-- ralph-head:7ec6081ecab27b1ff453f986567b299f7b76d994 --> <!-- ralph-case:90b2f92b6939bc020b32c3d5586b559258e2c9d62028a982b12827271581bfa6 --> I found no actionable issues in this static review. <!-- Review tier: standard --> --- Reviewed: [`7ec6081ecab2`](<https://git.fish.foo/bitcoin/bitcoin/commit/7ec6081ecab27b1ff453f986567b299f7b76d994>) · [Review report](<https://review.fish.foo/report/37007-7ec6081ecab27b1ff453f986567b299f7b76d994-3300-2.html>) · [Previous reports](<https://review.fish.foo/traces/37007/>) [permalink](<https://review.fish.foo/report/37007-7ec6081ecab27b1ff453f986567b299f7b76d994-3300-2.html>)
maflcko (Migrated from github.com) reviewed 2026-11-29 16:13:25 +00:00
maflcko (Migrated from github.com) left a comment

lgtm

lgtm
maflcko (Migrated from github.com) commented 2026-11-29 16:13:17 +00:00

please omit all the arg names completely. IIUC this is the normal C++ pattern and also done so in addrman.cpp

please omit all the arg names completely. IIUC this is the normal C++ pattern and also done so in addrman.cpp
hebasto (Migrated from github.com) reviewed 2026-11-29 16:18:48 +00:00
hebasto (Migrated from github.com) commented 2026-11-29 16:18:48 +00:00

Sure. Reworked.

Sure. Reworked.
maflcko commented 2026-11-30 08:08:54 +00:00 (Migrated from github.com)

review ACK 7ec6081eca 🔌

Show signature

Signature:

untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
trusted comment: review ACK 7ec6081ecab27b1ff453f986567b299f7b76d994 🔌
9lUy5hY+eGEvTXR/DDtw6OKmae2ched8+PofKGfX27atzQxKiioqjQpLAyA94elXx2kgl3uUsIe1QTw97PhUCQ==
review ACK 7ec6081ecab27b1ff453f986567b299f7b76d994 🔌 <details><summary>Show signature</summary> Signature: ``` untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}" RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM= trusted comment: review ACK 7ec6081ecab27b1ff453f986567b299f7b76d994 🔌 9lUy5hY+eGEvTXR/DDtw6OKmae2ched8+PofKGfX27atzQxKiioqjQpLAyA94elXx2kgl3uUsIe1QTw97PhUCQ== ``` </details>
sedited (Migrated from github.com) approved these changes 2026-11-30 11:28:05 +00:00
sedited (Migrated from github.com) left a comment
ACK 7ec6081ecab27b1ff453f986567b299f7b76d994
fanquake commented 2026-11-30 12:45:39 +00:00 (Migrated from github.com)

Backported to 32.x in #36984.

Backported to `32.x` in #36984.
fanquake commented 2026-11-30 12:48:02 +00:00 (Migrated from github.com)

Backported to 31.x in #36928 and 30.x in #36929.

Backported to `31.x` in #36928 and `30.x` in #36929.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitcoin/bitcoin!37007
No description provided.