1/* Copyright (C) 2004-2025 Free Software Foundation, Inc.
  2   This file is part of the GNU C Library.
  3
  4   The GNU C Library is free software; you can redistribute it and/or
  5   modify it under the terms of the GNU Lesser General Public
  6   License as published by the Free Software Foundation; either
  7   version 2.1 of the License, or (at your option) any later version.
  8
  9   The GNU C Library is distributed in the hope that it will be useful,
 10   but WITHOUT ANY WARRANTY; without even the implied warranty of
 11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 12   Lesser General Public License for more details.
 13
 14   You should have received a copy of the GNU Lesser General Public
 15   License along with the GNU C Library; if not, see
 16   <https://www.gnu.org/licenses/>.  */
 17
 18#ifndef	_LINK_H
 19# error "Never include <bits/link.h> directly; use <link.h> instead."
 20#endif
 21
 22
 23#ifndef __x86_64__
 24/* Registers for entry into PLT on IA-32.  */
 25typedef struct La_i86_regs
 26{
 27  uint32_t lr_edx;
 28  uint32_t lr_ecx;
 29  uint32_t lr_eax;
 30  uint32_t lr_ebp;
 31  uint32_t lr_esp;
 32} La_i86_regs;
 33
 34/* Return values for calls from PLT on IA-32.  */
 35typedef struct La_i86_retval
 36{
 37  uint32_t lrv_eax;
 38  uint32_t lrv_edx;
 39  long double lrv_st0;
 40  long double lrv_st1;
 41  uint64_t __glibc_unused1;
 42  uint64_t __glibc_unused2;
 43} La_i86_retval;
 44
 45
 46__BEGIN_DECLS
 47
 48extern Elf32_Addr la_i86_gnu_pltenter (Elf32_Sym *__sym, unsigned int __ndx,
 49				       uintptr_t *__refcook,
 50				       uintptr_t *__defcook,
 51				       La_i86_regs *__regs,
 52				       unsigned int *__flags,
 53				       const char *__symname,
 54				       long int *__framesizep);
 55extern unsigned int la_i86_gnu_pltexit (Elf32_Sym *__sym, unsigned int __ndx,
 56					uintptr_t *__refcook,
 57					uintptr_t *__defcook,
 58					const La_i86_regs *__inregs,
 59					La_i86_retval *__outregs,
 60					const char *symname);
 61
 62__END_DECLS
 63
 64#else
 65
 66/* Registers for entry into PLT on x86-64.  */
 67# if __GNUC_PREREQ (4,0)
 68typedef float La_x86_64_xmm __attribute__ ((__vector_size__ (16)));
 69typedef float La_x86_64_ymm
 70    __attribute__ ((__vector_size__ (32), __aligned__ (16)));
 71typedef double La_x86_64_zmm
 72    __attribute__ ((__vector_size__ (64), __aligned__ (16)));
 73# else
 74typedef float La_x86_64_xmm __attribute__ ((__mode__ (__V4SF__)));
 75# endif
 76
 77typedef union
 78{
 79# if __GNUC_PREREQ (4,0)
 80  La_x86_64_ymm ymm[2];
 81  La_x86_64_zmm zmm[1];
 82# endif
 83  La_x86_64_xmm xmm[4];
 84} La_x86_64_vector __attribute__ ((__aligned__ (16)));
 85
 86typedef struct La_x86_64_regs
 87{
 88  uint64_t lr_rdx;
 89  uint64_t lr_r8;
 90  uint64_t lr_r9;
 91  uint64_t lr_rcx;
 92  uint64_t lr_rsi;
 93  uint64_t lr_rdi;
 94  uint64_t lr_rbp;
 95  uint64_t lr_rsp;
 96  La_x86_64_xmm lr_xmm[8];
 97  La_x86_64_vector lr_vector[8];
 98#ifndef __ILP32__
 99  __int128_t __glibc_unused1[4];
100#endif
101} La_x86_64_regs;
102
103/* Return values for calls from PLT on x86-64.  */
104typedef struct La_x86_64_retval
105{
106  uint64_t lrv_rax;
107  uint64_t lrv_rdx;
108  La_x86_64_xmm lrv_xmm0;
109  La_x86_64_xmm lrv_xmm1;
110  long double lrv_st0;
111  long double lrv_st1;
112  La_x86_64_vector lrv_vector0;
113  La_x86_64_vector lrv_vector1;
114#ifndef __ILP32__
115  __int128_t __glibc_unused1;
116  __int128_t __glibc_unused2;
117#endif
118} La_x86_64_retval;
119
120#define La_x32_regs La_x86_64_regs
121#define La_x32_retval La_x86_64_retval
122
123__BEGIN_DECLS
124
125extern Elf64_Addr la_x86_64_gnu_pltenter (Elf64_Sym *__sym,
126					  unsigned int __ndx,
127					  uintptr_t *__refcook,
128					  uintptr_t *__defcook,
129					  La_x86_64_regs *__regs,
130					  unsigned int *__flags,
131					  const char *__symname,
132					  long int *__framesizep);
133extern unsigned int la_x86_64_gnu_pltexit (Elf64_Sym *__sym,
134					   unsigned int __ndx,
135					   uintptr_t *__refcook,
136					   uintptr_t *__defcook,
137					   const La_x86_64_regs *__inregs,
138					   La_x86_64_retval *__outregs,
139					   const char *__symname);
140
141extern Elf32_Addr la_x32_gnu_pltenter (Elf32_Sym *__sym,
142				       unsigned int __ndx,
143				       uintptr_t *__refcook,
144				       uintptr_t *__defcook,
145				       La_x32_regs *__regs,
146				       unsigned int *__flags,
147				       const char *__symname,
148				       long int *__framesizep);
149extern unsigned int la_x32_gnu_pltexit (Elf32_Sym *__sym,
150					unsigned int __ndx,
151					uintptr_t *__refcook,
152					uintptr_t *__defcook,
153					const La_x32_regs *__inregs,
154					La_x32_retval *__outregs,
155					const char *__symname);
156
157__END_DECLS
158
159#endif