URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Subversion Repositories or1k
[/] [or1k/] [trunk/] [linux/] [uClibc/] [ldso/] [ldso/] [sh/] [resolve.S] - Rev 1765
Compare with Previous | Blame | View Log
/** Stolen from glibc-2.2.2 by Eddie C. Dost <ecd@atecom.com>*/.text.globl _dl_linux_resolver.globl _dl_linux_resolve.type _dl_linux_resolve, @function.balign 16_dl_linux_resolve:mov.l r3, @-r15mov.l r4, @-r15mov.l r5, @-r15mov.l r6, @-r15mov.l r7, @-r15mov.l r12, @-r15movt r3 ! Save T flagmov.l r3, @-r15#ifdef HAVE_FPUsts.l fpscr, @-r15mov #8,r3swap.w r3, r3lds r3, fpscrfmov.s fr11, @-r15fmov.s fr10, @-r15fmov.s fr9, @-r15fmov.s fr8, @-r15fmov.s fr7, @-r15fmov.s fr6, @-r15fmov.s fr5, @-r15fmov.s fr4, @-r15#endifsts.l pr, @-r15/* Note - The PLT entries have been "optimised" not to use r2. r2 is used byGCC to return the address of large structures, so it should not becorrupted here. This does mean however, that those PLTs does not conformto the SH PIC ABI. That spec says that r0 contains the type of the PLTand r2 contains the GOT id. The GNU Plt version stores the GOT id in r0 andignores the type. We can easily detect this difference however,since the type will always be 0 or 8, and the GOT ids will always begreater than or equal to 12.Found in binutils/bfd/elf32-sh.c by Stefan Allius <allius@atecom.com>*/mov #8 ,r5cmp/gt r5, r0bt 1fmov r2, r0 ! link map address in r2 (SH PIC ABI)1:mov r0, r4 ! link map address in r0 (GNUs PLT)mova .LG, r0mov.l .LG, r5add r5, r0mov.l 3f, r5mov.l @(r0, r5),r5jsr @r5mov r1, r5 ! Reloc offsetlds.l @r15+, pr ! Get register content back#ifdef HAVE_FPUfmov.s @r15+, fr4fmov.s @r15+, fr5fmov.s @r15+, fr6fmov.s @r15+, fr7fmov.s @r15+, fr8fmov.s @r15+, fr9fmov.s @r15+, fr10fmov.s @r15+, fr11lds.l @r15+, fpscr#endifmov.l @r15+, r3shal r3 ! Load T flagmov.l @r15+, r12mov.l @r15+, r7mov.l @r15+, r6mov.l @r15+, r5mov.l @r15+, r4jmp @r0 ! Jump to function addressmov.l @r15+, r3.balign 43:.long _dl_linux_resolver@GOT.LG:.long _GLOBAL_OFFSET_TABLE_.size _dl_linux_resolve, . - _dl_linux_resolve
