github.com/hikaru7719/go@v0.0.0-20181025140707-c8b2ac68906a/src/runtime/rt0_aix_ppc64.s (about)

     1  // Copyright 2018 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  // _rt0_ppc64_aix is a function descriptor of the entrypoint function
     8  // __start. This name is needed by cmd/link.
     9  DATA	_rt0_ppc64_aix+0(SB)/8, $__start<>(SB)
    10  DATA	_rt0_ppc64_aix+8(SB)/8, $TOC(SB)
    11  GLOBL	_rt0_ppc64_aix(SB), NOPTR, $16
    12  
    13  
    14  // The starting function must return in the loader to
    15  // initialise some librairies, especially libthread which
    16  // creates the main thread and adds the TLS in R13
    17  // R19 contains a function descriptor to the loader function
    18  // which needs to be called.
    19  // This code is similar to the __start function in C
    20  TEXT __start<>(SB),NOSPLIT,$-8
    21  	XOR R0, R0
    22  	MOVD $libc___n_pthreads(SB), R4
    23  	MOVD 0(R4), R4
    24  	MOVD $libc___mod_init(SB), R5
    25  	MOVD 0(R5), R5
    26  	MOVD 0(R19), R0
    27  	MOVD R2, 40(R1)
    28  	MOVD 8(R19), R2
    29  	MOVD R18, R3
    30  	MOVD R0, CTR
    31  	BL (CTR) // Return to AIX loader
    32  
    33  	// Launch rt0_go
    34  	MOVD 40(R1), R2
    35  	MOVD R14, R3 // argc
    36  	MOVD R15, R4 // argv
    37  	MOVD $runtime·rt0_go(SB), R12
    38  	MOVD R12, CTR
    39  	BR (CTR)
    40