1/* Machine-dependent ELF runtime symbol resolution, OpenRISC version.
2 Copyright (C) 2022 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
19
20#include <sysdep.h>
21
22/* This code is plugged into the PLT and used by the dynamic linker to
23 call _dl_fixup (dl-runtime.c).
24
25 We assume that R11 contains the relocation offset and R12 contains
26 link_map (_DYNAMIC). This must be consistent with the JUMP_SLOT
27 layout generated by binutils. */
28
29ENTRY (_dl_runtime_resolve)
30 l.sw -4(r1), r9
31 l.sw -8(r1), r1
32
33 /* save function arguments. */
34 l.sw -12(r1), r3
35 l.sw -16(r1), r4
36 l.sw -20(r1), r5
37 l.sw -24(r1), r6
38 l.sw -28(r1), r7
39 l.sw -32(r1), r8
40
41 .cfi_offset 9, -4
42 .cfi_offset 1, -8
43 .cfi_offset 3, -12
44 .cfi_offset 4, -16
45 .cfi_offset 5, -20
46 .cfi_offset 6, -24
47 .cfi_offset 7, -28
48 .cfi_offset 8, -32
49
50 l.addi r1,r1, -32
51 .cfi_def_cfa_offset 32
52
53 l.ori r3, r12, 0
54 l.ori r4, r11, 0
55
56 l.jal _dl_fixup
57 l.nop
58
59 /* Restore function arguments. */
60 l.addi r1,r1, 32
61 l.lwz r8, -32(r1)
62 l.lwz r7, -28(r1)
63 l.lwz r6, -24(r1)
64 l.lwz r5, -20(r1)
65 l.lwz r4, -16(r1)
66 l.lwz r3, -12(r1)
67
68 /* restore return address. */
69 l.lwz r9, -4(r1)
70
71 l.jr r11
72 l.nop
73END (_dl_runtime_resolve)
74

source code of glibc/sysdeps/or1k/dl-trampoline.S