OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [uClibc/] [ldso/] [ldso/] [i386/] [resolve.S] - Blame information for rev 1771

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1325 phoenix
/*
2
 * This function is _not_ called directly.  It is jumped to (so no return
3
 * address is on the stack) when attempting to use a symbol that has not yet
4
 * been resolved.  The first time a jump symbol (such as a function call inside
5
 * a shared library) is used (before it gets resolved) it will jump here to
6
 * _dl_linux_resolve.  When we get called the stack looks like this:
7
 *      reloc_entry
8
 *      tpnt
9
 *
10
 * This function saves all the registers, puts a copy of reloc_entry and tpnt
11
 * on the stack (as function arguments) then make the function call
12
 * _dl_linux_resolver(tpnt, reloc_entry).  _dl_linux_resolver() figures out
13
 * where the jump symbol is _really_ supposed to have jumped to and returns
14
 * that to us.  Once we have that, we overwrite tpnt with this fixed up
15
 * address. We then clean up after ourselves, put all the registers back how we
16
 * found them, then we jump to where the fixed up address, which is where the
17
 * jump symbol that got us here really wanted to jump to in the first place.
18
 * found them, then we jump to the fixed up address, which is where the jump
19
 * symbol that got us here really wanted to jump to in the first place.
20
 *  -Erik Andersen
21
 */
22
 
23
.text
24
.align 4
25
 
26
.globl _dl_linux_resolve
27
.type   _dl_linux_resolve,@function
28
 
29
_dl_linux_resolve:
30
        pusha                           /* preserve all regs */
31
        lea     0x20(%esp),%eax         /* eax = tpnt and reloc_entry params */
32
        pushl   4(%eax)                 /* push copy of reloc_entry param */
33
        pushl   (%eax)                  /* push copy of tpnt param */
34
 
35
#ifdef __PIC__
36
        call    .L24
37
.L24:
38
        popl    %ebx
39
        addl    $_GLOBAL_OFFSET_TABLE_+[.-.L24],%ebx
40
        movl _dl_linux_resolver@GOT(%ebx),%ebx  /* eax = resolved func */
41
        call *%ebx
42
#else
43
        call _dl_linux_resolver
44
#endif
45
        movl    %eax,0x28(%esp)         /* store func addr over original
46
                                         * tpnt param */
47
        addl    $0x8,%esp               /* remove copy parameters */
48
        popa                            /* restore regs */
49
        ret     $4                      /* jump to func removing original
50
                                         * reloc_entry param from stack */
51
.LFE2:
52
        .size _dl_linux_resolve,.LFE2-_dl_linux_resolve

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.