link.h 4.8 KB

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