
TokenPLS:Go 1.26 iOS 仍缺 AES 加速修复,暂用构建期 workaround
TokenPLS 在 sing-box 相关讨论中说明:golang/go#80931 的修复目前只在 Go master,未回传到 release-branch.go1.26,因此 Go 1.26.x 的 GOOS=ios 构建仍走纯 Go 密码实现。在 Go 1.27 普及前,他暂时采用构建期 workaround。详情见下方原文。
作者原文@TokenPLSThanks — I had missed golang/go#80931; good to see it fixed at the source. Two notes for anyone landing here before Go 1.27:
- The fix (golang/go@8058a577) is on master only.
release-branch.go1.26still carries the oldcpu_arm64_other.goconstraint and there is no backport issue, so everyGOOS=iosbuild on Go 1.26.x keeps running AES-GCM/GHASH/SHA-256 in pure Go.- Until then we ship the build-time workaround from this issue. It is public in our kernel repo at
v1.19.30-hako.2:cmd/build_libbox/overlay/internal_cpu_arm64_ios.go.src— the-overlayreplacement. It asserts only AES/PMULL/SHA1/SHA2; Go's fix additionally reads LSE/CRC32/SHA-512/SHA3/DIT through sysctl, which matter far less for tunnel traffic.cmd/build_libbox/apple_cpu_overlay.go— writes the overlay against the toolchain the bind module actually builds with, refuses a GOROOT underGOMODCACHE, injects-overlaythrough agoshim first onPATH(becausesagernet/gomobileoverwritesGOFLAGS), and runsnmon every arm64 iOS-family slice for a marker symbol so a silently ignored overlay fails the build. It also refuses to apply itself once the replaced file no longer selectsios, so it retires by itself on Go 1.27.- Wiring in
cmd/build_libbox/main.go(withAppleCPUOverlay);make lib_applebuilds the xcframework with it.Feel free to close; the upstream fix is the right long-term answer.