summary refs log tree commit diff
path: root/sysdeps/sparc64/elf/crtend.S
blob: ea69083d693c21b19264439f24e640f3f6d39ae1 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
.section ".ctors",#alloc,#write

	.align 8
__CTOR_END__:
	.xword	0

.section ".dtors",#alloc,#write

	.align 8
__DTOR_END__:
	.xword	0

.section ".init",#alloc,#execinstr

	call	__do_global_ctors_aux
	 nop

.text

	.align 4
	.type __do_global_ctors_aux,#function
__do_global_ctors_aux:
	save	%sp,-160,%sp

#ifdef PIC
1:	rd	%pc, %g1
	sethi	%hi(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7
	or	%l7, %lo(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7
	add	%l7, %g1, %l7
	sethi	%hi(__CTOR_END__), %l0
	or	%l0, %lo(__CTOR_END__), %l0
	ldx	[%l7+%l0], %l0
#else
	sethi	%hi(__CTOR_END__), %l0
	or	%l0, %lo(__CTOR_END__), %l0
	add	%l0, %g4, %l0
#endif

	ba	3f
	 ldx	[%l0+8], %l1
2:	jmpl	%l1, %o7
	 ldx	[%l0+8], %l1
3:	addcc	%l1, 1, %g0
	bnz,pt	%xcc, 2b
	 add	%l0, 8, %l0

	ret
	 restore

	.size __do_global_ctors_aux,.-__do_global_ctors_aux