Source file src/runtime/sys_ios_arm64.go

     1  // Copyright 2026 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package runtime
     6  
     7  import (
     8  	"internal/abi"
     9  	"unsafe"
    10  )
    11  
    12  // CoreFoundation linker flags for the external linker.
    13  //
    14  //go:cgo_ldflag "-framework"
    15  //go:cgo_ldflag "CoreFoundation"
    16  
    17  //go:nosplit
    18  func chdir(path *byte) int32 {
    19  	ret := libcCall(unsafe.Pointer(abi.FuncPCABI0(chdir_trampoline)), unsafe.Pointer(&path))
    20  	KeepAlive(path)
    21  	return ret
    22  }
    23  func chdir_trampoline()
    24  
    25  //go:nosplit
    26  func cfBundleGetMainBundle() (bundle uintptr) {
    27  	libcCall(unsafe.Pointer(abi.FuncPCABI0(cfBundleGetMainBundle_trampoline)), unsafe.Pointer(&bundle))
    28  	return bundle
    29  }
    30  func cfBundleGetMainBundle_trampoline()
    31  
    32  //go:nosplit
    33  func cfBundleCopyBundleURL(bundle uintptr) uintptr {
    34  	args := struct {
    35  		bundle uintptr
    36  		ret    uintptr
    37  	}{bundle: bundle}
    38  	libcCall(unsafe.Pointer(abi.FuncPCABI0(cfBundleCopyBundleURL_trampoline)), unsafe.Pointer(&args))
    39  	return args.ret
    40  }
    41  func cfBundleCopyBundleURL_trampoline()
    42  
    43  //go:nosplit
    44  func cfURLGetFileSystemRepresentation(url uintptr, resolveAgainstBase bool, path *byte, pathLen uintptr) bool {
    45  	args := struct {
    46  		url, resolveAgainstBase uintptr
    47  		path                    *byte
    48  		pathLen                 uintptr
    49  		ret                     uintptr
    50  	}{
    51  		url:     url,
    52  		path:    path,
    53  		pathLen: pathLen,
    54  	}
    55  	if resolveAgainstBase {
    56  		args.resolveAgainstBase = 1
    57  	}
    58  	libcCall(unsafe.Pointer(abi.FuncPCABI0(cfURLGetFileSystemRepresentation_trampoline)), unsafe.Pointer(&args))
    59  	KeepAlive(path)
    60  	return args.ret != 0
    61  }
    62  func cfURLGetFileSystemRepresentation_trampoline()
    63  
    64  //go:nosplit
    65  func cfStringCreateWithCString(alloc uintptr, str *byte, encoding uintptr) uintptr {
    66  	args := struct {
    67  		alloc    uintptr
    68  		str      *byte
    69  		encoding uintptr
    70  		ret      uintptr
    71  	}{
    72  		alloc:    alloc,
    73  		str:      str,
    74  		encoding: encoding,
    75  	}
    76  	libcCall(unsafe.Pointer(abi.FuncPCABI0(cfStringCreateWithCString_trampoline)), unsafe.Pointer(&args))
    77  	KeepAlive(str)
    78  	return args.ret
    79  }
    80  func cfStringCreateWithCString_trampoline()
    81  
    82  //go:nosplit
    83  func cfBundleGetValueForInfoDictionaryKey(bundle, key uintptr) uintptr {
    84  	args := struct {
    85  		bundle uintptr
    86  		key    uintptr
    87  		ret    uintptr
    88  	}{
    89  		bundle: bundle,
    90  		key:    key,
    91  	}
    92  	libcCall(unsafe.Pointer(abi.FuncPCABI0(cfBundleGetValueForInfoDictionaryKey_trampoline)), unsafe.Pointer(&args))
    93  	return args.ret
    94  }
    95  func cfBundleGetValueForInfoDictionaryKey_trampoline()
    96  
    97  //go:nosplit
    98  func cfStringGetCString(str uintptr, buf *byte, bufLen uintptr, encoding uintptr) bool {
    99  	args := struct {
   100  		str      uintptr
   101  		buf      *byte
   102  		bufLen   uintptr
   103  		encoding uintptr
   104  		ret      uintptr
   105  	}{
   106  		str:      str,
   107  		buf:      buf,
   108  		bufLen:   bufLen,
   109  		encoding: encoding,
   110  	}
   111  	libcCall(unsafe.Pointer(abi.FuncPCABI0(cfStringGetCString_trampoline)), unsafe.Pointer(&args))
   112  	KeepAlive(buf)
   113  	return args.ret != 0
   114  }
   115  func cfStringGetCString_trampoline()
   116  
   117  //go:nosplit
   118  func cfRelease(ref uintptr) {
   119  	libcCall(unsafe.Pointer(abi.FuncPCABI0(cfRelease_trampoline)), unsafe.Pointer(&ref))
   120  }
   121  func cfRelease_trampoline()
   122  
   123  //go:cgo_import_dynamic libc_chdir chdir "/usr/lib/libSystem.B.dylib"
   124  
   125  //go:cgo_import_dynamic libc_CFBundleGetMainBundle CFBundleGetMainBundle "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation"
   126  //go:cgo_import_dynamic libc_CFBundleCopyBundleURL CFBundleCopyBundleURL "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation"
   127  //go:cgo_import_dynamic libc_CFURLGetFileSystemRepresentation CFURLGetFileSystemRepresentation "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation"
   128  //go:cgo_import_dynamic libc_CFStringCreateWithCString CFStringCreateWithCString "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation"
   129  //go:cgo_import_dynamic libc_CFBundleGetValueForInfoDictionaryKey CFBundleGetValueForInfoDictionaryKey "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation"
   130  //go:cgo_import_dynamic libc_CFStringGetCString CFStringGetCString "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation"
   131  //go:cgo_import_dynamic libc_CFRelease CFRelease "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation"
   132  

View as plain text