1 // Copyright 2009 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 #include "textflag.h" 6 7 TEXT _rt0_amd64_darwin(SB),NOSPLIT,$-8 8 LEAQ 8(SP), SI // argv 9 MOVQ 0(SP), DI // argc 10 MOVQ $main(SB), AX 11 JMP AX 12 13 // When linking with -shared, this symbol is called when the shared library 14 // is loaded. 15 TEXT _rt0_amd64_darwin_lib(SB),NOSPLIT,$40 16 MOVQ DI, _rt0_amd64_darwin_lib_argc<>(SB) 17 MOVQ SI, _rt0_amd64_darwin_lib_argv<>(SB) 18 19 // Create a new thread to do the runtime initialization and return. 20 MOVQ _cgo_sys_thread_create(SB), AX 21 TESTQ AX, AX 22 JZ nocgo 23 MOVQ $_rt0_amd64_darwin_lib_go(SB), DI 24 MOVQ $0, SI 25 CALL AX 26 RET 27 nocgo: 28 MOVQ $8388608, 0(SP) // stacksize 29 MOVQ $_rt0_amd64_darwin_lib_go(SB), AX 30 MOVQ AX, 8(SP) // fn 31 MOVQ $0, 16(SP) // fnarg 32 MOVQ $runtimenewosproc0(SB), AX 33 CALL AX 34 RET 35 36 TEXT _rt0_amd64_darwin_lib_go(SB),NOSPLIT,$0 37 MOVQ _rt0_amd64_darwin_lib_argc<>(SB), DI 38 MOVQ _rt0_amd64_darwin_lib_argv<>(SB), SI 39 MOVQ $runtimert0_go(SB), AX 40 JMP AX 41 42 DATA _rt0_amd64_darwin_lib_argc<>(SB)/8, $0 43 GLOBL _rt0_amd64_darwin_lib_argc<>(SB),NOPTR, $8 44 DATA _rt0_amd64_darwin_lib_argv<>(SB)/8, $0 45 GLOBL _rt0_amd64_darwin_lib_argv<>(SB),NOPTR, $8 46 47 TEXT main(SB),NOSPLIT,$-8 48 MOVQ $runtimert0_go(SB), AX 49 JMP AX 50