/* This code is used in dl-runtime.c to call the `fixup' function
   and then redirect to the address it returns. */
/* We assume that R11 contain relocation offset and R12 contains
   link_map (_DYNAMIC). This must be consistent with the JUMP_SLOT
   layout generated by binutils. */

/* Based on microblaze implementation */
/*
   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   The GNU C Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; see the file COPYING.LIB.  If
   not, see <http://www.gnu.org/licenses/>.  */

.text
.align 4
.globl _dl_linux_resolver
.globl _dl_linux_resolve
.type  _dl_linux_resolve,@function

_dl_linux_resolve:
	l.addi	r1, r1, -32
	l.sw	0(r1), r9
	/* save function arguments */
	l.sw	8(r1), r3
	l.sw	12(r1), r4
	l.sw	16(r1), r5
	l.sw	20(r1), r6
	l.sw	24(r1), r7
	l.sw	28(r1), r8
	l.ori	r3, r12, 0
	l.ori	r4, r11, 0
	l.jal	_dl_linux_resolver
	 l.nop
	l.lwz	r8, 28(r1)
	l.lwz	r7, 24(r1)
	l.lwz	r6, 20(r1)
	l.lwz	r5, 16(r1)
	l.lwz	r4, 12(r1)
	l.lwz	r3, 8(r1)
	l.lwz	r9, 0(r1)
	l.addi	r1, r1, 32
	l.jr	r11
	 l.nop
	.size _dl_linux_resolve, . - _dl_linux_resolve
