asm_{$GOARCH}.s

1
2
3
4
5
6
7
// Called by C code generated by cmd/cgo.
// func crosscall2(fn func(a unsafe.Pointer, n int32, ctxt uintptr), a unsafe.Pointer, n int32, ctxt uintptr)
// Saves C callee-saved registers and calls fn with three arguments.
#ifndef GOOS_windows
TEXT crosscall2(SB),NOSPLIT,$0x50-0 /* keeps stack pointer 32-byte aligned */
#else
TEXT crosscall2(SB),NOSPLIT,$0x110-0 /* also need to save xmm6 - xmm15 */

参考 asm_amd64.s
翻译一下: 被cmd/cgo生成的C代码crosscall2函数调用.C代码会保存在寄存器中幷被调用.
从名字上看:大概是跨语言调用

callbacks_traceback.go

1
2
3
4
5
//go:cgo_import_static x_cgo_callers
//go:linkname x_cgo_callers x_cgo_callers
//go:linkname _cgo_callers _cgo_callers
var x_cgo_callers byte
var _cgo_callers = &x_cgo_callers

callbacks.go

  1. 1
    2
    3
    4
    5
    6
    // These utility functions are available to be called from code
    // compiled with gcc via crosscall2.

    // cgocallback is defined in runtime
    //go:linkname _runtime_cgocallback runtime.cgocallback
    func _runtime_cgocallback(unsafe.Pointer, unsafe.Pointer, uintptr, uintptr)

翻译一下: 这个工具方法可以在gcc编译的代码,通过crosscall2方法调用.

  1. _runtime_cgo_panic_internal,_cgo_panic等参数或方法

gcc_{$GOARCH}.s

1
2
3
4
5
6
7
8
9
10
11
/*
* void crosscall_amd64(void (*fn)(void))
*
* Calling into the 6c tool chain, where all registers are caller save.
* Called from standard x86-64 ABI, where %rbx, %rbp, %r12-%r15
* are callee-save so they must be saved explicitly.
* The standard x86-64 ABI passes the three arguments m, g, fn
* in %rdi, %rsi, %rdx.
*/
.globl EXT(crosscall_amd64)
EXT(crosscall_amd64):

参考 gcc_amd64.s
翻译一下: 被cmd/cgo生成的C代码crosscall2函数调用.C代码会保存在寄存器中幷被调用.
从名字上看:大概是跨语言调用

其他

都是gcc相关的一些初始化或简单设置功能