rsc.io/go@v0.0.0-20150416155037-e040fd465409/src/runtime/rt0_linux_ppc64le.s (about)

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