Date: Sun, 25 Feb 2024 12:19:47 -0500
Subject: [PATCH] Fix go 1.20 to build on Mac OS 10.12
---
src/crypto/x509/internal/macos/security.go | 13 ++-----------
src/make.bash | 2 +-
src/syscall/syscall_bsd.go | 7 ++++---
src/syscall/syscall_darwin.go | 2 +-
src/syscall/zsyscall_darwin_amd64.go | 19 -------------------
5 files changed, 8 insertions(+), 35 deletions(-)
diff --git a/src/crypto/x509/internal/macos/security.go b/src/crypto/x509/internal/macos/security.go
index a6972c0c09..6ac129b1f1 100644
a
|
b
|
import ( |
11 | 11 | "internal/abi" |
12 | 12 | "strconv" |
13 | 13 | "unsafe" |
| 14 | "fmt" |
14 | 15 | ) |
15 | 16 | |
16 | 17 | // Security.framework linker flags for the external linker. See Issue 42459. |
… |
… |
func x509_SecTrustGetResult_trampoline() |
200 | 201 | //go:cgo_import_dynamic x509_SecTrustEvaluateWithError SecTrustEvaluateWithError "/System/Library/Frameworks/Security.framework/Versions/A/Security" |
201 | 202 | |
202 | 203 | func SecTrustEvaluateWithError(trustObj CFRef) (int, error) { |
203 | | var errRef CFRef |
204 | | ret := syscall(abi.FuncPCABI0(x509_SecTrustEvaluateWithError_trampoline), uintptr(trustObj), uintptr(unsafe.Pointer(&errRef)), 0, 0, 0, 0) |
205 | | if int32(ret) != 1 { |
206 | | errStr := CFErrorCopyDescription(errRef) |
207 | | err := errors.New(CFStringToString(errStr)) |
208 | | errCode := CFErrorGetCode(errRef) |
209 | | CFRelease(errRef) |
210 | | CFRelease(errStr) |
211 | | return errCode, err |
212 | | } |
213 | | return 0, nil |
| 204 | return 0, fmt.Errorf("unimplemented function") |
214 | 205 | } |
215 | 206 | func x509_SecTrustEvaluateWithError_trampoline() |
216 | 207 | |
diff --git a/src/make.bash b/src/make.bash
index c07f39bb40..968e3108fe 100755
a
|
b
|
fi |
183 | 183 | # Get the exact bootstrap toolchain version to help with debugging. |
184 | 184 | # We clear GOOS and GOARCH to avoid an ominous but harmless warning if |
185 | 185 | # the bootstrap doesn't support them. |
186 | | GOROOT_BOOTSTRAP_VERSION=$(GOOS= GOARCH= GOEXPERIMENT= $GOROOT_BOOTSTRAP/bin/go version | sed 's/go version //') |
| 186 | GOROOT_BOOTSTRAP_VERSION=$(GOOS= GOARCH= GOEXPERIMENT= "$GOROOT_BOOTSTRAP/bin/go" version | sed 's/go version //') |
187 | 187 | echo "Building Go cmd/dist using $GOROOT_BOOTSTRAP. ($GOROOT_BOOTSTRAP_VERSION)" |
188 | 188 | if $verbose; then |
189 | 189 | echo cmd/dist |
diff --git a/src/syscall/syscall_bsd.go b/src/syscall/syscall_bsd.go
index c7a7d786dc..b2d20593d1 100644
a
|
b
|
func UtimesNano(path string, ts []Timespec) error { |
493 | 493 | if len(ts) != 2 { |
494 | 494 | return EINVAL |
495 | 495 | } |
496 | | err := utimensat(_AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0) |
497 | | if err != ENOSYS { |
| 496 | //err := utimensat(_AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0) |
| 497 | /*if err != ENOSYS { |
498 | 498 | return err |
499 | | } |
| 499 | }*/ |
| 500 | return ENOSYS |
500 | 501 | // Not as efficient as it could be because Timespec and |
501 | 502 | // Timeval have different types in the different OSes |
502 | 503 | tv := [2]Timeval{ |
diff --git a/src/syscall/syscall_darwin.go b/src/syscall/syscall_darwin.go
index a9639e3913..dc5c5cdf46 100644
a
|
b
|
func libc_getfsstat_trampoline() |
113 | 113 | |
114 | 114 | //go:cgo_import_dynamic libc_getfsstat getfsstat "/usr/lib/libSystem.B.dylib" |
115 | 115 | |
116 | | //sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) |
| 116 | //REMOVEDsys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) |
117 | 117 | |
118 | 118 | /* |
119 | 119 | * Wrapped |
diff --git a/src/syscall/zsyscall_darwin_amd64.go b/src/syscall/zsyscall_darwin_amd64.go
index 161bb4443a..9b51435aa5 100644
a
|
b
|
func libc_pipe_trampoline() |
344 | 344 | |
345 | 345 | // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT |
346 | 346 | |
347 | | func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { |
348 | | var _p0 *byte |
349 | | _p0, err = BytePtrFromString(path) |
350 | | if err != nil { |
351 | | return |
352 | | } |
353 | | _, _, e1 := syscall6(abi.FuncPCABI0(libc_utimensat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) |
354 | | if e1 != 0 { |
355 | | err = errnoErr(e1) |
356 | | } |
357 | | return |
358 | | } |
359 | | |
360 | | func libc_utimensat_trampoline() |
361 | | |
362 | | //go:cgo_import_dynamic libc_utimensat utimensat "/usr/lib/libSystem.B.dylib" |
363 | | |
364 | | // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT |
365 | | |
366 | 347 | func kill(pid int, signum int, posix int) (err error) { |
367 | 348 | _, _, e1 := syscall(abi.FuncPCABI0(libc_kill_trampoline), uintptr(pid), uintptr(signum), uintptr(posix)) |
368 | 349 | if e1 != 0 { |