Declare the clobbers mbedtls's x86-64 multiply asm lacks, so a clang-built hactool verifies signatures.

hactool's bundled mbedtls 2.6.1 adds into memory and changes the flags in its MULADDC asm without saying so. gcc builds
happen to work; clang, the Linux release's compiler, keeps values in registers across it at -O1 and above, so every RSA
check failed (NCA header, NPDM, ACID) and the AppImage's setup stopped at the update merge. Found by installing from the
mounted AppImage; a bisection of the mbedtls objects pointed at bignum.o, and the memory and cc clobbers (as later
mbedtls releases have them) fix it. With the patch the full install from the AppImage completes and the game runs.
This commit is contained in:
Wellington Dias committed 2026-10-30 14:28:35 -03:00
1 parent aa030e4e28
commit 89b5126da0
4 files changed
+26 -4

No files matched your search

+4 -2
View File
@@ -37,13 +37,15 @@ PATH:
### hactool
`tools/build_hactool.py` fetches SciresM/hactool at `1d64a83` into `toolchain\src\hactool`, applies the two patches in
`tools/build_hactool.py` fetches SciresM/hactool at `1d64a83` into `toolchain\src\hactool`, applies the three patches in
`tools/hactool/` and builds a static `toolchain\hactool\hactool.exe` with MSYS2 UCRT64 gcc (a few seconds):
- `portable.patch`: the parts of MacNativeGames' `build_hactool()` that run on Windows, the `MNG_TITLE_KEYS` variable and
the two BKTR fixes in `nca.c` for the subsection table padding and the subsection layout of newer cumulative updates;
- `unicode.patch`: a manifest with `<activeCodePage>UTF-8</activeCodePage>`, so paths under a non-ASCII user profile
reach it intact.
reach it intact;
- `mbedtls-asm-clobbers.patch`: the `memory` and `cc` clobbers the bundled mbedtls 2.6.1's x86-64 multiply asm lacks.
Without them a clang build (the Linux release) fails every RSA signature check and the update merge stops.
hactool reads `-k <prod.keys>`; MSYS2 shells set `HOME`, which hides its default key location, so pass `-k` there.