github.com/flyinox/gosm@v0.0.0-20171117061539-16768cb62077/src/runtime/cgo/signal_darwin_armx.go (about) 1 // Copyright 2015 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 // +build darwin 6 // +build arm arm64 7 8 package cgo 9 10 import "unsafe" 11 12 //go:cgo_import_static x_cgo_panicmem 13 //go:linkname x_cgo_panicmem x_cgo_panicmem 14 var x_cgo_panicmem uintptr 15 16 // use a pointer to avoid relocation of external symbol in __TEXT 17 // make linker happy 18 var _cgo_panicmem = &x_cgo_panicmem 19 20 // TODO(crawshaw): move this into x_cgo_init, it will not run until 21 // runtime has finished loading, which may be after its use. 22 func init() { 23 *_cgo_panicmem = funcPC(panicmem) 24 } 25 26 func funcPC(f interface{}) uintptr { 27 var ptrSize = unsafe.Sizeof(uintptr(0)) 28 return **(**uintptr)(add(unsafe.Pointer(&f), ptrSize)) 29 } 30 31 func add(p unsafe.Pointer, x uintptr) unsafe.Pointer { 32 return unsafe.Pointer(uintptr(p) + x) 33 } 34 35 func panicmem()