Ticket #69466: Fix-go-1.20-to-build-on-Mac-OS-10.12.patch

File Fix-go-1.20-to-build-on-Mac-OS-10.12.patch, 4.5 KB (added by programmingkidx, 8 months ago)
  • src/crypto/x509/internal/macos/security.go

    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 ( 
    1111        "internal/abi"
    1212        "strconv"
    1313        "unsafe"
     14    "fmt"
    1415)
    1516
    1617// Security.framework linker flags for the external linker. See Issue 42459.
    func x509_SecTrustGetResult_trampoline() 
    200201//go:cgo_import_dynamic x509_SecTrustEvaluateWithError SecTrustEvaluateWithError "/System/Library/Frameworks/Security.framework/Versions/A/Security"
    201202
    202203func 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")
    214205}
    215206func x509_SecTrustEvaluateWithError_trampoline()
    216207
  • src/make.bash

    diff --git a/src/make.bash b/src/make.bash
    index c07f39bb40..968e3108fe 100755
    a b fi 
    183183# Get the exact bootstrap toolchain version to help with debugging.
    184184# We clear GOOS and GOARCH to avoid an ominous but harmless warning if
    185185# the bootstrap doesn't support them.
    186 GOROOT_BOOTSTRAP_VERSION=$(GOOS= GOARCH= GOEXPERIMENT= $GOROOT_BOOTSTRAP/bin/go version | sed 's/go version //')
     186GOROOT_BOOTSTRAP_VERSION=$(GOOS= GOARCH= GOEXPERIMENT= "$GOROOT_BOOTSTRAP/bin/go" version | sed 's/go version //')
    187187echo "Building Go cmd/dist using $GOROOT_BOOTSTRAP. ($GOROOT_BOOTSTRAP_VERSION)"
    188188if $verbose; then
    189189        echo cmd/dist
  • src/syscall/syscall_bsd.go

    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 { 
    493493        if len(ts) != 2 {
    494494                return EINVAL
    495495        }
    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 {
    498498                return err
    499         }
     499        }*/
     500    return ENOSYS
    500501        // Not as efficient as it could be because Timespec and
    501502        // Timeval have different types in the different OSes
    502503        tv := [2]Timeval{
  • src/syscall/syscall_darwin.go

    diff --git a/src/syscall/syscall_darwin.go b/src/syscall/syscall_darwin.go
    index a9639e3913..dc5c5cdf46 100644
    a b func libc_getfsstat_trampoline() 
    113113
    114114//go:cgo_import_dynamic libc_getfsstat getfsstat "/usr/lib/libSystem.B.dylib"
    115115
    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)
    117117
    118118/*
    119119 * Wrapped
  • src/syscall/zsyscall_darwin_amd64.go

    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() 
    344344
    345345// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
    346346
    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 
    366347func kill(pid int, signum int, posix int) (err error) {
    367348        _, _, e1 := syscall(abi.FuncPCABI0(libc_kill_trampoline), uintptr(pid), uintptr(signum), uintptr(posix))
    368349        if e1 != 0 {