summaryrefslogtreecommitdiff
path: root/ldso/ldso/i386/resolve.S
blob: 8ae2efa70f8043f5bef16c8159dcf401e6c6ce8c (plain)
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
/*
 * These are various helper routines that are needed to run an ELF image.
 */

.text
.align 4

.globl _dl_linux_resolve
.type	_dl_linux_resolve,@function

_dl_linux_resolve:
	pusha				/* preserve all regs */
	lea	0x20(%esp),%eax		/* eax = tpnt and reloc_entry params */
	pushl	4(%eax)			/* push copy of reloc_entry param */
	pushl	(%eax)			/* push copy of tpnt param */
	pushl	%eax			/* _dl_linux_resolver expects a dummy
					 * param - this could be removed */
#ifdef __PIC__
	call	.L24
.L24:
	popl	%ebx
	addl	$_GLOBAL_OFFSET_TABLE_+[.-.L24],%ebx
	movl _dl_linux_resolver@GOT(%ebx),%ebx	/* eax = resolved func */
	call *%ebx
#else
	call _dl_linux_resolver
#endif
	movl	%eax,0x2C(%esp)		/* store func addr over original
					 * tpnt param */
	addl	$0xC,%esp		/* remove copy parameters */
	popa				/* restore regs */
	ret	$4			/* jump to func removing original
					 * reloc_entry param from stack */
.LFE2:
	.size _dl_linux_resolve,.LFE2-_dl_linux_resolve