diff --git a/eng/doc/NocgoOpenSSL.md b/eng/doc/NocgoOpenSSL.md index 67fee33f76..059576f779 100644 --- a/eng/doc/NocgoOpenSSL.md +++ b/eng/doc/NocgoOpenSSL.md @@ -21,6 +21,7 @@ Currently this experiment is supported on the following architectures: - **amd64** - arm - **arm64** +- loong64 - ppc64le - riscv64 - s390x (added in Go 1.27) diff --git a/patches/0001-Vendor-external-dependencies.patch b/patches/0001-Vendor-external-dependencies.patch index 92b8f5c709..2b4156f9af 100644 --- a/patches/0001-Vendor-external-dependencies.patch +++ b/patches/0001-Vendor-external-dependencies.patch @@ -62,11 +62,13 @@ Use a 'go' that was recently built by the current branch to ensure stable result .../github.com/golang-fips/openssl/v2/hmac.go | 282 ++ .../openssl/v2/internal/fakecgo/abi_amd64.h | 99 + .../openssl/v2/internal/fakecgo/abi_arm64.h | 39 + + .../openssl/v2/internal/fakecgo/abi_loong64.h | 60 + .../openssl/v2/internal/fakecgo/abi_ppc64x.h | 195 ++ .../openssl/v2/internal/fakecgo/asm_386.s | 29 + .../openssl/v2/internal/fakecgo/asm_amd64.s | 39 + .../openssl/v2/internal/fakecgo/asm_arm.s | 52 + .../openssl/v2/internal/fakecgo/asm_arm64.s | 36 + + .../openssl/v2/internal/fakecgo/asm_loong64.s | 40 + .../openssl/v2/internal/fakecgo/asm_ppc64le.s | 82 + .../openssl/v2/internal/fakecgo/asm_riscv64.s | 78 + .../openssl/v2/internal/fakecgo/asm_s390x.s | 55 + @@ -89,6 +91,7 @@ Use a 'go' that was recently built by the current branch to ensure stable result .../v2/internal/fakecgo/trampolines_amd64.s | 107 + .../v2/internal/fakecgo/trampolines_arm.s | 81 + .../v2/internal/fakecgo/trampolines_arm64.s | 84 + + .../v2/internal/fakecgo/trampolines_loong64.s | 88 + .../v2/internal/fakecgo/trampolines_ppc64le.s | 227 ++ .../v2/internal/fakecgo/trampolines_riscv64.s | 72 + .../v2/internal/fakecgo/trampolines_s390x.s | 163 ++ @@ -101,6 +104,7 @@ Use a 'go' that was recently built by the current branch to ensure stable result .../fakecgo/ztrampolines_linux_amd64.s | 102 + .../internal/fakecgo/ztrampolines_linux_arm.s | 74 + .../fakecgo/ztrampolines_linux_arm64.s | 93 + + .../fakecgo/ztrampolines_linux_loong64.s | 92 + .../fakecgo/ztrampolines_linux_ppc64le.s | 101 + .../fakecgo/ztrampolines_linux_riscv64.s | 92 + .../fakecgo/ztrampolines_linux_s390x.s | 90 + @@ -109,6 +113,7 @@ Use a 'go' that was recently built by the current branch to ensure stable result .../openssl/v2/internal/ossl/asm_amd64.s | 120 + .../openssl/v2/internal/ossl/asm_arm.s | 104 + .../openssl/v2/internal/ossl/asm_arm64.s | 97 + + .../openssl/v2/internal/ossl/asm_loong64.s | 116 + .../openssl/v2/internal/ossl/asm_others.s | 7 + .../openssl/v2/internal/ossl/asm_ppc64le.s | 141 + .../openssl/v2/internal/ossl/asm_riscv64.s | 109 + @@ -272,7 +277,7 @@ Use a 'go' that was recently built by the current branch to ensure stable result .../internal/subtle/aliasing.go | 32 + .../internal/sysdll/sys_windows.go | 55 + src/vendor/modules.txt | 23 + - 264 files changed, 33701 insertions(+), 7 deletions(-) + 269 files changed, 34097 insertions(+), 7 deletions(-) create mode 100644 src/cmd/internal/telemetry/counter/deps_ignore.go create mode 100644 src/cmd/vendor/github.com/microsoft/go-infra/telemetry/LICENSE create mode 100644 src/cmd/vendor/github.com/microsoft/go-infra/telemetry/README.md @@ -320,11 +325,13 @@ Use a 'go' that was recently built by the current branch to ensure stable result create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/hmac.go create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/abi_amd64.h create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/abi_arm64.h + create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/abi_loong64.h create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/abi_ppc64x.h create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/asm_386.s create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/asm_amd64.s create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/asm_arm.s create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/asm_arm64.s + create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/asm_loong64.s create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/asm_ppc64le.s create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/asm_riscv64.s create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/asm_s390x.s @@ -347,6 +354,7 @@ Use a 'go' that was recently built by the current branch to ensure stable result create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/trampolines_amd64.s create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/trampolines_arm.s create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/trampolines_arm64.s + create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/trampolines_loong64.s create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/trampolines_ppc64le.s create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/trampolines_riscv64.s create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/trampolines_s390x.s @@ -359,6 +367,7 @@ Use a 'go' that was recently built by the current branch to ensure stable result create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/ztrampolines_linux_amd64.s create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/ztrampolines_linux_arm.s create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/ztrampolines_linux_arm64.s + create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/ztrampolines_linux_loong64.s create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/ztrampolines_linux_ppc64le.s create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/ztrampolines_linux_riscv64.s create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/ztrampolines_linux_s390x.s @@ -367,6 +376,7 @@ Use a 'go' that was recently built by the current branch to ensure stable result create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/ossl/asm_amd64.s create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/ossl/asm_arm.s create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/ossl/asm_arm64.s + create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/ossl/asm_loong64.s create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/ossl/asm_others.s create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/ossl/asm_ppc64le.s create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/internal/ossl/asm_riscv64.s @@ -2203,7 +2213,7 @@ index 00000000000000..ae4055d2d71303 +// that are used by the backend package. This allows to track +// their versions in a single patch file. diff --git a/src/go.mod b/src/go.mod -index d6c515017a7009..d7839b1f9b0e8d 100644 +index d6c515017a7009..15ab996b3e47e5 100644 --- a/src/go.mod +++ b/src/go.mod @@ -11,3 +11,9 @@ require ( @@ -2212,17 +2222,17 @@ index d6c515017a7009..d7839b1f9b0e8d 100644 ) + +require ( -+ github.com/golang-fips/openssl/v2 v2.0.4-0.20260216103108-5ebb75d331c1 ++ github.com/golang-fips/openssl/v2 v2.0.4-0.20260217140351-4e237614ceb4 + github.com/microsoft/go-crypto-darwin v0.0.3-0.20260130143703-78cb726ef357 + github.com/microsoft/go-crypto-winnative v0.0.0-20260127024749-832b168a84e9 +) diff --git a/src/go.sum b/src/go.sum -index 2223d2a7c231c1..2c22d474c24c7f 100644 +index 2223d2a7c231c1..11a1b9af830278 100644 --- a/src/go.sum +++ b/src/go.sum @@ -1,3 +1,9 @@ -+github.com/golang-fips/openssl/v2 v2.0.4-0.20260216103108-5ebb75d331c1 h1:GaJ5M4Mic8ZElJ9YLxhphlCjLy0Cy+2QB8/O40GKF8s= -+github.com/golang-fips/openssl/v2 v2.0.4-0.20260216103108-5ebb75d331c1/go.mod h1:EtVnMfLGkB4pihGOH+tXEV0WlXxewWdT1n3GLJEHvpw= ++github.com/golang-fips/openssl/v2 v2.0.4-0.20260217140351-4e237614ceb4 h1:2kbDvyeg2zT1dsjfp6I445SCP4ryK88vnIODU+x0W3o= ++github.com/golang-fips/openssl/v2 v2.0.4-0.20260217140351-4e237614ceb4/go.mod h1:EtVnMfLGkB4pihGOH+tXEV0WlXxewWdT1n3GLJEHvpw= +github.com/microsoft/go-crypto-darwin v0.0.3-0.20260130143703-78cb726ef357 h1:ILqgGD8SGjjtSweSBanrXyX8Aco33yFSJEqsnJgmXHU= +github.com/microsoft/go-crypto-darwin v0.0.3-0.20260130143703-78cb726ef357/go.mod h1:MTii5PQwRlfUjYpGoF8CPLGwXSHTbLHGRN9FVNML5N0= +github.com/microsoft/go-crypto-winnative v0.0.0-20260127024749-832b168a84e9 h1:joliMChkkfHV3vAPKzu9kefdw0K+d89A8r9gTm3MFS4= @@ -7288,6 +7298,72 @@ index 00000000000000..5d5061ec1dbf8c + FLDPD ((offset)+2*8)(RSP), (F10, F11) \ + FLDPD ((offset)+4*8)(RSP), (F12, F13) \ + FLDPD ((offset)+6*8)(RSP), (F14, F15) +diff --git a/src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/abi_loong64.h b/src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/abi_loong64.h +new file mode 100644 +index 00000000000000..b10d83732f1c6e +--- /dev/null ++++ b/src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/abi_loong64.h +@@ -0,0 +1,60 @@ ++// Copyright 2022 The Go Authors. All rights reserved. ++// Use of this source code is governed by a BSD-style ++// license that can be found in the LICENSE file. ++ ++// Macros for transitioning from the host ABI to Go ABI0. ++// ++// These macros save and restore the callee-saved registers ++// from the stack, but they don't adjust stack pointer, so ++// the user should prepare stack space in advance. ++// SAVE_R22_TO_R31(offset) saves R22 ~ R31 to the stack space ++// of ((offset)+0*8)(R3) ~ ((offset)+9*8)(R3). ++// ++// SAVE_F24_TO_F31(offset) saves F24 ~ F31 to the stack space ++// of ((offset)+0*8)(R3) ~ ((offset)+7*8)(R3). ++// ++// Note: g is R22 ++ ++#define SAVE_R22_TO_R31(offset) \ ++ MOVV g, ((offset)+(0*8))(R3) \ ++ MOVV R23, ((offset)+(1*8))(R3) \ ++ MOVV R24, ((offset)+(2*8))(R3) \ ++ MOVV R25, ((offset)+(3*8))(R3) \ ++ MOVV R26, ((offset)+(4*8))(R3) \ ++ MOVV R27, ((offset)+(5*8))(R3) \ ++ MOVV R28, ((offset)+(6*8))(R3) \ ++ MOVV R29, ((offset)+(7*8))(R3) \ ++ MOVV R30, ((offset)+(8*8))(R3) \ ++ MOVV R31, ((offset)+(9*8))(R3) ++ ++#define SAVE_F24_TO_F31(offset) \ ++ MOVD F24, ((offset)+(0*8))(R3) \ ++ MOVD F25, ((offset)+(1*8))(R3) \ ++ MOVD F26, ((offset)+(2*8))(R3) \ ++ MOVD F27, ((offset)+(3*8))(R3) \ ++ MOVD F28, ((offset)+(4*8))(R3) \ ++ MOVD F29, ((offset)+(5*8))(R3) \ ++ MOVD F30, ((offset)+(6*8))(R3) \ ++ MOVD F31, ((offset)+(7*8))(R3) ++ ++#define RESTORE_R22_TO_R31(offset) \ ++ MOVV ((offset)+(0*8))(R3), g \ ++ MOVV ((offset)+(1*8))(R3), R23 \ ++ MOVV ((offset)+(2*8))(R3), R24 \ ++ MOVV ((offset)+(3*8))(R3), R25 \ ++ MOVV ((offset)+(4*8))(R3), R26 \ ++ MOVV ((offset)+(5*8))(R3), R27 \ ++ MOVV ((offset)+(6*8))(R3), R28 \ ++ MOVV ((offset)+(7*8))(R3), R29 \ ++ MOVV ((offset)+(8*8))(R3), R30 \ ++ MOVV ((offset)+(9*8))(R3), R31 ++ ++#define RESTORE_F24_TO_F31(offset) \ ++ MOVD ((offset)+(0*8))(R3), F24 \ ++ MOVD ((offset)+(1*8))(R3), F25 \ ++ MOVD ((offset)+(2*8))(R3), F26 \ ++ MOVD ((offset)+(3*8))(R3), F27 \ ++ MOVD ((offset)+(4*8))(R3), F28 \ ++ MOVD ((offset)+(5*8))(R3), F29 \ ++ MOVD ((offset)+(6*8))(R3), F30 \ ++ MOVD ((offset)+(7*8))(R3), F31 diff --git a/src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/abi_ppc64x.h b/src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/abi_ppc64x.h new file mode 100644 index 00000000000000..245a5266f6e9fa @@ -7669,6 +7745,52 @@ index 00000000000000..50e5261d922c56 + + ADD $(8*24), RSP + RET +diff --git a/src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/asm_loong64.s b/src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/asm_loong64.s +new file mode 100644 +index 00000000000000..e81df86a56e4ad +--- /dev/null ++++ b/src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/asm_loong64.s +@@ -0,0 +1,40 @@ ++// Copyright 2022 The Go Authors. All rights reserved. ++// Use of this source code is governed by a BSD-style ++// license that can be found in the LICENSE file. ++ ++#include "textflag.h" ++#include "abi_loong64.h" ++ ++// Called by C code generated by cmd/cgo. ++// func crosscall2(fn, a unsafe.Pointer, n int32, ctxt uintptr) ++// Saves C callee-saved registers and calls cgocallback with three arguments. ++// fn is the PC of a func(a unsafe.Pointer) function. ++TEXT crosscall2(SB), NOSPLIT|NOFRAME, $0 ++/* ++ * We still need to save all callee save register as before, and then ++ * push 3 args for fn (R4, R5, R7), skipping R6. ++ * Also note that at procedure entry in gc world, 8(R29) will be the ++ * first arg. ++ */ ++ ++ ADDV $(-23*8), R3 ++ MOVV R4, (1*8)(R3) // fn unsafe.Pointer ++ MOVV R5, (2*8)(R3) // a unsafe.Pointer ++ MOVV R7, (3*8)(R3) // ctxt uintptr ++ ++ SAVE_R22_TO_R31((4*8)) ++ SAVE_F24_TO_F31((14*8)) ++ MOVV R1, (22*8)(R3) ++ ++ // Initialize Go ABI environment ++ JAL runtime·load_g(SB) ++ ++ JAL runtime·cgocallback(SB) ++ ++ RESTORE_R22_TO_R31((4*8)) ++ RESTORE_F24_TO_F31((14*8)) ++ MOVV (22*8)(R3), R1 ++ ++ ADDV $(23*8), R3 ++ ++ RET diff --git a/src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/asm_ppc64le.s b/src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/asm_ppc64le.s new file mode 100644 index 00000000000000..6d1938cd8d8bcd @@ -8996,6 +9118,100 @@ index 00000000000000..ddd01434d04cda + CALL R9 + MOVD R0, ret+48(FP) + RET +diff --git a/src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/trampolines_loong64.s b/src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/trampolines_loong64.s +new file mode 100644 +index 00000000000000..89bf8813bade7a +--- /dev/null ++++ b/src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/trampolines_loong64.s +@@ -0,0 +1,88 @@ ++// SPDX-License-Identifier: Apache-2.0 ++// SPDX-FileCopyrightText: 2025 The Ebitengine Authors ++ ++//go:build !cgo && (darwin || linux) ++ ++#include "textflag.h" ++#include "go_asm.h" ++#include "abi_loong64.h" ++ ++// these trampolines map the gcc ABI to Go ABI and then calls into the Go equivalent functions. ++// R23 is used as temporary register. ++ ++TEXT x_cgo_init_trampoline(SB), NOSPLIT, $16 ++ MOVV R4, 8(R3) ++ MOVV R5, 16(R3) ++ MOVV ·x_cgo_init_call(SB), R23 ++ MOVV (R23), R23 ++ CALL (R23) ++ RET ++ ++TEXT x_cgo_thread_start_trampoline(SB), NOSPLIT, $8 ++ MOVV R4, 8(R3) ++ MOVV ·x_cgo_thread_start_call(SB), R23 ++ MOVV (R23), R23 ++ CALL (R23) ++ RET ++ ++TEXT x_cgo_setenv_trampoline(SB), NOSPLIT, $8 ++ MOVV R4, 8(R3) ++ MOVV ·x_cgo_setenv_call(SB), R23 ++ MOVV (R23), R23 ++ CALL (R23) ++ RET ++ ++TEXT x_cgo_unsetenv_trampoline(SB), NOSPLIT, $8 ++ MOVV R4, 8(R3) ++ MOVV ·x_cgo_unsetenv_call(SB), R23 ++ MOVV (R23), R23 ++ CALL (R23) ++ RET ++ ++TEXT x_cgo_notify_runtime_init_done_trampoline(SB), NOSPLIT, $0 ++ CALL ·x_cgo_notify_runtime_init_done(SB) ++ RET ++ ++TEXT x_cgo_bindm_trampoline(SB), NOSPLIT, $0 ++ CALL ·x_cgo_bindm(SB) ++ RET ++ ++// func setg_trampoline(setg uintptr, g uintptr) ++TEXT ·setg_trampoline(SB), NOSPLIT, $0 ++ MOVV G+8(FP), R4 ++ MOVV setg+0(FP), R23 ++ CALL (R23) ++ RET ++ ++TEXT threadentry_trampoline(SB), NOSPLIT, $0 ++ // See crosscall2. ++ ADDV $(-23*8), R3 ++ MOVV R4, (1*8)(R3) // fn unsafe.Pointer ++ MOVV R5, (2*8)(R3) // a unsafe.Pointer ++ MOVV R7, (3*8)(R3) // ctxt uintptr ++ ++ SAVE_R22_TO_R31((4*8)) ++ SAVE_F24_TO_F31((14*8)) ++ MOVV R1, (22*8)(R3) ++ ++ MOVV ·threadentry_call(SB), R23 ++ MOVV (R23), R23 ++ CALL (R23) ++ ++ RESTORE_R22_TO_R31((4*8)) ++ RESTORE_F24_TO_F31((14*8)) ++ MOVV (22*8)(R3), R1 ++ ++ ADDV $(23*8), R3 ++ RET ++ ++TEXT ·call5(SB), NOSPLIT, $0-0 ++ MOVV fn+0(FP), R23 ++ MOVV a1+8(FP), R4 ++ MOVV a2+16(FP), R5 ++ MOVV a3+24(FP), R6 ++ MOVV a4+32(FP), R7 ++ MOVV a5+40(FP), R8 ++ CALL (R23) ++ MOVV R4, ret+48(FP) ++ RET diff --git a/src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/trampolines_ppc64le.s b/src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/trampolines_ppc64le.s new file mode 100644 index 00000000000000..586ccaf91df1a4 @@ -10462,6 +10678,104 @@ index 00000000000000..0b25425c004d38 +TEXT _setgroups(SB), NOSPLIT, $0-0 + JMP purego_setgroups(SB) + +diff --git a/src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/ztrampolines_linux_loong64.s b/src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/ztrampolines_linux_loong64.s +new file mode 100644 +index 00000000000000..3c8a0d64e659fa +--- /dev/null ++++ b/src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/ztrampolines_linux_loong64.s +@@ -0,0 +1,92 @@ ++// Code generated by 'go generate' with gen.go. DO NOT EDIT. ++ ++// SPDX-License-Identifier: Apache-2.0 ++// SPDX-FileCopyrightText: 2022 The Ebitengine Authors ++ ++//go:build !cgo ++ ++#include "textflag.h" ++ ++TEXT ___errno_location(SB), NOSPLIT, $0-0 ++ JMP purego___errno_location(SB) ++ ++TEXT _cgo_purego_setegid_trampoline(SB), NOSPLIT, $0 ++ MOVV ·x_cgo_purego_setegid_call(SB), R23 ++ MOVV (R23), R23 ++ CALL (R23) ++ RET ++ ++TEXT _setegid(SB), NOSPLIT, $0-0 ++ JMP purego_setegid(SB) ++ ++TEXT _cgo_purego_seteuid_trampoline(SB), NOSPLIT, $0 ++ MOVV ·x_cgo_purego_seteuid_call(SB), R23 ++ MOVV (R23), R23 ++ CALL (R23) ++ RET ++ ++TEXT _seteuid(SB), NOSPLIT, $0-0 ++ JMP purego_seteuid(SB) ++ ++TEXT _cgo_purego_setgid_trampoline(SB), NOSPLIT, $0 ++ MOVV ·x_cgo_purego_setgid_call(SB), R23 ++ MOVV (R23), R23 ++ CALL (R23) ++ RET ++ ++TEXT _setgid(SB), NOSPLIT, $0-0 ++ JMP purego_setgid(SB) ++ ++TEXT _cgo_purego_setregid_trampoline(SB), NOSPLIT, $0 ++ MOVV ·x_cgo_purego_setregid_call(SB), R23 ++ MOVV (R23), R23 ++ CALL (R23) ++ RET ++ ++TEXT _setregid(SB), NOSPLIT, $0-0 ++ JMP purego_setregid(SB) ++ ++TEXT _cgo_purego_setresgid_trampoline(SB), NOSPLIT, $0 ++ MOVV ·x_cgo_purego_setresgid_call(SB), R23 ++ MOVV (R23), R23 ++ CALL (R23) ++ RET ++ ++TEXT _setresgid(SB), NOSPLIT, $0-0 ++ JMP purego_setresgid(SB) ++ ++TEXT _cgo_purego_setresuid_trampoline(SB), NOSPLIT, $0 ++ MOVV ·x_cgo_purego_setresuid_call(SB), R23 ++ MOVV (R23), R23 ++ CALL (R23) ++ RET ++ ++TEXT _setresuid(SB), NOSPLIT, $0-0 ++ JMP purego_setresuid(SB) ++ ++TEXT _cgo_purego_setreuid_trampoline(SB), NOSPLIT, $0 ++ MOVV ·x_cgo_purego_setreuid_call(SB), R23 ++ MOVV (R23), R23 ++ CALL (R23) ++ RET ++ ++TEXT _setreuid(SB), NOSPLIT, $0-0 ++ JMP purego_setreuid(SB) ++ ++TEXT _cgo_purego_setuid_trampoline(SB), NOSPLIT, $0 ++ MOVV ·x_cgo_purego_setuid_call(SB), R23 ++ MOVV (R23), R23 ++ CALL (R23) ++ RET ++ ++TEXT _setuid(SB), NOSPLIT, $0-0 ++ JMP purego_setuid(SB) ++ ++TEXT _cgo_purego_setgroups_trampoline(SB), NOSPLIT, $0 ++ MOVV ·x_cgo_purego_setgroups_call(SB), R23 ++ MOVV (R23), R23 ++ CALL (R23) ++ RET ++ ++TEXT _setgroups(SB), NOSPLIT, $0-0 ++ JMP purego_setgroups(SB) diff --git a/src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/ztrampolines_linux_ppc64le.s b/src/vendor/github.com/golang-fips/openssl/v2/internal/fakecgo/ztrampolines_linux_ppc64le.s new file mode 100644 index 00000000000000..70c51e674587ef @@ -11267,9 +11581,131 @@ index 00000000000000..261a7e4cb90d56 + MOVD R1, libcCallInfo_r2(R3) // save r2 + + RET +diff --git a/src/vendor/github.com/golang-fips/openssl/v2/internal/ossl/asm_loong64.s b/src/vendor/github.com/golang-fips/openssl/v2/internal/ossl/asm_loong64.s +new file mode 100644 +index 00000000000000..83ab9979dfdbfe +--- /dev/null ++++ b/src/vendor/github.com/golang-fips/openssl/v2/internal/ossl/asm_loong64.s +@@ -0,0 +1,116 @@ ++// Copyright 2015 The Go Authors. All rights reserved. ++// Use of this source code is governed by a BSD-style ++// license that can be found in the LICENSE file. ++ ++//go:build !cgo ++ ++#include "go_asm.h" ++#include "textflag.h" ++ ++TEXT ·syscallNSystemStack_trampoline(SB), NOSPLIT, $16 ++ MOVV R4, 8(R3) ++ CALL ·syscallNSystemStack(SB) ++ RET ++ ++TEXT ·syscallNAsm(SB), NOSPLIT, $0-8 ++ // Load pointer from stack (ABI0 calling convention) ++ MOVV libcArgs+0(FP), R12 ++ ++ // Save original stack pointer ++ MOVV R3, R23 ++ ++ // Align stack to 16 bytes for C calling convention ++ MOVV $-16, R15 ++ AND R15, R3 ++ ++ MOVV libcCallInfo_args(R12), R13 ++ MOVV libcCallInfo_fn(R12), R14 ++ ++ // Do we have more than 8 arguments? ++ MOVV libcCallInfo_n(R12), R4 ++ BEQ R4, R0, _0args ++ MOVV $1, R15 ++ BEQ R4, R15, _1args ++ MOVV $2, R15 ++ BEQ R4, R15, _2args ++ MOVV $3, R15 ++ BEQ R4, R15, _3args ++ MOVV $4, R15 ++ BEQ R4, R15, _4args ++ MOVV $5, R15 ++ BEQ R4, R15, _5args ++ MOVV $6, R15 ++ BEQ R4, R15, _6args ++ MOVV $7, R15 ++ BEQ R4, R15, _7args ++ MOVV $8, R15 ++ BEQ R4, R15, _8args ++ ++ // Reserve stack space for remaining args ++ MOVV R4, R16 ++ ADDV $-8, R16 // R16 = n-8 ++ MOVV R16, R12 // R12 = n-8 (reuse R12, no longer need libcArgs) ++ ADDV $1, R12 // R12 = (n-8)+1 ++ MOVV $-2, R15 ++ AND R15, R12 // make even number of words for stack alignment ++ SLLV $3, R12 // R12 = bytes to reserve ++ SUBV R12, R3 // SP -= bytes ++ ++ // R16: size of stack arguments (n-8)*8 ++ // R15: &args[8] ++ // R17: loop counter, from 0 to (n-8)*8 ++ // R18: scratch ++ // R19: copy of R3 (SP) ++ // R20: scratch ++ SLLV $3, R16 // R16 = (n-8)*8 ++ MOVV R13, R15 ++ ADDV $(8*8), R15 // R15 = args + 64 = &args[8] ++ MOVV R0, R17 // R17 = 0 (loop counter) ++ MOVV R3, R19 // R19 = SP copy ++ ++stackargs: ++ MOVV R15, R18 ++ ADDV R17, R18 // R18 = &args[8] + counter ++ MOVV (R18), R18 // R18 = args[8 + counter/8] ++ MOVV R19, R20 ++ ADDV R17, R20 // R20 = SP_copy + counter ++ MOVV R18, (R20) // stack[counter/8] = R18 ++ ADDV $8, R17 // counter += 8 ++ BNE R17, R16, stackargs // while counter != (n-8)*8 ++ ++_8args: ++ MOVV (7*8)(R13), R11 ++ ++_7args: ++ MOVV (6*8)(R13), R10 ++ ++_6args: ++ MOVV (5*8)(R13), R9 ++ ++_5args: ++ MOVV (4*8)(R13), R8 ++ ++_4args: ++ MOVV (3*8)(R13), R7 ++ ++_3args: ++ MOVV (2*8)(R13), R6 ++ ++_2args: ++ MOVV (1*8)(R13), R5 ++ ++_1args: ++ MOVV (0*8)(R13), R4 ++ ++_0args: ++ ++ CALL (R14) ++ ++ // Restore original stack pointer ++ MOVV R23, R3 ++ ++ MOVV libcArgs+0(FP), R12 ++ MOVV R4, libcCallInfo_r1(R12) // save r1 ++ MOVV R5, libcCallInfo_r2(R12) // save r2 ++ ++ RET diff --git a/src/vendor/github.com/golang-fips/openssl/v2/internal/ossl/asm_others.s b/src/vendor/github.com/golang-fips/openssl/v2/internal/ossl/asm_others.s new file mode 100644 -index 00000000000000..1c45d920f07f18 +index 00000000000000..59cfb27799734a --- /dev/null +++ b/src/vendor/github.com/golang-fips/openssl/v2/internal/ossl/asm_others.s @@ -0,0 +1,7 @@ @@ -11277,7 +11713,7 @@ index 00000000000000..1c45d920f07f18 +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + -+//go:build !cgo && !arm && !arm64 && !386 && !amd64 && !ppc64le && !riscv64 && (!s390x || !go1.27) ++//go:build !cgo && !arm && !arm64 && !386 && !amd64 && !loong64 && !ppc64le && !riscv64 && (!s390x || !go1.27) + +// This file silences errors about body-less functions. diff --git a/src/vendor/github.com/golang-fips/openssl/v2/internal/ossl/asm_ppc64le.s b/src/vendor/github.com/golang-fips/openssl/v2/internal/ossl/asm_ppc64le.s @@ -37881,11 +38317,11 @@ index 00000000000000..1722410e5af193 + return getSystemDirectory() + "\\" + dll +} diff --git a/src/vendor/modules.txt b/src/vendor/modules.txt -index 48967bc9ee3bd2..028f6a94dee47e 100644 +index 48967bc9ee3bd2..1f87e000dbdbc9 100644 --- a/src/vendor/modules.txt +++ b/src/vendor/modules.txt @@ -1,3 +1,26 @@ -+# github.com/golang-fips/openssl/v2 v2.0.4-0.20260216103108-5ebb75d331c1 ++# github.com/golang-fips/openssl/v2 v2.0.4-0.20260217140351-4e237614ceb4 +## explicit; go 1.24 +github.com/golang-fips/openssl/v2 +github.com/golang-fips/openssl/v2/bbig diff --git a/patches/0003-Implement-crypto-internal-backend.patch b/patches/0003-Implement-crypto-internal-backend.patch index 0a7082556e..f8c2500c7c 100644 --- a/patches/0003-Implement-crypto-internal-backend.patch +++ b/patches/0003-Implement-crypto-internal-backend.patch @@ -18,7 +18,7 @@ desired goexperiments and build tags. src/cmd/go/internal/cfg/cfg.go | 16 + src/cmd/go/internal/load/pkg.go | 3 + src/cmd/go/internal/tool/tool.go | 9 +- - src/cmd/go/systemcrypto_test.go | 231 ++++++++++ + src/cmd/go/systemcrypto_test.go | 233 ++++++++++ .../go/testdata/script/env_cross_build.txt | 2 + .../script/test_android_issue62123.txt | 2 + src/cmd/internal/testdir/testdir_test.go | 7 + @@ -52,7 +52,7 @@ desired goexperiments and build tags. src/go/build/deps_test.go | 24 +- src/internal/buildcfg/exp.go | 47 ++ src/runtime/runtime_boring.go | 5 + - 43 files changed, 2712 insertions(+), 14 deletions(-) + 43 files changed, 2714 insertions(+), 14 deletions(-) create mode 100644 src/cmd/go/systemcrypto_test.go create mode 100644 src/crypto/internal/backend/backend_test.go create mode 100644 src/crypto/internal/backend/bbig/big.go @@ -94,7 +94,7 @@ index 344b31f7ac1c1d..b4583113d5aa15 100644 # For files created by specific development environment (e.g. editor), # use alternative ways to exclude files from git. diff --git a/src/cmd/compile/internal/logopt/logopt_test.go b/src/cmd/compile/internal/logopt/logopt_test.go -index 1edabf9fb7ff04..16f898462cc067 100644 +index 1edabf9fb7ff04..f47c17401e480b 100644 --- a/src/cmd/compile/internal/logopt/logopt_test.go +++ b/src/cmd/compile/internal/logopt/logopt_test.go @@ -5,6 +5,7 @@ @@ -111,7 +111,7 @@ index 1edabf9fb7ff04..16f898462cc067 100644 arches = []string{"arm", "arm64", "386", "amd64", "mips", "mips64", "loong64", "ppc64le", "riscv64", "s390x", "wasm"} + if goexperiment.SystemCrypto { + // SystemCrypto does not support cross-compilation on all architectures. -+ arches = []string{"arm", "arm64", "386", "amd64", "ppc64le", "riscv64", "s390x"} ++ arches = []string{"arm", "arm64", "386", "amd64", "loong64", "ppc64le", "riscv64", "s390x"} + } goos0 = "linux" } @@ -410,10 +410,10 @@ index 92e8a803105f8d..95d47b625c28a7 100644 buildAndRunTool(loaderstate, ctx, tool, args, runFunc) diff --git a/src/cmd/go/systemcrypto_test.go b/src/cmd/go/systemcrypto_test.go new file mode 100644 -index 00000000000000..50974ee299111c +index 00000000000000..d6cc434197cff1 --- /dev/null +++ b/src/cmd/go/systemcrypto_test.go -@@ -0,0 +1,231 @@ +@@ -0,0 +1,233 @@ +// Copyright 2025 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. @@ -501,8 +501,10 @@ index 00000000000000..50974ee299111c + goexp string + succeed bool + }{ ++ {"linux", "386", "", true}, + {"linux", "amd64", "", true}, + {"linux", "arm64", "", true}, ++ {"linux", "loong64", "", true}, + {"linux", "ppc64le", "", true}, + {"linux", "riscv64", "", true}, + {"linux", "s390x", "", true}, @@ -3108,7 +3110,7 @@ index 00000000000000..5e4b436554d44d +// (because the implementation might be here). diff --git a/src/crypto/systemcrypto_nocgo_linux.go b/src/crypto/systemcrypto_nocgo_linux.go new file mode 100644 -index 00000000000000..b21bc80cfe948f +index 00000000000000..1461a5f75b3b06 --- /dev/null +++ b/src/crypto/systemcrypto_nocgo_linux.go @@ -0,0 +1,18 @@ @@ -3116,7 +3118,7 @@ index 00000000000000..b21bc80cfe948f +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + -+//go:build goexperiment.systemcrypto && linux && !(cgo || 386 || amd64 || arm || arm64 || ppc64le || riscv64 || s390x) ++//go:build goexperiment.systemcrypto && linux && !(cgo || 386 || amd64 || arm || arm64 || loong64 || ppc64le || riscv64 || s390x) + +package crypto + @@ -3125,7 +3127,7 @@ index 00000000000000..b21bc80cfe948f + Using GOEXPERIMENT=systemcrypto on Linux requires CGO_ENABLED=1. + + Our cgo-less OpenSSL implementation is only supported on certain architectures. -+ These architectures are: 386, amd64, arm, arm64, ppc64le, riscv64 and s390x. ++ These architectures are: 386, amd64, arm, arm64, loong64, ppc64le, riscv64 and s390x. + + For more information, including how to request support for additional architectures, visit https://github.com/microsoft/go/blob/microsoft/main/eng/doc/MigrationGuide.md#cgo-is-not-enabled + `