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 cfBundleCopyResourceURL(bundle, resourceName, resourceType, subDirName uintptr) uintptr {
    45  	args := struct {
    46  		bundle       uintptr
    47  		resourceName uintptr
    48  		resourceType uintptr
    49  		subDirName   uintptr
    50  		ret          uintptr
    51  	}{
    52  		bundle:       bundle,
    53  		resourceName: resourceName,
    54  		resourceType: resourceType,
    55  		subDirName:   subDirName,
    56  	}
    57  	libcCall(unsafe.Pointer(abi.FuncPCABI0(cfBundleCopyResourceURL_trampoline)), unsafe.Pointer(&args))
    58  	return args.ret
    59  }
    60  func cfBundleCopyResourceURL_trampoline()
    61  
    62  //go:nosplit
    63  func cfURLGetFileSystemRepresentation(url uintptr, resolveAgainstBase bool, path *byte, pathLen uintptr) bool {
    64  	args := struct {
    65  		url, resolveAgainstBase uintptr
    66  		path                    *byte
    67  		pathLen                 uintptr
    68  		ret                     uintptr
    69  	}{
    70  		url:     url,
    71  		path:    path,
    72  		pathLen: pathLen,
    73  	}
    74  	if resolveAgainstBase {
    75  		args.resolveAgainstBase = 1
    76  	}
    77  	libcCall(unsafe.Pointer(abi.FuncPCABI0(cfURLGetFileSystemRepresentation_trampoline)), unsafe.Pointer(&args))
    78  	KeepAlive(path)
    79  	return args.ret != 0
    80  }
    81  func cfURLGetFileSystemRepresentation_trampoline()
    82  
    83  //go:nosplit
    84  func cfStringCreateWithCString(alloc uintptr, str *byte, encoding uintptr) uintptr {
    85  	args := struct {
    86  		alloc    uintptr
    87  		str      *byte
    88  		encoding uintptr
    89  		ret      uintptr
    90  	}{
    91  		alloc:    alloc,
    92  		str:      str,
    93  		encoding: encoding,
    94  	}
    95  	libcCall(unsafe.Pointer(abi.FuncPCABI0(cfStringCreateWithCString_trampoline)), unsafe.Pointer(&args))
    96  	KeepAlive(str)
    97  	return args.ret
    98  }
    99  func cfStringCreateWithCString_trampoline()
   100  
   101  //go:nosplit
   102  func cfBundleGetValueForInfoDictionaryKey(bundle, key uintptr) uintptr {
   103  	args := struct {
   104  		bundle uintptr
   105  		key    uintptr
   106  		ret    uintptr
   107  	}{
   108  		bundle: bundle,
   109  		key:    key,
   110  	}
   111  	libcCall(unsafe.Pointer(abi.FuncPCABI0(cfBundleGetValueForInfoDictionaryKey_trampoline)), unsafe.Pointer(&args))
   112  	return args.ret
   113  }
   114  func cfBundleGetValueForInfoDictionaryKey_trampoline()
   115  
   116  //go:nosplit
   117  func cfStringGetCString(str uintptr, buf *byte, bufLen uintptr, encoding uintptr) bool {
   118  	args := struct {
   119  		str      uintptr
   120  		buf      *byte
   121  		bufLen   uintptr
   122  		encoding uintptr
   123  		ret      uintptr
   124  	}{
   125  		str:      str,
   126  		buf:      buf,
   127  		bufLen:   bufLen,
   128  		encoding: encoding,
   129  	}
   130  	libcCall(unsafe.Pointer(abi.FuncPCABI0(cfStringGetCString_trampoline)), unsafe.Pointer(&args))
   131  	KeepAlive(buf)
   132  	return args.ret != 0
   133  }
   134  func cfStringGetCString_trampoline()
   135  
   136  //go:nosplit
   137  func cfRelease(ref uintptr) {
   138  	libcCall(unsafe.Pointer(abi.FuncPCABI0(cfRelease_trampoline)), unsafe.Pointer(&ref))
   139  }
   140  func cfRelease_trampoline()
   141  
   142  //go:cgo_import_dynamic libc_chdir chdir "/usr/lib/libSystem.B.dylib"
   143  
   144  //go:cgo_import_dynamic libc_CFBundleGetMainBundle CFBundleGetMainBundle "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation"
   145  //go:cgo_import_dynamic libc_CFBundleCopyBundleURL CFBundleCopyBundleURL "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation"
   146  //go:cgo_import_dynamic libc_CFBundleCopyResourceURL CFBundleCopyResourceURL "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation"
   147  //go:cgo_import_dynamic libc_CFURLGetFileSystemRepresentation CFURLGetFileSystemRepresentation "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation"
   148  //go:cgo_import_dynamic libc_CFStringCreateWithCString CFStringCreateWithCString "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation"
   149  //go:cgo_import_dynamic libc_CFBundleGetValueForInfoDictionaryKey CFBundleGetValueForInfoDictionaryKey "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation"
   150  //go:cgo_import_dynamic libc_CFStringGetCString CFStringGetCString "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation"
   151  //go:cgo_import_dynamic libc_CFRelease CFRelease "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation"
   152  

View as plain text