github.com/miolini/go@v0.0.0-20160405192216-fca68c8cb408/src/runtime/rt0_linux_ppc64le.s (about)

     1  #include "go_asm.h"
     2  #include "textflag.h"
     3  
     4  TEXT _rt0_ppc64le_linux(SB),NOSPLIT,$0
     5  	BR _main<>(SB)
     6  
     7  TEXT _main<>(SB),NOSPLIT,$-8
     8  	// In a statically linked binary, the stack contains argc,
     9  	// argv as argc string pointers followed by a NULL, envv as a
    10  	// sequence of string pointers followed by a NULL, and auxv.
    11  	// There is no TLS base pointer.
    12  	//
    13  	// In a dynamically linked binary, r3 contains argc, r4
    14  	// contains argv, r5 contains envp, r6 contains auxv, and r13
    15  	// contains the TLS pointer.
    16  	//
    17  	// Figure out which case this is by looking at r4: if it's 0,
    18  	// we're statically linked; otherwise we're dynamically
    19  	// linked.
    20  	CMP	R0, R4
    21  	BNE	dlink
    22  
    23  	// Statically linked
    24  	MOVD	0(R1), R3 // argc
    25  	ADD	$8, R1, R4 // argv
    26  	MOVD	$runtimeĀ·m0+m_tls(SB), R13 // TLS
    27  	ADD	$0x7000, R13
    28  
    29  dlink:
    30  	BR	main(SB)
    31  
    32  TEXT main(SB),NOSPLIT,$-8
    33  	MOVD	$runtimeĀ·rt0_go(SB), R12
    34  	MOVD	R12, CTR
    35  	BR	(CTR)