1/* Machine-specific declarations for dynamic linker interface.
 2   Copyright (C) 2022-2025 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, see
17   <https://www.gnu.org/licenses/>.  */
18
19#ifndef _LINK_H
20#error "Never include <bits/link.h> directly; use <link.h> instead."
21#endif
22
23#ifndef __loongarch_soft_float
24typedef float La_loongarch_vr
25    __attribute__ ((__vector_size__ (16), __aligned__ (16)));
26typedef float La_loongarch_xr
27    __attribute__ ((__vector_size__ (32), __aligned__ (16)));
28
29typedef union
30{
31  double fpreg[4];
32  La_loongarch_vr vr[2];
33  La_loongarch_xr xr[1];
34} La_loongarch_vector __attribute__ ((__aligned__ (16)));
35#endif
36
37typedef struct La_loongarch_regs
38{
39  unsigned long int lr_reg[8]; /* a0 - a7 */
40#ifndef __loongarch_soft_float
41  La_loongarch_vector lr_vec[8]; /* fa0 - fa7 or vr0 - vr7 or xr0 - xr7*/
42#endif
43  unsigned long int lr_ra;
44  unsigned long int lr_sp;
45} La_loongarch_regs;
46
47/* Return values for calls from PLT on LoongArch.  */
48typedef struct La_loongarch_retval
49{
50  unsigned long int lrv_a0;
51  unsigned long int lrv_a1;
52#ifndef __loongarch_soft_float
53  La_loongarch_vector lrv_vec0;
54  La_loongarch_vector lrv_vec1;
55#endif
56} La_loongarch_retval;
57
58__BEGIN_DECLS
59
60extern ElfW (Addr) la_loongarch_gnu_pltenter (ElfW (Sym) *__sym,
61					      unsigned int __ndx,
62					      uintptr_t *__refcook,
63					      uintptr_t *__defcook,
64					      La_loongarch_regs *__regs,
65					      unsigned int *__flags,
66					      const char *__symname,
67					      long int *__framesizep);
68extern unsigned int la_loongarch_gnu_pltexit (ElfW (Sym) *__sym,
69					      unsigned int __ndx,
70					      uintptr_t *__refcook,
71					      uintptr_t *__defcook,
72					      const La_loongarch_regs *__inregs,
73					      La_loongarch_retval *__outregs,
74					      const char *__symname);
75
76__END_DECLS