1 /* RISC-V PLT trampoline
2 Copyright (C) 2017-2020 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library. If not, see
18 <https://www.gnu.org/licenses/>. */
23 /* Assembler veneer called from the PLT header code for lazy loading.
24 The PLT header passes its own args in t0-t2. */
26 #ifdef __riscv_float_abi_soft
27 # define FRAME_SIZE (-((-10 * SZREG) & ALMASK))
29 # define FRAME_SIZE (-((-10 * SZREG - 8 * SZFREG) & ALMASK))
32 ENTRY (_dl_runtime_resolve)
33 # Save arguments to stack.
34 addi sp, sp, -FRAME_SIZE
45 #ifndef __riscv_float_abi_soft
46 FREG_S fa0, (10*SZREG + 0*SZFREG)(sp)
47 FREG_S fa1, (10*SZREG + 1*SZFREG)(sp)
48 FREG_S fa2, (10*SZREG + 2*SZFREG)(sp)
49 FREG_S fa3, (10*SZREG + 3*SZFREG)(sp)
50 FREG_S fa4, (10*SZREG + 4*SZFREG)(sp)
51 FREG_S fa5, (10*SZREG + 5*SZFREG)(sp)
52 FREG_S fa6, (10*SZREG + 6*SZFREG)(sp)
53 FREG_S fa7, (10*SZREG + 7*SZFREG)(sp)
56 # Update .got.plt and obtain runtime address of callee.
59 add a1, a1, t1 # reloc offset (== thrice the .got.plt offset)
64 # Restore arguments from stack.
75 #ifndef __riscv_float_abi_soft
76 FREG_L fa0, (10*SZREG + 0*SZFREG)(sp)
77 FREG_L fa1, (10*SZREG + 1*SZFREG)(sp)
78 FREG_L fa2, (10*SZREG + 2*SZFREG)(sp)
79 FREG_L fa3, (10*SZREG + 3*SZFREG)(sp)
80 FREG_L fa4, (10*SZREG + 4*SZFREG)(sp)
81 FREG_L fa5, (10*SZREG + 5*SZFREG)(sp)
82 FREG_L fa6, (10*SZREG + 6*SZFREG)(sp)
83 FREG_L fa7, (10*SZREG + 7*SZFREG)(sp)
86 addi sp, sp, FRAME_SIZE
90 END (_dl_runtime_resolve)