about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/alpha/init-first.h
blob: ffbcaf152112f1dbc9146415ba35577b83735d1c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* The job of this fragment it to find argc and friends for INIT.
   This is done in one of two ways: either in the stack context
   of program start, or having dlopen pass them in.  */

#define SYSDEP_CALL_INIT(NAME, INIT)		\
    asm(".weak _dl_starting_up\n\t"		\
        ".globl " #NAME "\n\t"			\
	".ent " #NAME "\n"			\
	#NAME ":\n\t"				\
	"ldgp	$29, 0($27)\n\t"		\
	".prologue 1\n\t"			\
	".set at\n\t"				\
	/* Are we a dynamic libc being loaded into a static program?  */ \
	"lda	$0, _dl_starting_up\n\t"	\
	"beq	$0, 1f\n\t"			\
	"ldl	$0, 0($0)\n"			\
	"cmpeq	$31, $0, $0\n"			\
	"1:\t"					\
	"stl	$0, __libc_multiple_libcs\n\t"	\
	/* If so, argc et al are in a0-a2 already.  Otherwise, load them.  */ \
	"bne	$0, 2f\n\t"			\
	"ldl	$16, 0($30)\n\t"		\
	"lda	$17, 8($30)\n\t"		\
	"s8addq	$16, $17, $18\n\t"		\
	"addq	$18, 8, $18\n"			\
	"2:\t"					\
	"br $31, " #INIT "..ng\n\t"		\
	".set noat\n\t"				\
	".end " #NAME);