0012-remove-unnecessary-changes-to-support-v.patch 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. From 0df4da2c05981efe9aab12570b68106fca1e801d Mon Sep 17 00:00:00 2001
  2. From: "max.ma" <max.ma@starfivetech.com>
  3. Date: Fri, 7 Oct 2022 22:45:48 -0700
  4. Subject: [PATCH 12/19] remove unnecessary changes to support v
  5. ---
  6. sysdeps/riscv/Makefile | 5 ---
  7. sysdeps/riscv/rtld-global-offsets.sym | 7 ----
  8. sysdeps/unix/sysv/linux/riscv/getcontext.S | 24 +-----------
  9. sysdeps/unix/sysv/linux/riscv/setcontext.S | 22 -----------
  10. sysdeps/unix/sysv/linux/riscv/swapcontext.S | 41 --------------------
  11. sysdeps/unix/sysv/linux/riscv/sys/ucontext.h | 2 -
  12. sysdeps/unix/sysv/linux/riscv/ucontext_i.sym | 5 ---
  13. 7 files changed, 2 insertions(+), 104 deletions(-)
  14. delete mode 100644 sysdeps/riscv/rtld-global-offsets.sym
  15. diff --git a/sysdeps/riscv/Makefile b/sysdeps/riscv/Makefile
  16. index e2d84640d4..8fb10b164f 100644
  17. --- a/sysdeps/riscv/Makefile
  18. +++ b/sysdeps/riscv/Makefile
  19. @@ -2,11 +2,6 @@ ifeq ($(subdir),misc)
  20. sysdep_headers += sys/asm.h
  21. endif
  22. -ifeq ($(subdir),csu)
  23. -# get offset to rtld_global._dl_hwcap and rtld_global._dl_hwcap2.
  24. -gen-as-const-headers += rtld-global-offsets.sym
  25. -endif
  26. -
  27. # RISC-V's assembler also needs to know about PIC as it changes the definition
  28. # of some assembler macros.
  29. ASFLAGS-.os += $(pic-ccflag)
  30. diff --git a/sysdeps/riscv/rtld-global-offsets.sym b/sysdeps/riscv/rtld-global-offsets.sym
  31. deleted file mode 100644
  32. index ff4e97f2a6..0000000000
  33. --- a/sysdeps/riscv/rtld-global-offsets.sym
  34. +++ /dev/null
  35. @@ -1,7 +0,0 @@
  36. -#define SHARED 1
  37. -
  38. -#include <ldsodefs.h>
  39. -
  40. -#define rtld_global_ro_offsetof(mem) offsetof (struct rtld_global_ro, mem)
  41. -
  42. -RTLD_GLOBAL_RO_DL_HWCAP_OFFSET rtld_global_ro_offsetof (_dl_hwcap)
  43. diff --git a/sysdeps/unix/sysv/linux/riscv/getcontext.S b/sysdeps/unix/sysv/linux/riscv/getcontext.S
  44. index 371ebd52a7..499f70b65d 100644
  45. --- a/sysdeps/unix/sysv/linux/riscv/getcontext.S
  46. +++ b/sysdeps/unix/sysv/linux/riscv/getcontext.S
  47. @@ -16,8 +16,6 @@
  48. License along with the GNU C Library. If not, see
  49. <https://www.gnu.org/licenses/>. */
  50. -#include <sysdep.h>
  51. -#include <rtld-global-offsets.h>
  52. #include "ucontext-macros.h"
  53. /* int getcontext (ucontext_t *ucp) */
  54. @@ -41,25 +39,6 @@ LEAF (__getcontext)
  55. SAVE_INT_REG (s10, 26, a0)
  56. SAVE_INT_REG (s11, 27, a0)
  57. -#ifdef __riscv_vector
  58. -# ifdef SHARED
  59. - la t1, _rtld_global_ro
  60. - REG_L t1, RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(t1)
  61. -# else
  62. - la t1, _dl_hwcap
  63. - REG_L t1, (t1)
  64. -# endif
  65. - li t2, HWCAP_ISA_V
  66. - and t2, t1, t2
  67. - beqz t2, 1f
  68. - addi t2, a0, MCONTEXT_EXTENSION
  69. - li t1, RVV_MAGIC
  70. - sw t1, (t2)
  71. - csrr t1, vcsr
  72. - REG_S t1, VCSR_OFFSET(t2)
  73. -1:
  74. -#endif
  75. -
  76. #ifndef __riscv_float_abi_soft
  77. frsr a1
  78. @@ -94,4 +73,5 @@ LEAF (__getcontext)
  79. 99: j __syscall_error
  80. PSEUDO_END (__getcontext)
  81. -weak_alias (__getcontext, getcontext)
  82. \ No newline at end of file
  83. +
  84. +weak_alias (__getcontext, getcontext)
  85. diff --git a/sysdeps/unix/sysv/linux/riscv/setcontext.S b/sysdeps/unix/sysv/linux/riscv/setcontext.S
  86. index 423d94df27..e3bc84a2e6 100644
  87. --- a/sysdeps/unix/sysv/linux/riscv/setcontext.S
  88. +++ b/sysdeps/unix/sysv/linux/riscv/setcontext.S
  89. @@ -16,8 +16,6 @@
  90. License along with the GNU C Library. If not, see
  91. <https://www.gnu.org/licenses/>. */
  92. -#include <sysdep.h>
  93. -#include <rtld-global-offsets.h>
  94. #include "ucontext-macros.h"
  95. /* int __setcontext (const ucontext_t *ucp)
  96. @@ -66,26 +64,6 @@ LEAF (__setcontext)
  97. fssr t1
  98. #endif /* __riscv_float_abi_soft */
  99. -#ifdef __riscv_vector
  100. -#ifdef SHARED
  101. - la t1, _rtld_global_ro
  102. - REG_L t1, RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(t1)
  103. -#else
  104. - la t1, _dl_hwcap
  105. - REG_L t1, (t1)
  106. -#endif
  107. - li t2, HWCAP_ISA_V
  108. - and t2, t1, t2
  109. - beqz t2, 1f
  110. - li t1, RVV_MAGIC
  111. - addi t2, t0, MCONTEXT_EXTENSION
  112. - lw a1, (t2)
  113. - bne a1, t1, 1f
  114. - REG_L t1, VCSR_OFFSET(t2)
  115. - csrw vcsr, t1
  116. -1:
  117. -#endif
  118. -
  119. /* Note the contents of argument registers will be random
  120. unless makecontext() has been called. */
  121. RESTORE_INT_REG (t1, 0, t0)
  122. diff --git a/sysdeps/unix/sysv/linux/riscv/swapcontext.S b/sysdeps/unix/sysv/linux/riscv/swapcontext.S
  123. index 16600f78df..4da615f6d4 100644
  124. --- a/sysdeps/unix/sysv/linux/riscv/swapcontext.S
  125. +++ b/sysdeps/unix/sysv/linux/riscv/swapcontext.S
  126. @@ -16,8 +16,6 @@
  127. License along with the GNU C Library. If not, see
  128. <https://www.gnu.org/licenses/>. */
  129. -#include <sysdep.h>
  130. -#include <rtld-global-offsets.h>
  131. #include "ucontext-macros.h"
  132. /* int swapcontext (ucontext_t *oucp, const ucontext_t *ucp) */
  133. @@ -42,25 +40,6 @@ LEAF (__swapcontext)
  134. SAVE_INT_REG (s10, 26, a0)
  135. SAVE_INT_REG (s11, 27, a0)
  136. -#ifdef __riscv_vector
  137. -#ifdef SHARED
  138. - la t1, _rtld_global_ro
  139. - REG_L t1, RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(t1)
  140. -#else
  141. - la t1, _dl_hwcap
  142. - REG_L t1, (t1)
  143. -#endif
  144. - li t2, HWCAP_ISA_V
  145. - and t2, t1, t2
  146. - beqz t2, 1f
  147. - addi t2, a0, MCONTEXT_EXTENSION
  148. - li t1, RVV_MAGIC
  149. - sw t1, (t2)
  150. - csrr t1, vcsr
  151. - REG_S t1, VCSR_OFFSET(t2)
  152. -1:
  153. -#endif
  154. -
  155. #ifndef __riscv_float_abi_soft
  156. frsr a1
  157. @@ -110,26 +89,6 @@ LEAF (__swapcontext)
  158. fssr t1
  159. #endif /* __riscv_float_abi_soft */
  160. -#ifdef __riscv_vector
  161. -#ifdef SHARED
  162. - la t1, _rtld_global_ro
  163. - REG_L t1, RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(t1)
  164. -#else
  165. - la t1, _dl_hwcap
  166. - REG_L t1, (t1)
  167. -#endif
  168. - li t2, HWCAP_ISA_V
  169. - and t2, t1, t2
  170. - beqz t2, 1f
  171. - li t1, RVV_MAGIC
  172. - addi t2, t0, MCONTEXT_EXTENSION
  173. - lw a1, (t2)
  174. - bne a1, t1, 1f
  175. - REG_L t1, VCSR_OFFSET(t2)
  176. - csrw vcsr, t1
  177. -1:
  178. -#endif
  179. -
  180. /* Note the contents of argument registers will be random
  181. unless makecontext() has been called. */
  182. RESTORE_INT_REG (t1, 0, t0)
  183. diff --git a/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h b/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h
  184. index 1b370f0f45..e226ee85ee 100644
  185. --- a/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h
  186. +++ b/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h
  187. @@ -82,8 +82,6 @@ typedef struct mcontext_t
  188. {
  189. __riscv_mc_gp_state __gregs;
  190. union __riscv_mc_fp_state __fpregs;
  191. - /* 5K + 256 reserved for vector state and future expansion. */
  192. - unsigned char __reserved[5376] __attribute__ ((__aligned__ (16)));
  193. } mcontext_t;
  194. /* Userlevel context. */
  195. diff --git a/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym b/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym
  196. index b91945a080..be55b26310 100644
  197. --- a/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym
  198. +++ b/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym
  199. @@ -2,7 +2,6 @@
  200. #include <signal.h>
  201. #include <stddef.h>
  202. #include <sys/ucontext.h>
  203. -#include <asm/sigcontext.h>
  204. -- Constants used by the rt_sigprocmask call.
  205. @@ -28,9 +27,5 @@ STACK_FLAGS stack (ss_flags)
  206. MCONTEXT_GREGS mcontext (__gregs)
  207. MCONTEXT_FPREGS mcontext (__fpregs)
  208. -MCONTEXT_EXTENSION mcontext (__reserved)
  209. UCONTEXT_SIZE sizeof (ucontext_t)
  210. -VCSR_OFFSET offsetof (struct __riscv_v_state, vcsr)
  211. -
  212. -RVV_MAGIC
  213. --
  214. 2.25.1