authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-06-04 16:46:21-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-06-04 16:54:14-07:00
log0098e650fbceae74c8c468716c0810476f72ec47
treeaff7e7e8e7d4ee4a81b5df4cb19f91dc6e40380b
parent85a46ee520270f90c13ecd3db7db490a06a31b11

update musl source files to v1.2.5

adds loongarch64 and riscv32

138 files changed, 2917 insertions(+), 123 deletions(-)

lib/libc/musl/arch/aarch64/bits/syscall.h.in+5
......@@ -299,4 +299,9 @@
299299#define __NR_landlock_create_ruleset 444
300300#define __NR_landlock_add_rule 445
301301#define __NR_landlock_restrict_self 446
302#define __NR_process_mrelease 448
303#define __NR_futex_waitv 449
304#define __NR_set_mempolicy_home_node 450
305#define __NR_cachestat 451
306#define __NR_fchmodat2 452
302307
lib/libc/musl/arch/arm/bits/syscall.h.in+5
......@@ -399,6 +399,11 @@
399399#define __NR_landlock_create_ruleset 444
400400#define __NR_landlock_add_rule 445
401401#define __NR_landlock_restrict_self 446
402#define __NR_process_mrelease 448
403#define __NR_futex_waitv 449
404#define __NR_set_mempolicy_home_node 450
405#define __NR_cachestat 451
406#define __NR_fchmodat2 452
402407
403408#define __ARM_NR_breakpoint 0x0f0001
404409#define __ARM_NR_cacheflush 0x0f0002
lib/libc/musl/arch/arm/reloc.h+1-1
......@@ -26,7 +26,7 @@
2626#define REL_TPOFF R_ARM_TLS_TPOFF32
2727#define REL_TLSDESC R_ARM_TLS_DESC
2828
29#define TLSDESC_BACKWARDS
29#define TLSDESC_BACKWARDS 1
3030
3131#define CRTJMP(pc,sp) __asm__ __volatile__( \
3232 "mov sp,%1 ; bx %0" : : "r"(pc), "r"(sp) : "memory" )
lib/libc/musl/arch/i386/bits/syscall.h.in+6
......@@ -436,4 +436,10 @@
436436#define __NR_landlock_create_ruleset 444
437437#define __NR_landlock_add_rule 445
438438#define __NR_landlock_restrict_self 446
439#define __NR_memfd_secret 447
440#define __NR_process_mrelease 448
441#define __NR_futex_waitv 449
442#define __NR_set_mempolicy_home_node 450
443#define __NR_cachestat 451
444#define __NR_fchmodat2 452
439445
lib/libc/musl/arch/loongarch64/atomic_arch.h created+53
......@@ -0,0 +1,53 @@
1#define a_ll a_ll
2static inline int a_ll(volatile int *p)
3{
4 int v;
5 __asm__ __volatile__ (
6 "ll.w %0, %1"
7 : "=r"(v)
8 : "ZC"(*p));
9 return v;
10}
11
12#define a_sc a_sc
13static inline int a_sc(volatile int *p, int v)
14{
15 int r;
16 __asm__ __volatile__ (
17 "sc.w %0, %1"
18 : "=r"(r), "=ZC"(*p)
19 : "0"(v) : "memory");
20 return r;
21}
22
23#define a_ll_p a_ll_p
24static inline void *a_ll_p(volatile void *p)
25{
26 void *v;
27 __asm__ __volatile__ (
28 "ll.d %0, %1"
29 : "=r"(v)
30 : "ZC"(*(void *volatile *)p));
31 return v;
32}
33
34#define a_sc_p a_sc_p
35static inline int a_sc_p(volatile void *p, void *v)
36{
37 long r;
38 __asm__ __volatile__ (
39 "sc.d %0, %1"
40 : "=r"(r), "=ZC"(*(void *volatile *)p)
41 : "0"(v)
42 : "memory");
43 return r;
44}
45
46#define a_barrier a_barrier
47static inline void a_barrier()
48{
49 __asm__ __volatile__ ("dbar 0" : : : "memory");
50}
51
52#define a_pre_llsc a_barrier
53#define a_post_llsc a_barrier
lib/libc/musl/arch/loongarch64/bits/alltypes.h.in created+18
......@@ -0,0 +1,18 @@
1#define _Addr long
2#define _Int64 long
3#define _Reg long
4
5#define __BYTE_ORDER 1234
6#define __LONG_MAX 0x7fffffffffffffffL
7
8#ifndef __cplusplus
9TYPEDEF int wchar_t;
10#endif
11
12TYPEDEF float float_t;
13TYPEDEF double double_t;
14
15TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
16
17TYPEDEF unsigned nlink_t;
18TYPEDEF int blksize_t;
lib/libc/musl/arch/loongarch64/bits/fenv.h created+20
......@@ -0,0 +1,20 @@
1#define FE_INEXACT 0x010000
2#define FE_UNDERFLOW 0x020000
3#define FE_OVERFLOW 0x040000
4#define FE_DIVBYZERO 0x080000
5#define FE_INVALID 0x100000
6
7#define FE_ALL_EXCEPT 0x1F0000
8
9#define FE_TONEAREST 0x000
10#define FE_TOWARDZERO 0x100
11#define FE_UPWARD 0x200
12#define FE_DOWNWARD 0x300
13
14typedef unsigned fexcept_t;
15
16typedef struct {
17 unsigned __cw;
18} fenv_t;
19
20#define FE_DFL_ENV ((const fenv_t *) -1)
lib/libc/musl/arch/loongarch64/bits/float.h created+16
......@@ -0,0 +1,16 @@
1#define FLT_EVAL_METHOD 0
2
3#define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L
4#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L
5#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L
6#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L
7
8#define LDBL_MANT_DIG 113
9#define LDBL_MIN_EXP (-16381)
10#define LDBL_MAX_EXP 16384
11
12#define LDBL_DIG 33
13#define LDBL_MIN_10_EXP (-4931)
14#define LDBL_MAX_10_EXP 4932
15
16#define DECIMAL_DIG 36
lib/libc/musl/arch/loongarch64/bits/posix.h created+2
......@@ -0,0 +1,2 @@
1#define _POSIX_V6_LP64_OFF64 1
2#define _POSIX_V7_LP64_OFF64 1
lib/libc/musl/arch/loongarch64/bits/reg.h created+2
......@@ -0,0 +1,2 @@
1#undef __WORDSIZE
2#define __WORDSIZE 64
lib/libc/musl/arch/loongarch64/bits/setjmp.h created+1
......@@ -0,0 +1 @@
1typedef unsigned long __jmp_buf[23];
lib/libc/musl/arch/loongarch64/bits/signal.h created+101
......@@ -0,0 +1,101 @@
1#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
2 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
3
4#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
5#define MINSIGSTKSZ 4096
6#define SIGSTKSZ 16384
7#endif
8
9#if defined(_GNU_SOURCE)
10#define LARCH_NGREG 32
11#define LARCH_REG_RA 1
12#define LARCH_REG_SP 3
13#define LARCH_REG_S0 23
14#define LARCH_REG_S1 24
15#define LARCH_REG_A0 4
16#define LARCH_REG_S2 25
17#define LARCH_REG_NARGS 8
18#endif
19
20#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
21typedef unsigned long greg_t, gregset_t[32];
22
23struct sigcontext {
24 unsigned long sc_pc;
25 unsigned long sc_regs[32];
26 unsigned sc_flags;
27 unsigned long sc_extcontext[] __attribute__((__aligned__(16)));
28};
29#endif
30
31typedef struct {
32 unsigned long __pc;
33 unsigned long __gregs[32];
34 unsigned __flags;
35 unsigned long __extcontext[] __attribute__((__aligned__(16)));
36} mcontext_t;
37
38struct sigaltstack {
39 void *ss_sp;
40 int ss_flags;
41 size_t ss_size;
42};
43
44typedef struct __ucontext
45{
46 unsigned long uc_flags;
47 struct __ucontext *uc_link;
48 stack_t uc_stack;
49 sigset_t uc_sigmask;
50 long __uc_pad;
51 mcontext_t uc_mcontext;
52} ucontext_t;
53
54#define __uc_flags uc_flags
55
56#define SA_NOCLDSTOP 1
57#define SA_NOCLDWAIT 2
58#define SA_SIGINFO 4
59#define SA_ONSTACK 0x08000000
60#define SA_RESTART 0x10000000
61#define SA_NODEFER 0x40000000
62#define SA_RESETHAND 0x80000000
63
64#endif
65
66#define SIGHUP 1
67#define SIGINT 2
68#define SIGQUIT 3
69#define SIGILL 4
70#define SIGTRAP 5
71#define SIGABRT 6
72#define SIGIOT SIGABRT
73#define SIGBUS 7
74#define SIGFPE 8
75#define SIGKILL 9
76#define SIGUSR1 10
77#define SIGSEGV 11
78#define SIGUSR2 12
79#define SIGPIPE 13
80#define SIGALRM 14
81#define SIGTERM 15
82#define SIGSTKFLT 16
83#define SIGCHLD 17
84#define SIGCONT 18
85#define SIGSTOP 19
86#define SIGTSTP 20
87#define SIGTTIN 21
88#define SIGTTOU 22
89#define SIGURG 23
90#define SIGXCPU 24
91#define SIGXFSZ 25
92#define SIGVTALRM 26
93#define SIGPROF 27
94#define SIGWINCH 28
95#define SIGIO 29
96#define SIGPOLL SIGIO
97#define SIGPWR 30
98#define SIGSYS 31
99#define SIGUNUSED SIGSYS
100
101#define _NSIG 65
lib/libc/musl/arch/loongarch64/bits/stat.h created+18
......@@ -0,0 +1,18 @@
1struct stat {
2 dev_t st_dev;
3 ino_t st_ino;
4 mode_t st_mode;
5 nlink_t st_nlink;
6 uid_t st_uid;
7 gid_t st_gid;
8 dev_t st_rdev;
9 unsigned long __pad;
10 off_t st_size;
11 blksize_t st_blksize;
12 int __pad2;
13 blkcnt_t st_blocks;
14 struct timespec st_atim;
15 struct timespec st_mtim;
16 struct timespec st_ctim;
17 unsigned __unused[2];
18};
lib/libc/musl/arch/loongarch64/bits/stdint.h created+20
......@@ -0,0 +1,20 @@
1typedef int32_t int_fast16_t;
2typedef int32_t int_fast32_t;
3typedef uint32_t uint_fast16_t;
4typedef uint32_t uint_fast32_t;
5
6#define INT_FAST16_MIN INT32_MIN
7#define INT_FAST32_MIN INT32_MIN
8
9#define INT_FAST16_MAX INT32_MAX
10#define INT_FAST32_MAX INT32_MAX
11
12#define UINT_FAST16_MAX UINT32_MAX
13#define UINT_FAST32_MAX UINT32_MAX
14
15#define INTPTR_MIN INT64_MIN
16#define INTPTR_MAX INT64_MAX
17#define UINTPTR_MAX UINT64_MAX
18#define PTRDIFF_MIN INT64_MIN
19#define PTRDIFF_MAX INT64_MAX
20#define SIZE_MAX UINT64_MAX
lib/libc/musl/arch/loongarch64/bits/syscall.h.in created+316
......@@ -0,0 +1,316 @@
1#define __NR_io_setup 0
2#define __NR_io_destroy 1
3#define __NR_io_submit 2
4#define __NR_io_cancel 3
5#define __NR_io_getevents 4
6#define __NR_setxattr 5
7#define __NR_lsetxattr 6
8#define __NR_fsetxattr 7
9#define __NR_getxattr 8
10#define __NR_lgetxattr 9
11#define __NR_fgetxattr 10
12#define __NR_listxattr 11
13#define __NR_llistxattr 12
14#define __NR_flistxattr 13
15#define __NR_removexattr 14
16#define __NR_lremovexattr 15
17#define __NR_fremovexattr 16
18#define __NR_getcwd 17
19#define __NR_lookup_dcookie 18
20#define __NR_eventfd2 19
21#define __NR_epoll_create1 20
22#define __NR_epoll_ctl 21
23#define __NR_epoll_pwait 22
24#define __NR_dup 23
25#define __NR_dup3 24
26#define __NR3264_fcntl 25
27#define __NR_inotify_init1 26
28#define __NR_inotify_add_watch 27
29#define __NR_inotify_rm_watch 28
30#define __NR_ioctl 29
31#define __NR_ioprio_set 30
32#define __NR_ioprio_get 31
33#define __NR_flock 32
34#define __NR_mknodat 33
35#define __NR_mkdirat 34
36#define __NR_unlinkat 35
37#define __NR_symlinkat 36
38#define __NR_linkat 37
39#define __NR_umount2 39
40#define __NR_mount 40
41#define __NR_pivot_root 41
42#define __NR_nfsservctl 42
43#define __NR3264_statfs 43
44#define __NR3264_fstatfs 44
45#define __NR3264_truncate 45
46#define __NR3264_ftruncate 46
47#define __NR_fallocate 47
48#define __NR_faccessat 48
49#define __NR_chdir 49
50#define __NR_fchdir 50
51#define __NR_chroot 51
52#define __NR_fchmod 52
53#define __NR_fchmodat 53
54#define __NR_fchownat 54
55#define __NR_fchown 55
56#define __NR_openat 56
57#define __NR_close 57
58#define __NR_vhangup 58
59#define __NR_pipe2 59
60#define __NR_quotactl 60
61#define __NR_getdents64 61
62#define __NR3264_lseek 62
63#define __NR_read 63
64#define __NR_write 64
65#define __NR_readv 65
66#define __NR_writev 66
67#define __NR_pread64 67
68#define __NR_pwrite64 68
69#define __NR_preadv 69
70#define __NR_pwritev 70
71#define __NR3264_sendfile 71
72#define __NR_pselect6 72
73#define __NR_ppoll 73
74#define __NR_signalfd4 74
75#define __NR_vmsplice 75
76#define __NR_splice 76
77#define __NR_tee 77
78#define __NR_readlinkat 78
79#define __NR_sync 81
80#define __NR_fsync 82
81#define __NR_fdatasync 83
82#define __NR_sync_file_range 84
83#define __NR_timerfd_create 85
84#define __NR_timerfd_settime 86
85#define __NR_timerfd_gettime 87
86#define __NR_utimensat 88
87#define __NR_acct 89
88#define __NR_capget 90
89#define __NR_capset 91
90#define __NR_personality 92
91#define __NR_exit 93
92#define __NR_exit_group 94
93#define __NR_waitid 95
94#define __NR_set_tid_address 96
95#define __NR_unshare 97
96#define __NR_futex 98
97#define __NR_set_robust_list 99
98#define __NR_get_robust_list 100
99#define __NR_nanosleep 101
100#define __NR_getitimer 102
101#define __NR_setitimer 103
102#define __NR_kexec_load 104
103#define __NR_init_module 105
104#define __NR_delete_module 106
105#define __NR_timer_create 107
106#define __NR_timer_gettime 108
107#define __NR_timer_getoverrun 109
108#define __NR_timer_settime 110
109#define __NR_timer_delete 111
110#define __NR_clock_settime 112
111#define __NR_clock_gettime 113
112#define __NR_clock_getres 114
113#define __NR_clock_nanosleep 115
114#define __NR_syslog 116
115#define __NR_ptrace 117
116#define __NR_sched_setparam 118
117#define __NR_sched_setscheduler 119
118#define __NR_sched_getscheduler 120
119#define __NR_sched_getparam 121
120#define __NR_sched_setaffinity 122
121#define __NR_sched_getaffinity 123
122#define __NR_sched_yield 124
123#define __NR_sched_get_priority_max 125
124#define __NR_sched_get_priority_min 126
125#define __NR_sched_rr_get_interval 127
126#define __NR_restart_syscall 128
127#define __NR_kill 129
128#define __NR_tkill 130
129#define __NR_tgkill 131
130#define __NR_sigaltstack 132
131#define __NR_rt_sigsuspend 133
132#define __NR_rt_sigaction 134
133#define __NR_rt_sigprocmask 135
134#define __NR_rt_sigpending 136
135#define __NR_rt_sigtimedwait 137
136#define __NR_rt_sigqueueinfo 138
137#define __NR_rt_sigreturn 139
138#define __NR_setpriority 140
139#define __NR_getpriority 141
140#define __NR_reboot 142
141#define __NR_setregid 143
142#define __NR_setgid 144
143#define __NR_setreuid 145
144#define __NR_setuid 146
145#define __NR_setresuid 147
146#define __NR_getresuid 148
147#define __NR_setresgid 149
148#define __NR_getresgid 150
149#define __NR_setfsuid 151
150#define __NR_setfsgid 152
151#define __NR_times 153
152#define __NR_setpgid 154
153#define __NR_getpgid 155
154#define __NR_getsid 156
155#define __NR_setsid 157
156#define __NR_getgroups 158
157#define __NR_setgroups 159
158#define __NR_uname 160
159#define __NR_sethostname 161
160#define __NR_setdomainname 162
161#define __NR_getrusage 165
162#define __NR_umask 166
163#define __NR_prctl 167
164#define __NR_getcpu 168
165#define __NR_gettimeofday 169
166#define __NR_settimeofday 170
167#define __NR_adjtimex 171
168#define __NR_getpid 172
169#define __NR_getppid 173
170#define __NR_getuid 174
171#define __NR_geteuid 175
172#define __NR_getgid 176
173#define __NR_getegid 177
174#define __NR_gettid 178
175#define __NR_sysinfo 179
176#define __NR_mq_open 180
177#define __NR_mq_unlink 181
178#define __NR_mq_timedsend 182
179#define __NR_mq_timedreceive 183
180#define __NR_mq_notify 184
181#define __NR_mq_getsetattr 185
182#define __NR_msgget 186
183#define __NR_msgctl 187
184#define __NR_msgrcv 188
185#define __NR_msgsnd 189
186#define __NR_semget 190
187#define __NR_semctl 191
188#define __NR_semtimedop 192
189#define __NR_semop 193
190#define __NR_shmget 194
191#define __NR_shmctl 195
192#define __NR_shmat 196
193#define __NR_shmdt 197
194#define __NR_socket 198
195#define __NR_socketpair 199
196#define __NR_bind 200
197#define __NR_listen 201
198#define __NR_accept 202
199#define __NR_connect 203
200#define __NR_getsockname 204
201#define __NR_getpeername 205
202#define __NR_sendto 206
203#define __NR_recvfrom 207
204#define __NR_setsockopt 208
205#define __NR_getsockopt 209
206#define __NR_shutdown 210
207#define __NR_sendmsg 211
208#define __NR_recvmsg 212
209#define __NR_readahead 213
210#define __NR_brk 214
211#define __NR_munmap 215
212#define __NR_mremap 216
213#define __NR_add_key 217
214#define __NR_request_key 218
215#define __NR_keyctl 219
216#define __NR_clone 220
217#define __NR_execve 221
218#define __NR3264_mmap 222
219#define __NR3264_fadvise64 223
220#define __NR_swapon 224
221#define __NR_swapoff 225
222#define __NR_mprotect 226
223#define __NR_msync 227
224#define __NR_mlock 228
225#define __NR_munlock 229
226#define __NR_mlockall 230
227#define __NR_munlockall 231
228#define __NR_mincore 232
229#define __NR_madvise 233
230#define __NR_remap_file_pages 234
231#define __NR_mbind 235
232#define __NR_get_mempolicy 236
233#define __NR_set_mempolicy 237
234#define __NR_migrate_pages 238
235#define __NR_move_pages 239
236#define __NR_rt_tgsigqueueinfo 240
237#define __NR_perf_event_open 241
238#define __NR_accept4 242
239#define __NR_recvmmsg 243
240#define __NR_arch_specific_syscall 244
241#define __NR_wait4 260
242#define __NR_prlimit64 261
243#define __NR_fanotify_init 262
244#define __NR_fanotify_mark 263
245#define __NR_name_to_handle_at 264
246#define __NR_open_by_handle_at 265
247#define __NR_clock_adjtime 266
248#define __NR_syncfs 267
249#define __NR_setns 268
250#define __NR_sendmmsg 269
251#define __NR_process_vm_readv 270
252#define __NR_process_vm_writev 271
253#define __NR_kcmp 272
254#define __NR_finit_module 273
255#define __NR_sched_setattr 274
256#define __NR_sched_getattr 275
257#define __NR_renameat2 276
258#define __NR_seccomp 277
259#define __NR_getrandom 278
260#define __NR_memfd_create 279
261#define __NR_bpf 280
262#define __NR_execveat 281
263#define __NR_userfaultfd 282
264#define __NR_membarrier 283
265#define __NR_mlock2 284
266#define __NR_copy_file_range 285
267#define __NR_preadv2 286
268#define __NR_pwritev2 287
269#define __NR_pkey_mprotect 288
270#define __NR_pkey_alloc 289
271#define __NR_pkey_free 290
272#define __NR_statx 291
273#define __NR_io_pgetevents 292
274#define __NR_rseq 293
275#define __NR_kexec_file_load 294
276#define __NR_pidfd_send_signal 424
277#define __NR_io_uring_setup 425
278#define __NR_io_uring_enter 426
279#define __NR_io_uring_register 427
280#define __NR_open_tree 428
281#define __NR_move_mount 429
282#define __NR_fsopen 430
283#define __NR_fsconfig 431
284#define __NR_fsmount 432
285#define __NR_fspick 433
286#define __NR_pidfd_open 434
287#define __NR_clone3 435
288#define __NR_close_range 436
289#define __NR_openat2 437
290#define __NR_pidfd_getfd 438
291#define __NR_faccessat2 439
292#define __NR_process_madvise 440
293#define __NR_epoll_pwait2 441
294#define __NR_mount_setattr 442
295#define __NR_quotactl_fd 443
296#define __NR_landlock_create_ruleset 444
297#define __NR_landlock_add_rule 445
298#define __NR_landlock_restrict_self 446
299#define __NR_process_mrelease 448
300#define __NR_futex_waitv 449
301#define __NR_set_mempolicy_home_node 450
302#define __NR_cachestat 451
303#define __NR_fchmodat2 452
304#define __NR_map_shadow_stack 453
305#define __NR_futex_wake 454
306#define __NR_futex_wait 455
307#define __NR_futex_requeue 456
308#define __NR_fcntl __NR3264_fcntl
309#define __NR_statfs __NR3264_statfs
310#define __NR_fstatfs __NR3264_fstatfs
311#define __NR_truncate __NR3264_truncate
312#define __NR_ftruncate __NR3264_ftruncate
313#define __NR_lseek __NR3264_lseek
314#define __NR_sendfile __NR3264_sendfile
315#define __NR_mmap __NR3264_mmap
316#define __NR_fadvise64 __NR3264_fadvise64
lib/libc/musl/arch/loongarch64/bits/user.h created+24
......@@ -0,0 +1,24 @@
1#define ELF_NGREG 45
2#define ELF_NFPREG 34
3
4struct user_regs_struct {
5 unsigned long regs[32];
6 unsigned long orig_a0;
7 unsigned long csr_era;
8 unsigned long csr_badv;
9 unsigned long reserved[10];
10};
11
12struct user_fp_struct {
13 unsigned long fpr[32];
14 unsigned long fcc;
15 unsigned int fcsr;
16};
17
18typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
19
20typedef union {
21 double d;
22 float f;
23} elf_fpreg_t;
24typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
lib/libc/musl/arch/loongarch64/crt_arch.h created+13
......@@ -0,0 +1,13 @@
1__asm__(
2".text \n"
3".global " START "\n"
4".type " START ", @function\n"
5START ":\n"
6" move $fp, $zero\n"
7" move $a0, $sp\n"
8".weak _DYNAMIC\n"
9".hidden _DYNAMIC\n"
10" la.local $a1, _DYNAMIC\n"
11" bstrins.d $sp, $zero, 3, 0\n"
12" b " START "_c\n"
13);
lib/libc/musl/arch/loongarch64/pthread_arch.h created+11
......@@ -0,0 +1,11 @@
1static inline uintptr_t __get_tp()
2{
3 register uintptr_t tp __asm__("tp");
4 __asm__ ("" : "=r" (tp) );
5 return tp;
6}
7
8#define TLS_ABOVE_TP
9#define GAP_ABOVE_TP 0
10#define DTP_OFFSET 0
11#define MC_PC __pc
lib/libc/musl/arch/loongarch64/reloc.h created+29
......@@ -0,0 +1,29 @@
1#ifdef __loongarch_soft_float
2#define FP_SUFFIX "-sf"
3#elif defined __loongarch_single_float
4#define FP_SUFFIX "-sp"
5#else
6#define FP_SUFFIX ""
7#endif
8
9#define LDSO_ARCH "loongarch64" FP_SUFFIX
10
11#define TPOFF_K 0
12
13#define REL_PLT R_LARCH_JUMP_SLOT
14#define REL_COPY R_LARCH_COPY
15#define REL_DTPMOD R_LARCH_TLS_DTPMOD64
16#define REL_DTPOFF R_LARCH_TLS_DTPREL64
17#define REL_TPOFF R_LARCH_TLS_TPREL64
18#define REL_RELATIVE R_LARCH_RELATIVE
19#define REL_SYMBOLIC R_LARCH_64
20
21#define CRTJMP(pc,sp) __asm__ __volatile__( \
22 "move $sp, %1 ; jr %0" : : "r"(pc), "r"(sp) : "memory" )
23
24#define GETFUNCSYM(fp, sym, got) __asm__ ( \
25 ".hidden " #sym "\n" \
26 ".align 8 \n" \
27 " la.local $t1, "#sym" \n" \
28 " move %0, $t1 \n" \
29 : "=r"(*(fp)) : : "memory" )
lib/libc/musl/arch/loongarch64/syscall_arch.h created+137
......@@ -0,0 +1,137 @@
1#define __SYSCALL_LL_E(x) (x)
2#define __SYSCALL_LL_O(x) (x)
3
4#define SYSCALL_CLOBBERLIST \
5 "$t0", "$t1", "$t2", "$t3", \
6 "$t4", "$t5", "$t6", "$t7", "$t8", "memory"
7
8static inline long __syscall0(long n)
9{
10 register long a7 __asm__("$a7") = n;
11 register long a0 __asm__("$a0");
12
13 __asm__ __volatile__ (
14 "syscall 0"
15 : "=r"(a0)
16 : "r"(a7)
17 : SYSCALL_CLOBBERLIST);
18 return a0;
19}
20
21static inline long __syscall1(long n, long a)
22{
23 register long a7 __asm__("$a7") = n;
24 register long a0 __asm__("$a0") = a;
25
26 __asm__ __volatile__ (
27 "syscall 0"
28 : "+r"(a0)
29 : "r"(a7)
30 : SYSCALL_CLOBBERLIST);
31 return a0;
32}
33
34static inline long __syscall2(long n, long a, long b)
35{
36 register long a7 __asm__("$a7") = n;
37 register long a0 __asm__("$a0") = a;
38 register long a1 __asm__("$a1") = b;
39
40 __asm__ __volatile__ (
41 "syscall 0"
42 : "+r"(a0)
43 : "r"(a7), "r"(a1)
44 : SYSCALL_CLOBBERLIST);
45 return a0;
46}
47
48static inline long __syscall3(long n, long a, long b, long c)
49{
50 register long a7 __asm__("$a7") = n;
51 register long a0 __asm__("$a0") = a;
52 register long a1 __asm__("$a1") = b;
53 register long a2 __asm__("$a2") = c;
54
55 __asm__ __volatile__ (
56 "syscall 0"
57 : "+r"(a0)
58 : "r"(a7), "r"(a1), "r"(a2)
59 : SYSCALL_CLOBBERLIST);
60 return a0;
61}
62
63static inline long __syscall4(long n, long a, long b, long c, long d)
64{
65 register long a7 __asm__("$a7") = n;
66 register long a0 __asm__("$a0") = a;
67 register long a1 __asm__("$a1") = b;
68 register long a2 __asm__("$a2") = c;
69 register long a3 __asm__("$a3") = d;
70
71 __asm__ __volatile__ (
72 "syscall 0"
73 : "+r"(a0)
74 : "r"(a7), "r"(a1), "r"(a2), "r"(a3)
75 : SYSCALL_CLOBBERLIST);
76 return a0;
77}
78
79static inline long __syscall5(long n, long a, long b, long c, long d, long e)
80{
81 register long a7 __asm__("$a7") = n;
82 register long a0 __asm__("$a0") = a;
83 register long a1 __asm__("$a1") = b;
84 register long a2 __asm__("$a2") = c;
85 register long a3 __asm__("$a3") = d;
86 register long a4 __asm__("$a4") = e;
87
88 __asm__ __volatile__ (
89 "syscall 0"
90 : "+r"(a0)
91 : "r"(a7), "r"(a1), "r"(a2), "r"(a3), "r"(a4)
92 : SYSCALL_CLOBBERLIST);
93 return a0;
94}
95
96static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
97{
98 register long a7 __asm__("$a7") = n;
99 register long a0 __asm__("$a0") = a;
100 register long a1 __asm__("$a1") = b;
101 register long a2 __asm__("$a2") = c;
102 register long a3 __asm__("$a3") = d;
103 register long a4 __asm__("$a4") = e;
104 register long a5 __asm__("$a5") = f;
105
106 __asm__ __volatile__ (
107 "syscall 0"
108 : "+r"(a0)
109 : "r"(a7), "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(a5)
110 : SYSCALL_CLOBBERLIST);
111 return a0;
112}
113
114static inline long __syscall7(long n, long a, long b, long c, long d, long e, long f, long g)
115{
116 register long a7 __asm__("$a7") = n;
117 register long a0 __asm__("$a0") = a;
118 register long a1 __asm__("$a1") = b;
119 register long a2 __asm__("$a2") = c;
120 register long a3 __asm__("$a3") = d;
121 register long a4 __asm__("$a4") = e;
122 register long a5 __asm__("$a5") = f;
123 register long a6 __asm__("$a6") = g;
124
125 __asm__ __volatile__ (
126 "syscall 0"
127 : "+r"(a0)
128 : "r"(a7), "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(a5), "r"(a6)
129 : SYSCALL_CLOBBERLIST);
130 return a0;
131}
132
133#define VDSO_USEFUL
134#define VDSO_CGT_SYM "__vdso_clock_gettime"
135#define VDSO_CGT_VER "LINUX_5.10"
136
137#define IPC_64 0
lib/libc/musl/arch/m68k/bits/syscall.h.in+5
......@@ -416,3 +416,8 @@
416416#define __NR_landlock_create_ruleset 444
417417#define __NR_landlock_add_rule 445
418418#define __NR_landlock_restrict_self 446
419#define __NR_process_mrelease 448
420#define __NR_futex_waitv 449
421#define __NR_set_mempolicy_home_node 450
422#define __NR_cachestat 451
423#define __NR_fchmodat2 452
lib/libc/musl/arch/mips/bits/syscall.h.in+5
......@@ -418,4 +418,9 @@
418418#define __NR_landlock_create_ruleset 4444
419419#define __NR_landlock_add_rule 4445
420420#define __NR_landlock_restrict_self 4446
421#define __NR_process_mrelease 4448
422#define __NR_futex_waitv 4449
423#define __NR_set_mempolicy_home_node 4450
424#define __NR_cachestat 4451
425#define __NR_fchmodat2 4452
421426
lib/libc/musl/arch/mips64/bits/syscall.h.in+5
......@@ -348,4 +348,9 @@
348348#define __NR_landlock_create_ruleset 5444
349349#define __NR_landlock_add_rule 5445
350350#define __NR_landlock_restrict_self 5446
351#define __NR_process_mrelease 5448
352#define __NR_futex_waitv 5449
353#define __NR_set_mempolicy_home_node 5450
354#define __NR_cachestat 5451
355#define __NR_fchmodat2 5452
351356
lib/libc/musl/arch/powerpc/bits/syscall.h.in+5
......@@ -425,4 +425,9 @@
425425#define __NR_landlock_create_ruleset 444
426426#define __NR_landlock_add_rule 445
427427#define __NR_landlock_restrict_self 446
428#define __NR_process_mrelease 448
429#define __NR_futex_waitv 449
430#define __NR_set_mempolicy_home_node 450
431#define __NR_cachestat 451
432#define __NR_fchmodat2 452
428433
lib/libc/musl/arch/powerpc64/bits/syscall.h.in+5
......@@ -397,4 +397,9 @@
397397#define __NR_landlock_create_ruleset 444
398398#define __NR_landlock_add_rule 445
399399#define __NR_landlock_restrict_self 446
400#define __NR_process_mrelease 448
401#define __NR_futex_waitv 449
402#define __NR_set_mempolicy_home_node 450
403#define __NR_cachestat 451
404#define __NR_fchmodat2 452
400405
lib/libc/musl/arch/riscv32/atomic_arch.h created+21
......@@ -0,0 +1,21 @@
1#define a_barrier a_barrier
2static inline void a_barrier()
3{
4 __asm__ __volatile__ ("fence rw,rw" : : : "memory");
5}
6
7#define a_cas a_cas
8static inline int a_cas(volatile int *p, int t, int s)
9{
10 int old, tmp;
11 __asm__ __volatile__ (
12 "\n1: lr.w.aqrl %0, (%2)\n"
13 " bne %0, %3, 1f\n"
14 " sc.w.aqrl %1, %4, (%2)\n"
15 " bnez %1, 1b\n"
16 "1:"
17 : "=&r"(old), "=&r"(tmp)
18 : "r"(p), "r"((long)t), "r"((long)s)
19 : "memory");
20 return old;
21}
lib/libc/musl/arch/riscv32/bits/alltypes.h.in created+18
......@@ -0,0 +1,18 @@
1#define _Addr int
2#define _Int64 long long
3#define _Reg int
4
5#define __BYTE_ORDER 1234
6#define __LONG_MAX 0x7fffffffL
7
8#ifndef __cplusplus
9TYPEDEF int wchar_t;
10#endif
11
12TYPEDEF int blksize_t;
13TYPEDEF unsigned int nlink_t;
14
15TYPEDEF float float_t;
16TYPEDEF double double_t;
17
18TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
lib/libc/musl/arch/riscv32/bits/fenv.h created+17
......@@ -0,0 +1,17 @@
1#define FE_INVALID 16
2#define FE_DIVBYZERO 8
3#define FE_OVERFLOW 4
4#define FE_UNDERFLOW 2
5#define FE_INEXACT 1
6
7#define FE_ALL_EXCEPT 31
8
9#define FE_TONEAREST 0
10#define FE_DOWNWARD 2
11#define FE_UPWARD 3
12#define FE_TOWARDZERO 1
13
14typedef unsigned int fexcept_t;
15typedef unsigned int fenv_t;
16
17#define FE_DFL_ENV ((const fenv_t *) -1)
lib/libc/musl/arch/riscv32/bits/float.h created+16
......@@ -0,0 +1,16 @@
1#define FLT_EVAL_METHOD 0
2
3#define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L
4#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L
5#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L
6#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L
7
8#define LDBL_MANT_DIG 113
9#define LDBL_MIN_EXP (-16381)
10#define LDBL_MAX_EXP 16384
11
12#define LDBL_DIG 33
13#define LDBL_MIN_10_EXP (-4931)
14#define LDBL_MAX_10_EXP 4932
15
16#define DECIMAL_DIG 36
lib/libc/musl/arch/riscv32/bits/ipcstat.h created+1
......@@ -0,0 +1 @@
1#define IPC_STAT 0x102
lib/libc/musl/arch/riscv32/bits/msg.h created+18
......@@ -0,0 +1,18 @@
1struct msqid_ds {
2 struct ipc_perm msg_perm;
3 unsigned long __msg_stime_lo;
4 unsigned long __msg_stime_hi;
5 unsigned long __msg_rtime_lo;
6 unsigned long __msg_rtime_hi;
7 unsigned long __msg_ctime_lo;
8 unsigned long __msg_ctime_hi;
9 unsigned long msg_cbytes;
10 msgqnum_t msg_qnum;
11 msglen_t msg_qbytes;
12 pid_t msg_lspid;
13 pid_t msg_lrpid;
14 unsigned long __unused[2];
15 time_t msg_stime;
16 time_t msg_rtime;
17 time_t msg_ctime;
18};
lib/libc/musl/arch/riscv32/bits/posix.h created+2
......@@ -0,0 +1,2 @@
1#define _POSIX_V6_ILP32_OFFBIG 1
2#define _POSIX_V7_ILP32_OFFBIG 1
lib/libc/musl/arch/riscv32/bits/reg.h created+2
......@@ -0,0 +1,2 @@
1#undef __WORDSIZE
2#define __WORDSIZE 32
lib/libc/musl/arch/riscv32/bits/sem.h created+18
......@@ -0,0 +1,18 @@
1struct semid_ds {
2 struct ipc_perm sem_perm;
3 unsigned long __sem_otime_lo;
4 unsigned long __sem_otime_hi;
5 unsigned long __sem_ctime_lo;
6 unsigned long __sem_ctime_hi;
7#if __BYTE_ORDER == __LITTLE_ENDIAN
8 unsigned short sem_nsems;
9 char __sem_nsems_pad[sizeof(long)-sizeof(short)];
10#else
11 char __sem_nsems_pad[sizeof(long)-sizeof(short)];
12 unsigned short sem_nsems;
13#endif
14 long __unused3;
15 long __unused4;
16 time_t sem_otime;
17 time_t sem_ctime;
18};
lib/libc/musl/arch/riscv32/bits/setjmp.h created+1
......@@ -0,0 +1 @@
1typedef unsigned long long __jmp_buf[19];
lib/libc/musl/arch/riscv32/bits/shm.h created+31
......@@ -0,0 +1,31 @@
1#define SHMLBA 4096
2
3struct shmid_ds {
4 struct ipc_perm shm_perm;
5 size_t shm_segsz;
6 unsigned long __shm_atime_lo;
7 unsigned long __shm_atime_hi;
8 unsigned long __shm_dtime_lo;
9 unsigned long __shm_dtime_hi;
10 unsigned long __shm_ctime_lo;
11 unsigned long __shm_ctime_hi;
12 pid_t shm_cpid;
13 pid_t shm_lpid;
14 unsigned long shm_nattch;
15 unsigned long __pad1;
16 unsigned long __pad2;
17 unsigned long __pad3;
18 time_t shm_atime;
19 time_t shm_dtime;
20 time_t shm_ctime;
21};
22
23struct shminfo {
24 unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
25};
26
27struct shm_info {
28 int __used_ids;
29 unsigned long shm_tot, shm_rss, shm_swp;
30 unsigned long __swap_attempts, __swap_successes;
31};
lib/libc/musl/arch/riscv32/bits/signal.h created+120
......@@ -0,0 +1,120 @@
1#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
2 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
3
4#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
5# define MINSIGSTKSZ 2048
6# define SIGSTKSZ 8192
7#endif
8
9typedef unsigned long __riscv_mc_gp_state[32];
10
11struct __riscv_mc_f_ext_state {
12 unsigned int __f[32];
13 unsigned int __fcsr;
14};
15
16struct __riscv_mc_d_ext_state {
17 unsigned long long __f[32];
18 unsigned int __fcsr;
19};
20
21struct __riscv_mc_q_ext_state {
22 unsigned long long __f[64] __attribute__((aligned(16)));
23 unsigned int __fcsr;
24 unsigned int __reserved[3];
25};
26
27union __riscv_mc_fp_state {
28 struct __riscv_mc_f_ext_state __f;
29 struct __riscv_mc_d_ext_state __d;
30 struct __riscv_mc_q_ext_state __q;
31};
32
33typedef struct mcontext_t {
34 __riscv_mc_gp_state __gregs;
35 union __riscv_mc_fp_state __fpregs;
36} mcontext_t;
37
38#if defined(_GNU_SOURCE)
39#define REG_PC 0
40#define REG_RA 1
41#define REG_SP 2
42#define REG_TP 4
43#define REG_S0 8
44#define REG_S1 9
45#define REG_A0 10
46#define REG_S2 18
47#endif
48
49#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
50typedef unsigned long greg_t;
51typedef unsigned long gregset_t[32];
52typedef union __riscv_mc_fp_state fpregset_t;
53struct sigcontext {
54 gregset_t gregs;
55 fpregset_t fpregs;
56};
57#endif
58
59struct sigaltstack {
60 void *ss_sp;
61 int ss_flags;
62 size_t ss_size;
63};
64
65typedef struct __ucontext
66{
67 unsigned long uc_flags;
68 struct __ucontext *uc_link;
69 stack_t uc_stack;
70 sigset_t uc_sigmask;
71 mcontext_t uc_mcontext;
72} ucontext_t;
73
74#define SA_NOCLDSTOP 1
75#define SA_NOCLDWAIT 2
76#define SA_SIGINFO 4
77#define SA_ONSTACK 0x08000000
78#define SA_RESTART 0x10000000
79#define SA_NODEFER 0x40000000
80#define SA_RESETHAND 0x80000000
81#define SA_RESTORER 0x04000000
82
83#endif
84
85#define SIGHUP 1
86#define SIGINT 2
87#define SIGQUIT 3
88#define SIGILL 4
89#define SIGTRAP 5
90#define SIGABRT 6
91#define SIGIOT SIGABRT
92#define SIGBUS 7
93#define SIGFPE 8
94#define SIGKILL 9
95#define SIGUSR1 10
96#define SIGSEGV 11
97#define SIGUSR2 12
98#define SIGPIPE 13
99#define SIGALRM 14
100#define SIGTERM 15
101#define SIGSTKFLT 16
102#define SIGCHLD 17
103#define SIGCONT 18
104#define SIGSTOP 19
105#define SIGTSTP 20
106#define SIGTTIN 21
107#define SIGTTOU 22
108#define SIGURG 23
109#define SIGXCPU 24
110#define SIGXFSZ 25
111#define SIGVTALRM 26
112#define SIGPROF 27
113#define SIGWINCH 28
114#define SIGIO 29
115#define SIGPOLL SIGIO
116#define SIGPWR 30
117#define SIGSYS 31
118#define SIGUNUSED SIGSYS
119
120#define _NSIG 65
lib/libc/musl/arch/riscv32/bits/stat.h created+18
......@@ -0,0 +1,18 @@
1struct stat {
2 dev_t st_dev;
3 ino_t st_ino;
4 mode_t st_mode;
5 nlink_t st_nlink;
6 uid_t st_uid;
7 gid_t st_gid;
8 dev_t st_rdev;
9 unsigned long long __pad;
10 off_t st_size;
11 blksize_t st_blksize;
12 int __pad2;
13 blkcnt_t st_blocks;
14 struct timespec st_atim;
15 struct timespec st_mtim;
16 struct timespec st_ctim;
17 unsigned __unused[2];
18};
lib/libc/musl/arch/riscv32/bits/stdint.h created+20
......@@ -0,0 +1,20 @@
1typedef int32_t int_fast16_t;
2typedef int32_t int_fast32_t;
3typedef uint32_t uint_fast16_t;
4typedef uint32_t uint_fast32_t;
5
6#define INT_FAST16_MIN INT32_MIN
7#define INT_FAST32_MIN INT32_MIN
8
9#define INT_FAST16_MAX INT32_MAX
10#define INT_FAST32_MAX INT32_MAX
11
12#define UINT_FAST16_MAX UINT32_MAX
13#define UINT_FAST32_MAX UINT32_MAX
14
15#define INTPTR_MIN INT32_MIN
16#define INTPTR_MAX INT32_MAX
17#define UINTPTR_MAX UINT32_MAX
18#define PTRDIFF_MIN INT32_MIN
19#define PTRDIFF_MAX INT32_MAX
20#define SIZE_MAX UINT32_MAX
lib/libc/musl/arch/riscv32/bits/syscall.h.in created+300
......@@ -0,0 +1,300 @@
1#define __NR_io_setup 0
2#define __NR_io_destroy 1
3#define __NR_io_submit 2
4#define __NR_io_cancel 3
5#define __NR_setxattr 5
6#define __NR_lsetxattr 6
7#define __NR_fsetxattr 7
8#define __NR_getxattr 8
9#define __NR_lgetxattr 9
10#define __NR_fgetxattr 10
11#define __NR_listxattr 11
12#define __NR_llistxattr 12
13#define __NR_flistxattr 13
14#define __NR_removexattr 14
15#define __NR_lremovexattr 15
16#define __NR_fremovexattr 16
17#define __NR_getcwd 17
18#define __NR_lookup_dcookie 18
19#define __NR_eventfd2 19
20#define __NR_epoll_create1 20
21#define __NR_epoll_ctl 21
22#define __NR_epoll_pwait 22
23#define __NR_dup 23
24#define __NR_dup3 24
25#define __NR_fcntl64 25
26#define __NR_inotify_init1 26
27#define __NR_inotify_add_watch 27
28#define __NR_inotify_rm_watch 28
29#define __NR_ioctl 29
30#define __NR_ioprio_set 30
31#define __NR_ioprio_get 31
32#define __NR_flock 32
33#define __NR_mknodat 33
34#define __NR_mkdirat 34
35#define __NR_unlinkat 35
36#define __NR_symlinkat 36
37#define __NR_linkat 37
38#define __NR_umount2 39
39#define __NR_mount 40
40#define __NR_pivot_root 41
41#define __NR_nfsservctl 42
42#define __NR_statfs64 43
43#define __NR_fstatfs64 44
44#define __NR_truncate64 45
45#define __NR_ftruncate64 46
46#define __NR_fallocate 47
47#define __NR_faccessat 48
48#define __NR_chdir 49
49#define __NR_fchdir 50
50#define __NR_chroot 51
51#define __NR_fchmod 52
52#define __NR_fchmodat 53
53#define __NR_fchownat 54
54#define __NR_fchown 55
55#define __NR_openat 56
56#define __NR_close 57
57#define __NR_vhangup 58
58#define __NR_pipe2 59
59#define __NR_quotactl 60
60#define __NR_getdents64 61
61#define __NR__llseek 62
62#define __NR_read 63
63#define __NR_write 64
64#define __NR_readv 65
65#define __NR_writev 66
66#define __NR_pread64 67
67#define __NR_pwrite64 68
68#define __NR_preadv 69
69#define __NR_pwritev 70
70#define __NR_sendfile64 71
71#define __NR_signalfd4 74
72#define __NR_vmsplice 75
73#define __NR_splice 76
74#define __NR_tee 77
75#define __NR_readlinkat 78
76#define __NR_sync 81
77#define __NR_fsync 82
78#define __NR_fdatasync 83
79#define __NR_sync_file_range 84
80#define __NR_timerfd_create 85
81#define __NR_acct 89
82#define __NR_capget 90
83#define __NR_capset 91
84#define __NR_personality 92
85#define __NR_exit 93
86#define __NR_exit_group 94
87#define __NR_waitid 95
88#define __NR_set_tid_address 96
89#define __NR_unshare 97
90#define __NR_set_robust_list 99
91#define __NR_get_robust_list 100
92#define __NR_nanosleep 101
93#define __NR_getitimer 102
94#define __NR_setitimer 103
95#define __NR_kexec_load 104
96#define __NR_init_module 105
97#define __NR_delete_module 106
98#define __NR_timer_create 107
99#define __NR_timer_getoverrun 109
100#define __NR_timer_delete 111
101#define __NR_syslog 116
102#define __NR_ptrace 117
103#define __NR_sched_setparam 118
104#define __NR_sched_setscheduler 119
105#define __NR_sched_getscheduler 120
106#define __NR_sched_getparam 121
107#define __NR_sched_setaffinity 122
108#define __NR_sched_getaffinity 123
109#define __NR_sched_yield 124
110#define __NR_sched_get_priority_max 125
111#define __NR_sched_get_priority_min 126
112#define __NR_restart_syscall 128
113#define __NR_kill 129
114#define __NR_tkill 130
115#define __NR_tgkill 131
116#define __NR_sigaltstack 132
117#define __NR_rt_sigsuspend 133
118#define __NR_rt_sigaction 134
119#define __NR_rt_sigprocmask 135
120#define __NR_rt_sigpending 136
121#define __NR_rt_sigqueueinfo 138
122#define __NR_rt_sigreturn 139
123#define __NR_setpriority 140
124#define __NR_getpriority 141
125#define __NR_reboot 142
126#define __NR_setregid 143
127#define __NR_setgid 144
128#define __NR_setreuid 145
129#define __NR_setuid 146
130#define __NR_setresuid 147
131#define __NR_getresuid 148
132#define __NR_setresgid 149
133#define __NR_getresgid 150
134#define __NR_setfsuid 151
135#define __NR_setfsgid 152
136#define __NR_times 153
137#define __NR_setpgid 154
138#define __NR_getpgid 155
139#define __NR_getsid 156
140#define __NR_setsid 157
141#define __NR_getgroups 158
142#define __NR_setgroups 159
143#define __NR_uname 160
144#define __NR_sethostname 161
145#define __NR_setdomainname 162
146#define __NR_getrusage 165
147#define __NR_umask 166
148#define __NR_prctl 167
149#define __NR_getcpu 168
150#define __NR_getpid 172
151#define __NR_getppid 173
152#define __NR_getuid 174
153#define __NR_geteuid 175
154#define __NR_getgid 176
155#define __NR_getegid 177
156#define __NR_gettid 178
157#define __NR_sysinfo 179
158#define __NR_mq_open 180
159#define __NR_mq_unlink 181
160#define __NR_mq_notify 184
161#define __NR_mq_getsetattr 185
162#define __NR_msgget 186
163#define __NR_msgctl 187
164#define __NR_msgrcv 188
165#define __NR_msgsnd 189
166#define __NR_semget 190
167#define __NR_semctl 191
168#define __NR_semop 193
169#define __NR_shmget 194
170#define __NR_shmctl 195
171#define __NR_shmat 196
172#define __NR_shmdt 197
173#define __NR_socket 198
174#define __NR_socketpair 199
175#define __NR_bind 200
176#define __NR_listen 201
177#define __NR_accept 202
178#define __NR_connect 203
179#define __NR_getsockname 204
180#define __NR_getpeername 205
181#define __NR_sendto 206
182#define __NR_recvfrom 207
183#define __NR_setsockopt 208
184#define __NR_getsockopt 209
185#define __NR_shutdown 210
186#define __NR_sendmsg 211
187#define __NR_recvmsg 212
188#define __NR_readahead 213
189#define __NR_brk 214
190#define __NR_munmap 215
191#define __NR_mremap 216
192#define __NR_add_key 217
193#define __NR_request_key 218
194#define __NR_keyctl 219
195#define __NR_clone 220
196#define __NR_execve 221
197#define __NR_mmap2 222
198#define __NR_fadvise64_64 223
199#define __NR_swapon 224
200#define __NR_swapoff 225
201#define __NR_mprotect 226
202#define __NR_msync 227
203#define __NR_mlock 228
204#define __NR_munlock 229
205#define __NR_mlockall 230
206#define __NR_munlockall 231
207#define __NR_mincore 232
208#define __NR_madvise 233
209#define __NR_remap_file_pages 234
210#define __NR_mbind 235
211#define __NR_get_mempolicy 236
212#define __NR_set_mempolicy 237
213#define __NR_migrate_pages 238
214#define __NR_move_pages 239
215#define __NR_rt_tgsigqueueinfo 240
216#define __NR_perf_event_open 241
217#define __NR_accept4 242
218#define __NR_arch_specific_syscall 244
219#define __NR_prlimit64 261
220#define __NR_fanotify_init 262
221#define __NR_fanotify_mark 263
222#define __NR_name_to_handle_at 264
223#define __NR_open_by_handle_at 265
224#define __NR_syncfs 267
225#define __NR_setns 268
226#define __NR_sendmmsg 269
227#define __NR_process_vm_readv 270
228#define __NR_process_vm_writev 271
229#define __NR_kcmp 272
230#define __NR_finit_module 273
231#define __NR_sched_setattr 274
232#define __NR_sched_getattr 275
233#define __NR_renameat2 276
234#define __NR_seccomp 277
235#define __NR_getrandom 278
236#define __NR_memfd_create 279
237#define __NR_bpf 280
238#define __NR_execveat 281
239#define __NR_userfaultfd 282
240#define __NR_membarrier 283
241#define __NR_mlock2 284
242#define __NR_copy_file_range 285
243#define __NR_preadv2 286
244#define __NR_pwritev2 287
245#define __NR_pkey_mprotect 288
246#define __NR_pkey_alloc 289
247#define __NR_pkey_free 290
248#define __NR_statx 291
249#define __NR_rseq 293
250#define __NR_kexec_file_load 294
251#define __NR_clock_gettime64 403
252#define __NR_clock_settime64 404
253#define __NR_clock_adjtime64 405
254#define __NR_clock_getres_time64 406
255#define __NR_clock_nanosleep_time64 407
256#define __NR_timer_gettime64 408
257#define __NR_timer_settime64 409
258#define __NR_timerfd_gettime64 410
259#define __NR_timerfd_settime64 411
260#define __NR_utimensat_time64 412
261#define __NR_pselect6_time64 413
262#define __NR_ppoll_time64 414
263#define __NR_io_pgetevents_time64 416
264#define __NR_recvmmsg_time64 417
265#define __NR_mq_timedsend_time64 418
266#define __NR_mq_timedreceive_time64 419
267#define __NR_semtimedop_time64 420
268#define __NR_rt_sigtimedwait_time64 421
269#define __NR_futex_time64 422
270#define __NR_sched_rr_get_interval_time64 423
271#define __NR_pidfd_send_signal 424
272#define __NR_io_uring_setup 425
273#define __NR_io_uring_enter 426
274#define __NR_io_uring_register 427
275#define __NR_open_tree 428
276#define __NR_move_mount 429
277#define __NR_fsopen 430
278#define __NR_fsconfig 431
279#define __NR_fsmount 432
280#define __NR_fspick 433
281#define __NR_pidfd_open 434
282#define __NR_clone3 435
283#define __NR_openat2 437
284#define __NR_pidfd_getfd 438
285#define __NR_faccessat2 439
286#define __NR_process_madvise 440
287#define __NR_epoll_pwait2 441
288#define __NR_mount_setattr 442
289#define __NR_landlock_create_ruleset 444
290#define __NR_landlock_add_rule 445
291#define __NR_landlock_restrict_self 446
292#define __NR_process_mrelease 448
293#define __NR_futex_waitv 449
294#define __NR_set_mempolicy_home_node 450
295#define __NR_cachestat 451
296#define __NR_fchmodat2 452
297#define __NR_futex __NR_futex_time64
298
299#define __NR_sysriscv __NR_arch_specific_syscall
300#define __NR_riscv_flush_icache (__NR_sysriscv + 15)
lib/libc/musl/arch/riscv32/bits/user.h created+6
......@@ -0,0 +1,6 @@
1#include <signal.h>
2
3#define ELF_NGREG 32
4#define ELF_NFPREG 33
5typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
6typedef union __riscv_mc_fp_state elf_fpregset_t;
lib/libc/musl/arch/riscv32/crt_arch.h created+19
......@@ -0,0 +1,19 @@
1__asm__(
2".section .sdata,\"aw\"\n"
3".text\n"
4".global " START "\n"
5".type " START ",%function\n"
6START ":\n"
7".weak __global_pointer$\n"
8".hidden __global_pointer$\n"
9".option push\n"
10".option norelax\n\t"
11"lla gp, __global_pointer$\n"
12".option pop\n\t"
13"mv a0, sp\n"
14".weak _DYNAMIC\n"
15".hidden _DYNAMIC\n\t"
16"lla a1, _DYNAMIC\n\t"
17"andi sp, sp, -16\n\t"
18"tail " START "_c"
19);
lib/libc/musl/arch/riscv32/kstat.h created
lib/libc/musl/arch/riscv32/pthread_arch.h created+13
......@@ -0,0 +1,13 @@
1static inline uintptr_t __get_tp()
2{
3 uintptr_t tp;
4 __asm__ __volatile__("mv %0, tp" : "=r"(tp));
5 return tp;
6}
7
8#define TLS_ABOVE_TP
9#define GAP_ABOVE_TP 0
10
11#define DTP_OFFSET 0x800
12
13#define MC_PC __gregs[0]
lib/libc/musl/arch/riscv32/reloc.h created+22
......@@ -0,0 +1,22 @@
1#if defined __riscv_float_abi_soft
2#define RISCV_FP_SUFFIX "-sf"
3#elif defined __riscv_float_abi_single
4#define RISCV_FP_SUFFIX "-sp"
5#elif defined __riscv_float_abi_double
6#define RISCV_FP_SUFFIX ""
7#endif
8
9#define LDSO_ARCH "riscv32" RISCV_FP_SUFFIX
10
11#define TPOFF_K 0
12
13#define REL_SYMBOLIC R_RISCV_32
14#define REL_PLT R_RISCV_JUMP_SLOT
15#define REL_RELATIVE R_RISCV_RELATIVE
16#define REL_COPY R_RISCV_COPY
17#define REL_DTPMOD R_RISCV_TLS_DTPMOD32
18#define REL_DTPOFF R_RISCV_TLS_DTPREL32
19#define REL_TPOFF R_RISCV_TLS_TPREL32
20
21#define CRTJMP(pc,sp) __asm__ __volatile__( \
22 "mv sp, %1 ; jr %0" : : "r"(pc), "r"(sp) : "memory" )
lib/libc/musl/arch/riscv32/syscall_arch.h created+80
......@@ -0,0 +1,80 @@
1#define __SYSCALL_LL_E(x) \
2((union { long long ll; long l[2]; }){ .ll = x }).l[0], \
3((union { long long ll; long l[2]; }){ .ll = x }).l[1]
4#define __SYSCALL_LL_O(x) __SYSCALL_LL_E((x))
5
6#define __asm_syscall(...) \
7 __asm__ __volatile__ ("ecall\n\t" \
8 : "=r"(a0) : __VA_ARGS__ : "memory"); \
9 return a0; \
10
11static inline long __syscall0(long n)
12{
13 register long a7 __asm__("a7") = n;
14 register long a0 __asm__("a0");
15 __asm_syscall("r"(a7))
16}
17
18static inline long __syscall1(long n, long a)
19{
20 register long a7 __asm__("a7") = n;
21 register long a0 __asm__("a0") = a;
22 __asm_syscall("r"(a7), "0"(a0))
23}
24
25static inline long __syscall2(long n, long a, long b)
26{
27 register long a7 __asm__("a7") = n;
28 register long a0 __asm__("a0") = a;
29 register long a1 __asm__("a1") = b;
30 __asm_syscall("r"(a7), "0"(a0), "r"(a1))
31}
32
33static inline long __syscall3(long n, long a, long b, long c)
34{
35 register long a7 __asm__("a7") = n;
36 register long a0 __asm__("a0") = a;
37 register long a1 __asm__("a1") = b;
38 register long a2 __asm__("a2") = c;
39 __asm_syscall("r"(a7), "0"(a0), "r"(a1), "r"(a2))
40}
41
42static inline long __syscall4(long n, long a, long b, long c, long d)
43{
44 register long a7 __asm__("a7") = n;
45 register long a0 __asm__("a0") = a;
46 register long a1 __asm__("a1") = b;
47 register long a2 __asm__("a2") = c;
48 register long a3 __asm__("a3") = d;
49 __asm_syscall("r"(a7), "0"(a0), "r"(a1), "r"(a2), "r"(a3))
50}
51
52static inline long __syscall5(long n, long a, long b, long c, long d, long e)
53{
54 register long a7 __asm__("a7") = n;
55 register long a0 __asm__("a0") = a;
56 register long a1 __asm__("a1") = b;
57 register long a2 __asm__("a2") = c;
58 register long a3 __asm__("a3") = d;
59 register long a4 __asm__("a4") = e;
60 __asm_syscall("r"(a7), "0"(a0), "r"(a1), "r"(a2), "r"(a3), "r"(a4))
61}
62
63static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
64{
65 register long a7 __asm__("a7") = n;
66 register long a0 __asm__("a0") = a;
67 register long a1 __asm__("a1") = b;
68 register long a2 __asm__("a2") = c;
69 register long a3 __asm__("a3") = d;
70 register long a4 __asm__("a4") = e;
71 register long a5 __asm__("a5") = f;
72 __asm_syscall("r"(a7), "0"(a0), "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(a5))
73}
74
75#define VDSO_USEFUL
76/* We don't have a clock_gettime function.
77#define VDSO_CGT_SYM "__vdso_clock_gettime"
78#define VDSO_CGT_VER "LINUX_2.6" */
79
80#define IPC_64 0
lib/libc/musl/arch/riscv64/bits/signal.h+2
......@@ -41,7 +41,9 @@ typedef struct mcontext_t {
4141#define REG_SP 2
4242#define REG_TP 4
4343#define REG_S0 8
44#define REG_S1 9
4445#define REG_A0 10
46#define REG_S2 18
4547#endif
4648
4749#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
lib/libc/musl/arch/riscv64/bits/syscall.h.in+5
......@@ -299,6 +299,11 @@
299299#define __NR_landlock_create_ruleset 444
300300#define __NR_landlock_add_rule 445
301301#define __NR_landlock_restrict_self 446
302#define __NR_process_mrelease 448
303#define __NR_futex_waitv 449
304#define __NR_set_mempolicy_home_node 450
305#define __NR_cachestat 451
306#define __NR_fchmodat2 452
302307
303308#define __NR_sysriscv __NR_arch_specific_syscall
304309#define __NR_riscv_flush_icache (__NR_sysriscv + 15)
lib/libc/musl/arch/riscv64/reloc.h+1
......@@ -17,6 +17,7 @@
1717#define REL_DTPMOD R_RISCV_TLS_DTPMOD64
1818#define REL_DTPOFF R_RISCV_TLS_DTPREL64
1919#define REL_TPOFF R_RISCV_TLS_TPREL64
20#define REL_TLSDESC R_RISCV_TLSDESC
2021
2122#define CRTJMP(pc,sp) __asm__ __volatile__( \
2223 "mv sp, %1 ; jr %0" : : "r"(pc), "r"(sp) : "memory" )
lib/libc/musl/arch/s390x/bits/syscall.h.in+6
......@@ -362,4 +362,10 @@
362362#define __NR_landlock_create_ruleset 444
363363#define __NR_landlock_add_rule 445
364364#define __NR_landlock_restrict_self 446
365#define __NR_memfd_secret 447
366#define __NR_process_mrelease 448
367#define __NR_futex_waitv 449
368#define __NR_set_mempolicy_home_node 450
369#define __NR_cachestat 451
370#define __NR_fchmodat2 452
365371
lib/libc/musl/arch/x86_64/bits/syscall.h.in+6
......@@ -355,4 +355,10 @@
355355#define __NR_landlock_create_ruleset 444
356356#define __NR_landlock_add_rule 445
357357#define __NR_landlock_restrict_self 446
358#define __NR_memfd_secret 447
359#define __NR_process_mrelease 448
360#define __NR_futex_waitv 449
361#define __NR_set_mempolicy_home_node 450
362#define __NR_cachestat 451
363#define __NR_fchmodat2 452
358364
lib/libc/musl/include/elf.h+120-7
......@@ -315,7 +315,8 @@ typedef struct {
315315#define EM_RISCV 243
316316#define EM_BPF 247
317317#define EM_CSKY 252
318#define EM_NUM 253
318#define EM_LOONGARCH 258
319#define EM_NUM 259
319320
320321#define EM_ALPHA 0x9026
321322
......@@ -558,6 +559,11 @@ typedef struct {
558559
559560
560561
562typedef Elf32_Word Elf32_Relr;
563typedef Elf64_Xword Elf64_Relr;
564
565
566
561567#define ELF32_R_SYM(val) ((val) >> 8)
562568#define ELF32_R_TYPE(val) ((val) & 0xff)
563569#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff))
......@@ -698,7 +704,14 @@ typedef struct {
698704#define NT_MIPS_DSP 0x800
699705#define NT_MIPS_FP_MODE 0x801
700706#define NT_MIPS_MSA 0x802
707#define NT_RISCV_CSR 0x900
708#define NT_RISCV_VECTOR 0x901
701709#define NT_VERSION 1
710#define NT_LOONGARCH_CPUCFG 0xa00
711#define NT_LOONGARCH_CSR 0xa01
712#define NT_LOONGARCH_LSX 0xa02
713#define NT_LOONGARCH_LASX 0xa03
714#define NT_LOONGARCH_LBT 0xa04
702715
703716
704717
......@@ -3249,6 +3262,7 @@ enum
32493262#define R_RISCV_TLS_DTPREL64 9
32503263#define R_RISCV_TLS_TPREL32 10
32513264#define R_RISCV_TLS_TPREL64 11
3265#define R_RISCV_TLSDESC 12
32523266
32533267#define R_RISCV_BRANCH 16
32543268#define R_RISCV_JAL 17
......@@ -3275,16 +3289,11 @@ enum
32753289#define R_RISCV_SUB16 38
32763290#define R_RISCV_SUB32 39
32773291#define R_RISCV_SUB64 40
3278#define R_RISCV_GNU_VTINHERIT 41
3279#define R_RISCV_GNU_VTENTRY 42
3292#define R_RISCV_GOT32_PCREL 41
32803293#define R_RISCV_ALIGN 43
32813294#define R_RISCV_RVC_BRANCH 44
32823295#define R_RISCV_RVC_JUMP 45
32833296#define R_RISCV_RVC_LUI 46
3284#define R_RISCV_GPREL_I 47
3285#define R_RISCV_GPREL_S 48
3286#define R_RISCV_TPREL_I 49
3287#define R_RISCV_TPREL_S 50
32883297#define R_RISCV_RELAX 51
32893298#define R_RISCV_SUB6 52
32903299#define R_RISCV_SET6 53
......@@ -3292,6 +3301,110 @@ enum
32923301#define R_RISCV_SET16 55
32933302#define R_RISCV_SET32 56
32943303#define R_RISCV_32_PCREL 57
3304#define R_RISCV_IRELATIVE 58
3305#define R_RISCV_PLT32 59
3306#define R_RISCV_SET_ULEB128 60
3307#define R_RISCV_SUB_ULEB128 61
3308#define R_RISCV_TLSDESC_HI20 62
3309#define R_RISCV_TLSDESC_LOAD_LO12 63
3310#define R_RISCV_TLSDESC_ADD_LO12 64
3311#define R_RISCV_TLSDESC_CALL 65
3312
3313#define EF_LARCH_ABI_MODIFIER_MASK 0x07
3314#define EF_LARCH_ABI_SOFT_FLOAT 0x01
3315#define EF_LARCH_ABI_SINGLE_FLOAT 0x02
3316#define EF_LARCH_ABI_DOUBLE_FLOAT 0x03
3317#define EF_LARCH_OBJABI_V1 0x40
3318
3319#define R_LARCH_NONE 0
3320#define R_LARCH_32 1
3321#define R_LARCH_64 2
3322#define R_LARCH_RELATIVE 3
3323#define R_LARCH_COPY 4
3324#define R_LARCH_JUMP_SLOT 5
3325#define R_LARCH_TLS_DTPMOD32 6
3326#define R_LARCH_TLS_DTPMOD64 7
3327#define R_LARCH_TLS_DTPREL32 8
3328#define R_LARCH_TLS_DTPREL64 9
3329#define R_LARCH_TLS_TPREL32 10
3330#define R_LARCH_TLS_TPREL64 11
3331#define R_LARCH_IRELATIVE 12
3332#define R_LARCH_MARK_LA 20
3333#define R_LARCH_MARK_PCREL 21
3334#define R_LARCH_SOP_PUSH_PCREL 22
3335#define R_LARCH_SOP_PUSH_ABSOLUTE 23
3336#define R_LARCH_SOP_PUSH_DUP 24
3337#define R_LARCH_SOP_PUSH_GPREL 25
3338#define R_LARCH_SOP_PUSH_TLS_TPREL 26
3339#define R_LARCH_SOP_PUSH_TLS_GOT 27
3340#define R_LARCH_SOP_PUSH_TLS_GD 28
3341#define R_LARCH_SOP_PUSH_PLT_PCREL 29
3342#define R_LARCH_SOP_ASSERT 30
3343#define R_LARCH_SOP_NOT 31
3344#define R_LARCH_SOP_SUB 32
3345#define R_LARCH_SOP_SL 33
3346#define R_LARCH_SOP_SR 34
3347#define R_LARCH_SOP_ADD 35
3348#define R_LARCH_SOP_AND 36
3349#define R_LARCH_SOP_IF_ELSE 37
3350#define R_LARCH_SOP_POP_32_S_10_5 38
3351#define R_LARCH_SOP_POP_32_U_10_12 39
3352#define R_LARCH_SOP_POP_32_S_10_12 40
3353#define R_LARCH_SOP_POP_32_S_10_16 41
3354#define R_LARCH_SOP_POP_32_S_10_16_S2 42
3355#define R_LARCH_SOP_POP_32_S_5_20 43
3356#define R_LARCH_SOP_POP_32_S_0_5_10_16_S2 44
3357#define R_LARCH_SOP_POP_32_S_0_10_10_16_S2 45
3358#define R_LARCH_SOP_POP_32_U 46
3359#define R_LARCH_ADD8 47
3360#define R_LARCH_ADD16 48
3361#define R_LARCH_ADD24 49
3362#define R_LARCH_ADD32 50
3363#define R_LARCH_ADD64 51
3364#define R_LARCH_SUB8 52
3365#define R_LARCH_SUB16 53
3366#define R_LARCH_SUB24 54
3367#define R_LARCH_SUB32 55
3368#define R_LARCH_SUB64 56
3369#define R_LARCH_GNU_VTINHERIT 57
3370#define R_LARCH_GNU_VTENTRY 58
3371#define R_LARCH_B16 64
3372#define R_LARCH_B21 65
3373#define R_LARCH_B26 66
3374#define R_LARCH_ABS_HI20 67
3375#define R_LARCH_ABS_LO12 68
3376#define R_LARCH_ABS64_LO20 69
3377#define R_LARCH_ABS64_HI12 70
3378#define R_LARCH_PCALA_HI20 71
3379#define R_LARCH_PCALA_LO12 72
3380#define R_LARCH_PCALA64_LO20 73
3381#define R_LARCH_PCALA64_HI12 74
3382#define R_LARCH_GOT_PC_HI20 75
3383#define R_LARCH_GOT_PC_LO12 76
3384#define R_LARCH_GOT64_PC_LO20 77
3385#define R_LARCH_GOT64_PC_HI12 78
3386#define R_LARCH_GOT_HI20 79
3387#define R_LARCH_GOT_LO12 80
3388#define R_LARCH_GOT64_LO20 81
3389#define R_LARCH_GOT64_HI12 82
3390#define R_LARCH_TLS_LE_HI20 83
3391#define R_LARCH_TLS_LE_LO12 84
3392#define R_LARCH_TLS_LE64_LO20 85
3393#define R_LARCH_TLS_LE64_HI12 86
3394#define R_LARCH_TLS_IE_PC_HI20 87
3395#define R_LARCH_TLS_IE_PC_LO12 88
3396#define R_LARCH_TLS_IE64_PC_LO20 89
3397#define R_LARCH_TLS_IE64_PC_HI12 90
3398#define R_LARCH_TLS_IE_HI20 91
3399#define R_LARCH_TLS_IE_LO12 92
3400#define R_LARCH_TLS_IE64_LO20 93
3401#define R_LARCH_TLS_IE64_HI12 94
3402#define R_LARCH_TLS_LD_PC_HI20 95
3403#define R_LARCH_TLS_LD_HI20 96
3404#define R_LARCH_TLS_GD_PC_HI20 97
3405#define R_LARCH_TLS_GD_HI20 98
3406#define R_LARCH_32_PCREL 99
3407#define R_LARCH_RELAX 100
32953408
32963409#ifdef __cplusplus
32973410}
lib/libc/musl/include/fcntl.h+3-1
......@@ -184,7 +184,6 @@ struct f_owner_ex {
184184#define SPLICE_F_MORE 4
185185#define SPLICE_F_GIFT 8
186186int fallocate(int, int, off_t, off_t);
187#define fallocate64 fallocate
188187int name_to_handle_at(int, const char *, struct file_handle *, int *, int);
189188int open_by_handle_at(int, struct file_handle *, int);
190189ssize_t readahead(int, off_t, size_t);
......@@ -207,6 +206,9 @@ ssize_t tee(int, int, size_t, unsigned);
207206#define posix_fadvise64 posix_fadvise
208207#define posix_fallocate64 posix_fallocate
209208#define off64_t off_t
209#if defined(_GNU_SOURCE)
210#define fallocate64 fallocate
211#endif
210212#endif
211213
212214#ifdef __cplusplus
lib/libc/musl/include/poll.h+2-2
......@@ -36,7 +36,7 @@ struct pollfd {
3636
3737int poll (struct pollfd *, nfds_t, int);
3838
39#ifdef _GNU_SOURCE
39#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
4040#define __NEED_time_t
4141#define __NEED_struct_timespec
4242#define __NEED_sigset_t
......@@ -45,7 +45,7 @@ int ppoll(struct pollfd *, nfds_t, const struct timespec *, const sigset_t *);
4545#endif
4646
4747#if _REDIR_TIME64
48#ifdef _GNU_SOURCE
48#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
4949__REDIR(ppoll, __ppoll_time64);
5050#endif
5151#endif
lib/libc/musl/include/stdc-predef.h+5
......@@ -7,7 +7,12 @@
77#define __STDC_IEC_559__ 1
88#endif
99
10#if !defined(__STDC_UTF_16__)
1011#define __STDC_UTF_16__ 1
12#endif
13
14#if !defined(__STDC_UTF_32__)
1115#define __STDC_UTF_32__ 1
16#endif
1217
1318#endif
lib/libc/musl/include/string.h-3
......@@ -95,9 +95,6 @@ char *strchrnul(const char *, int);
9595char *strcasestr(const char *, const char *);
9696void *memrchr(const void *, int, size_t);
9797void *mempcpy(void *, const void *, size_t);
98#ifndef __cplusplus
99char *basename();
100#endif
10198#endif
10299
103100#ifdef __cplusplus
lib/libc/musl/include/sys/stat.h+55
......@@ -18,6 +18,13 @@ extern "C" {
1818#define __NEED_blkcnt_t
1919#define __NEED_struct_timespec
2020
21#ifdef _GNU_SOURCE
22#define __NEED_int64_t
23#define __NEED_uint64_t
24#define __NEED_uint32_t
25#define __NEED_uint16_t
26#endif
27
2128#include <bits/alltypes.h>
2229
2330#include <bits/stat.h>
......@@ -98,6 +105,54 @@ int lchmod(const char *, mode_t);
98105#define S_IEXEC S_IXUSR
99106#endif
100107
108#if defined(_GNU_SOURCE)
109#define STATX_TYPE 1U
110#define STATX_MODE 2U
111#define STATX_NLINK 4U
112#define STATX_UID 8U
113#define STATX_GID 0x10U
114#define STATX_ATIME 0x20U
115#define STATX_MTIME 0x40U
116#define STATX_CTIME 0x80U
117#define STATX_INO 0x100U
118#define STATX_SIZE 0x200U
119#define STATX_BLOCKS 0x400U
120#define STATX_BASIC_STATS 0x7ffU
121#define STATX_BTIME 0x800U
122#define STATX_ALL 0xfffU
123
124struct statx_timestamp {
125 int64_t tv_sec;
126 uint32_t tv_nsec, __pad;
127};
128
129struct statx {
130 uint32_t stx_mask;
131 uint32_t stx_blksize;
132 uint64_t stx_attributes;
133 uint32_t stx_nlink;
134 uint32_t stx_uid;
135 uint32_t stx_gid;
136 uint16_t stx_mode;
137 uint16_t __pad0[1];
138 uint64_t stx_ino;
139 uint64_t stx_size;
140 uint64_t stx_blocks;
141 uint64_t stx_attributes_mask;
142 struct statx_timestamp stx_atime;
143 struct statx_timestamp stx_btime;
144 struct statx_timestamp stx_ctime;
145 struct statx_timestamp stx_mtime;
146 uint32_t stx_rdev_major;
147 uint32_t stx_rdev_minor;
148 uint32_t stx_dev_major;
149 uint32_t stx_dev_minor;
150 uint64_t __pad1[14];
151};
152
153int statx(int, const char *__restrict, int, unsigned, struct statx *__restrict);
154#endif
155
101156#if defined(_LARGEFILE64_SOURCE)
102157#define stat64 stat
103158#define fstat64 fstat
lib/libc/musl/include/sys/statvfs.h+2-1
......@@ -23,7 +23,8 @@ struct statvfs {
2323 unsigned long f_fsid;
2424#endif
2525 unsigned long f_flag, f_namemax;
26 int __reserved[6];
26 unsigned int f_type;
27 int __reserved[5];
2728};
2829
2930int statvfs (const char *__restrict, struct statvfs *__restrict);
lib/libc/musl/include/sys/uio.h+7
......@@ -39,6 +39,13 @@ ssize_t pwritev (int, const struct iovec *, int, off_t);
3939#ifdef _GNU_SOURCE
4040ssize_t process_vm_writev(pid_t, const struct iovec *, unsigned long, const struct iovec *, unsigned long, unsigned long);
4141ssize_t process_vm_readv(pid_t, const struct iovec *, unsigned long, const struct iovec *, unsigned long, unsigned long);
42ssize_t preadv2 (int, const struct iovec *, int, off_t, int);
43ssize_t pwritev2 (int, const struct iovec *, int, off_t, int);
44#define RWF_HIPRI 0x00000001
45#define RWF_DSYNC 0x00000002
46#define RWF_SYNC 0x00000004
47#define RWF_NOWAIT 0x00000008
48#define RWF_APPEND 0x00000010
4249#endif
4350
4451#ifdef __cplusplus
lib/libc/musl/src/fenv/loongarch64/fenv.S created+78
......@@ -0,0 +1,78 @@
1#ifndef __loongarch_soft_float
2
3#ifdef BROKEN_LOONGARCH_FCSR_ASM
4#define FCSR $r0
5#else
6#define FCSR $fcsr0
7#endif
8
9.global feclearexcept
10.type feclearexcept,@function
11feclearexcept:
12 li.w $t0, 0x1f0000
13 and $a0, $a0, $t0
14 movfcsr2gr $t1, FCSR
15 andn $t1, $t1, $a0
16 movgr2fcsr FCSR, $t1
17 li.w $a0, 0
18 jr $ra
19
20.global feraiseexcept
21.type feraiseexcept,@function
22feraiseexcept:
23 li.w $t0, 0x1f0000
24 and $a0, $a0, $t0
25 movfcsr2gr $t1, FCSR
26 or $t1, $t1, $a0
27 movgr2fcsr FCSR, $t1
28 li.w $a0, 0
29 jr $ra
30
31.global fetestexcept
32.type fetestexcept,@function
33fetestexcept:
34 li.w $t0, 0x1f0000
35 and $a0, $a0, $t0
36 movfcsr2gr $t1, FCSR
37 and $a0, $t1, $a0
38 jr $ra
39
40.global fegetround
41.type fegetround,@function
42fegetround:
43 movfcsr2gr $t0, FCSR
44 andi $a0, $t0, 0x300
45 jr $ra
46
47.global __fesetround
48.hidden __fesetround
49.type __fesetround,@function
50__fesetround:
51 li.w $t0, 0x300
52 and $a0, $a0, $t0
53 movfcsr2gr $t1, FCSR
54 andn $t1, $t1, $t0
55 or $t1, $t1, $a0
56 movgr2fcsr FCSR, $t1
57 li.w $a0, 0
58 jr $ra
59
60.global fegetenv
61.type fegetenv,@function
62fegetenv:
63 movfcsr2gr $t0, FCSR
64 st.w $t0, $a0, 0
65 li.w $a0, 0
66 jr $ra
67
68.global fesetenv
69.type fesetenv,@function
70fesetenv:
71 addi.d $t0, $a0, 1
72 beq $t0, $r0, 1f
73 ld.w $t0, $a0, 0
741: movgr2fcsr FCSR, $t0
75 li.w $a0, 0
76 jr $ra
77
78#endif
lib/libc/musl/src/fenv/riscv32/fenv-sf.c created+3
......@@ -0,0 +1,3 @@
1#ifndef __riscv_flen
2#include "../fenv.c"
3#endif
lib/libc/musl/src/fenv/riscv32/fenv.S created+56
......@@ -0,0 +1,56 @@
1#ifdef __riscv_flen
2
3.global feclearexcept
4.type feclearexcept, %function
5feclearexcept:
6 csrc fflags, a0
7 li a0, 0
8 ret
9
10.global feraiseexcept
11.type feraiseexcept, %function
12feraiseexcept:
13 csrs fflags, a0
14 li a0, 0
15 ret
16
17.global fetestexcept
18.type fetestexcept, %function
19fetestexcept:
20 frflags t0
21 and a0, t0, a0
22 ret
23
24.global fegetround
25.type fegetround, %function
26fegetround:
27 frrm a0
28 ret
29
30.global __fesetround
31.type __fesetround, %function
32__fesetround:
33 fsrm t0, a0
34 li a0, 0
35 ret
36
37.global fegetenv
38.type fegetenv, %function
39fegetenv:
40 frcsr t0
41 sw t0, 0(a0)
42 li a0, 0
43 ret
44
45.global fesetenv
46.type fesetenv, %function
47fesetenv:
48 li t2, -1
49 li t1, 0
50 beq a0, t2, 1f
51 lw t1, 0(a0)
521: fscsr t1
53 li a0, 0
54 ret
55
56#endif
lib/libc/musl/src/internal/dynlink.h+4
......@@ -73,6 +73,10 @@ struct fdpic_dummy_loadmap {
7373#define DL_NOMMU_SUPPORT 0
7474#endif
7575
76#ifndef TLSDESC_BACKWARDS
77#define TLSDESC_BACKWARDS 0
78#endif
79
7680#if !DL_FDPIC
7781#define IS_RELATIVE(x,s) ( \
7882 (R_TYPE(x) == REL_RELATIVE) || \
lib/libc/musl/src/internal/emulate_wait4.c created+55
......@@ -0,0 +1,55 @@
1#include <sys/wait.h>
2#include "syscall.h"
3
4#ifndef SYS_wait4
5hidden long __emulate_wait4(int pid, int *status, int options, void *kru, int cp)
6{
7 idtype_t t;
8 int r;
9 siginfo_t info;
10
11 info.si_pid = 0;
12 if (pid < -1) {
13 t = P_PGID;
14 pid = -pid;
15 } else if (pid == -1) {
16 t = P_ALL;
17 } else if (pid == 0) {
18 t = P_PGID;
19 } else {
20 t = P_PID;
21 }
22
23 if (cp) r = __syscall_cp(SYS_waitid, t, pid, &info, options|WEXITED, kru);
24 else r = __syscall(SYS_waitid, t, pid, &info, options|WEXITED, kru);
25
26 if (r<0) return r;
27
28 if (info.si_pid && status) {
29 int sw=0;
30 switch (info.si_code) {
31 case CLD_CONTINUED:
32 sw = 0xffff;
33 break;
34 case CLD_DUMPED:
35 sw = info.si_status&0x7f | 0x80;
36 break;
37 case CLD_EXITED:
38 sw = (info.si_status&0xff) << 8;
39 break;
40 case CLD_KILLED:
41 sw = info.si_status&0x7f;
42 break;
43 case CLD_STOPPED:
44 case CLD_TRAPPED:
45 /* see ptrace(2); the high bits of si_status can contain */
46 /* PTRACE_EVENT_ values which must be preserved */
47 sw = (info.si_status << 8) + 0x7f;
48 break;
49 }
50 *status = sw;
51 }
52
53 return info.si_pid;
54}
55#endif
lib/libc/musl/src/internal/fork_impl.h+2
......@@ -17,3 +17,5 @@ extern hidden volatile int *const __vmlock_lockptr;
1717hidden void __malloc_atfork(int);
1818hidden void __ldso_atfork(int);
1919hidden void __pthread_key_atfork(int);
20
21hidden void __post_Fork(int);
lib/libc/musl/src/internal/syscall.h+12
......@@ -391,6 +391,18 @@ static inline long __alt_socketcall(int sys, int sock, int cp, syscall_arg_t a,
391391#define __sys_open_cp(...) __SYSCALL_DISP(__sys_open_cp,,__VA_ARGS__)
392392#define sys_open_cp(...) __syscall_ret(__sys_open_cp(__VA_ARGS__))
393393
394#ifdef SYS_wait4
395#define __sys_wait4(a,b,c,d) __syscall(SYS_wait4,a,b,c,d)
396#define __sys_wait4_cp(a,b,c,d) __syscall_cp(SYS_wait4,a,b,c,d)
397#else
398hidden long __emulate_wait4(int, int *, int, void *, int);
399#define __sys_wait4(a,b,c,d) __emulate_wait4(a,b,c,d,0)
400#define __sys_wait4_cp(a,b,c,d) __emulate_wait4(a,b,c,d,1)
401#endif
402
403#define sys_wait4(a,b,c,d) __syscall_ret(__sys_wait4(a,b,c,d))
404#define sys_wait4_cp(a,b,c,d) __syscall_ret(__sys_wait4_cp(a,b,c,d))
405
394406hidden void __procfdname(char __buf[static 15+3*sizeof(int)], unsigned);
395407
396408hidden void *__vdsosym(const char *, const char *);
lib/libc/musl/src/internal/version.h+1-1
......@@ -1 +1 @@
1#define VERSION "1.2.4"
1#define VERSION "1.2.5"
lib/libc/musl/src/ldso/loongarch64/dlsym.s created+7
......@@ -0,0 +1,7 @@
1.global dlsym
2.hidden __dlsym
3.type dlsym,@function
4dlsym:
5 move $a2, $ra
6 la.global $t0, __dlsym
7 jr $t0
lib/libc/musl/src/ldso/riscv32/dlsym.s created+6
......@@ -0,0 +1,6 @@
1.global dlsym
2.hidden __dlsym
3.type dlsym, %function
4dlsym:
5 mv a2, ra
6 tail __dlsym
lib/libc/musl/src/ldso/riscv64/tlsdesc.s created+32
......@@ -0,0 +1,32 @@
1.text
2.global __tlsdesc_static
3.hidden __tlsdesc_static
4.type __tlsdesc_static,%function
5__tlsdesc_static:
6 ld a0,8(a0)
7 jr t0
8
9.global __tlsdesc_dynamic
10.hidden __tlsdesc_dynamic
11.type __tlsdesc_dynamic,%function
12__tlsdesc_dynamic:
13 add sp,sp,-16
14 sd t1,(sp)
15 sd t2,8(sp)
16
17 ld t2,-8(tp) # t2=dtv
18
19 ld a0,8(a0) # a0=&{modidx,off}
20 ld t1,8(a0) # t1=off
21 ld a0,(a0) # a0=modidx
22 sll a0,a0,3 # a0=8*modidx
23
24 add a0,a0,t2 # a0=dtv+8*modidx
25 ld a0,(a0) # a0=dtv[modidx]
26 add a0,a0,t1 # a0=dtv[modidx]+off
27 sub a0,a0,tp # a0=dtv[modidx]+off-tp
28
29 ld t1,(sp)
30 ld t2,8(sp)
31 add sp,sp,16
32 jr t0
lib/libc/musl/src/ldso/sh/dlsym.s+1-1
......@@ -5,7 +5,7 @@
55dlsym:
66 mov.l L1, r0
771: braf r0
8 mov.l @r15, r6
8 sts pr, r6
99
1010.align 2
1111L1: .long __dlsym@PLT-(1b+4-.)
lib/libc/musl/src/linux/cache.c+2-1
......@@ -21,7 +21,7 @@ weak_alias(__cachectl, cachectl);
2121#ifdef SYS_riscv_flush_icache
2222
2323#define VDSO_FLUSH_ICACHE_SYM "__vdso_flush_icache"
24#define VDSO_FLUSH_ICACHE_VER "LINUX_4.5"
24#define VDSO_FLUSH_ICACHE_VER "LINUX_4.15"
2525
2626static void *volatile vdso_func;
2727
......@@ -45,6 +45,7 @@ int __riscv_flush_icache(void *start, void *end, unsigned long int flags)
4545 if (!r) return r;
4646 if (r != -ENOSYS) return __syscall_ret(r);
4747 }
48 return syscall(SYS_riscv_flush_icache, start, end, flags);
4849}
4950weak_alias(__riscv_flush_icache, riscv_flush_icache);
5051#endif
lib/libc/musl/src/linux/clone.c+50-6
......@@ -4,18 +4,62 @@
44#include <sched.h>
55#include "pthread_impl.h"
66#include "syscall.h"
7#include "lock.h"
8#include "fork_impl.h"
9
10struct clone_start_args {
11 int (*func)(void *);
12 void *arg;
13 sigset_t sigmask;
14};
15
16static int clone_start(void *arg)
17{
18 struct clone_start_args *csa = arg;
19 __post_Fork(0);
20 __restore_sigs(&csa->sigmask);
21 return csa->func(csa->arg);
22}
723
824int clone(int (*func)(void *), void *stack, int flags, void *arg, ...)
925{
26 struct clone_start_args csa;
1027 va_list ap;
11 pid_t *ptid, *ctid;
12 void *tls;
28 pid_t *ptid = 0, *ctid = 0;
29 void *tls = 0;
30
31 /* Flags that produce an invalid thread/TLS state are disallowed. */
32 int badflags = CLONE_THREAD | CLONE_SETTLS | CLONE_CHILD_CLEARTID;
33
34 if ((flags & badflags) || !stack)
35 return __syscall_ret(-EINVAL);
1336
1437 va_start(ap, arg);
15 ptid = va_arg(ap, pid_t *);
16 tls = va_arg(ap, void *);
17 ctid = va_arg(ap, pid_t *);
38 if (flags & (CLONE_PIDFD | CLONE_PARENT_SETTID | CLONE_CHILD_SETTID))
39 ptid = va_arg(ap, pid_t *);
40 if (flags & CLONE_CHILD_SETTID) {
41 tls = va_arg(ap, void *);
42 ctid = va_arg(ap, pid_t *);
43 }
1844 va_end(ap);
1945
20 return __syscall_ret(__clone(func, stack, flags, arg, ptid, tls, ctid));
46 /* If CLONE_VM is used, it's impossible to give the child a consistent
47 * thread structure. In this case, the best we can do is assume the
48 * caller is content with an extremely restrictive execution context
49 * like the one vfork() would provide. */
50 if (flags & CLONE_VM) return __syscall_ret(
51 __clone(func, stack, flags, arg, ptid, tls, ctid));
52
53 __block_all_sigs(&csa.sigmask);
54 LOCK(__abort_lock);
55
56 /* Setup the a wrapper start function for the child process to do
57 * mimic _Fork in producing a consistent execution state. */
58 csa.func = func;
59 csa.arg = arg;
60 int ret = __clone(clone_start, stack, flags, &csa, ptid, tls, ctid);
61
62 __post_Fork(ret);
63 __restore_sigs(&csa.sigmask);
64 return __syscall_ret(ret);
2165}
lib/libc/musl/src/linux/ppoll.c deleted-26
......@@ -1,26 +0,0 @@
1#define _GNU_SOURCE
2#include <poll.h>
3#include <signal.h>
4#include <errno.h>
5#include "syscall.h"
6
7#define IS32BIT(x) !((x)+0x80000000ULL>>32)
8#define CLAMP(x) (int)(IS32BIT(x) ? (x) : 0x7fffffffU+((0ULL+(x))>>63))
9
10int ppoll(struct pollfd *fds, nfds_t n, const struct timespec *to, const sigset_t *mask)
11{
12 time_t s = to ? to->tv_sec : 0;
13 long ns = to ? to->tv_nsec : 0;
14#ifdef SYS_ppoll_time64
15 int r = -ENOSYS;
16 if (SYS_ppoll == SYS_ppoll_time64 || !IS32BIT(s))
17 r = __syscall_cp(SYS_ppoll_time64, fds, n,
18 to ? ((long long[]){s, ns}) : 0,
19 mask, _NSIG/8);
20 if (SYS_ppoll == SYS_ppoll_time64 || r != -ENOSYS)
21 return __syscall_ret(r);
22 s = CLAMP(s);
23#endif
24 return syscall_cp(SYS_ppoll, fds, n,
25 to ? ((long[]){s, ns}) : 0, mask, _NSIG/8);
26}
lib/libc/musl/src/linux/preadv2.c created+17
......@@ -0,0 +1,17 @@
1#define _GNU_SOURCE
2#include <sys/uio.h>
3#include <unistd.h>
4#include "syscall.h"
5
6ssize_t preadv2(int fd, const struct iovec *iov, int count, off_t ofs, int flags)
7{
8#ifdef SYS_preadv
9 if (!flags) {
10 if (ofs==-1) return readv(fd, iov, count);
11 return syscall_cp(SYS_preadv, fd, iov, count,
12 (long)(ofs), (long)(ofs>>32));
13 }
14#endif
15 return syscall_cp(SYS_preadv2, fd, iov, count,
16 (long)(ofs), (long)(ofs>>32), flags);
17}
lib/libc/musl/src/linux/pwritev2.c created+17
......@@ -0,0 +1,17 @@
1#define _GNU_SOURCE
2#include <sys/uio.h>
3#include <unistd.h>
4#include "syscall.h"
5
6ssize_t pwritev2(int fd, const struct iovec *iov, int count, off_t ofs, int flags)
7{
8#ifdef SYS_pwritev
9 if (!flags) {
10 if (ofs==-1) return writev(fd, iov, count);
11 return syscall_cp(SYS_pwritev, fd, iov, count,
12 (long)(ofs), (long)(ofs>>32));
13 }
14#endif
15 return syscall_cp(SYS_pwritev2, fd, iov, count,
16 (long)(ofs), (long)(ofs>>32), flags);
17}
lib/libc/musl/src/linux/statx.c created+42
......@@ -0,0 +1,42 @@
1#define _GNU_SOURCE
2#include <sys/stat.h>
3#include <string.h>
4#include <syscall.h>
5#include <sys/sysmacros.h>
6#include <errno.h>
7
8int statx(int dirfd, const char *restrict path, int flags, unsigned mask, struct statx *restrict stx)
9{
10 int ret = __syscall(SYS_statx, dirfd, path, flags, mask, stx);
11
12#ifndef SYS_fstatat
13 return __syscall_ret(ret);
14#endif
15
16 if (ret != -ENOSYS) return __syscall_ret(ret);
17
18 struct stat st;
19 ret = fstatat(dirfd, path, &st, flags);
20 if (ret) return ret;
21
22 stx->stx_dev_major = major(st.st_dev);
23 stx->stx_dev_minor = minor(st.st_dev);
24 stx->stx_ino = st.st_ino;
25 stx->stx_mode = st.st_mode;
26 stx->stx_nlink = st.st_nlink;
27 stx->stx_uid = st.st_uid;
28 stx->stx_gid = st.st_gid;
29 stx->stx_size = st.st_size;
30 stx->stx_blksize = st.st_blksize;
31 stx->stx_blocks = st.st_blocks;
32 stx->stx_atime.tv_sec = st.st_atim.tv_sec;
33 stx->stx_atime.tv_nsec = st.st_atim.tv_nsec;
34 stx->stx_mtime.tv_sec = st.st_mtim.tv_sec;
35 stx->stx_mtime.tv_nsec = st.st_mtim.tv_nsec;
36 stx->stx_ctime.tv_sec = st.st_ctim.tv_sec;
37 stx->stx_ctime.tv_nsec = st.st_ctim.tv_nsec;
38 stx->stx_btime = (struct statx_timestamp){.tv_sec=0, .tv_nsec=0};
39 stx->stx_mask = STATX_BASIC_STATS;
40
41 return 0;
42}
lib/libc/musl/src/linux/wait4.c+1-1
......@@ -26,7 +26,7 @@ pid_t wait4(pid_t pid, int *status, int options, struct rusage *ru)
2626 }
2727#endif
2828 char *dest = ru ? (char *)&ru->ru_maxrss - 4*sizeof(long) : 0;
29 r = __syscall(SYS_wait4, pid, status, options, dest);
29 r = __sys_wait4(pid, status, options, dest);
3030 if (r>0 && ru && sizeof(time_t) > sizeof(long)) {
3131 long kru[4];
3232 memcpy(kru, dest, 4*sizeof(long));
lib/libc/musl/src/locale/iconv.c+1-1
......@@ -49,7 +49,7 @@ static const unsigned char charmaps[] =
4949"ucs4\0utf32\0\0\313"
5050"ucs2\0\0\314"
5151"eucjp\0\0\320"
52"shiftjis\0sjis\0\0\321"
52"shiftjis\0sjis\0cp932\0\0\321"
5353"iso2022jp\0\0\322"
5454"gb18030\0\0\330"
5555"gbk\0\0\331"
lib/libc/musl/src/math/acoshl.c+7-3
......@@ -10,14 +10,18 @@ long double acoshl(long double x)
1010long double acoshl(long double x)
1111{
1212 union ldshape u = {x};
13 int e = u.i.se & 0x7fff;
13 int e = u.i.se;
1414
1515 if (e < 0x3fff + 1)
16 /* |x| < 2, invalid if x < 1 or nan */
16 /* 0 <= x < 2, invalid if x < 1 */
1717 return log1pl(x-1 + sqrtl((x-1)*(x-1)+2*(x-1)));
1818 if (e < 0x3fff + 32)
19 /* |x| < 0x1p32 */
19 /* 2 <= x < 0x1p32 */
2020 return logl(2*x - 1/(x+sqrtl(x*x-1)));
21 if (e & 0x8000)
22 /* x < 0 or x = -0, invalid */
23 return (x - x) / (x - x);
24 /* 0x1p32 <= x or nan */
2125 return logl(x) + 0.693147180559945309417232121458176568L;
2226}
2327#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384
lib/libc/musl/src/math/powl.c+21-13
......@@ -212,25 +212,33 @@ long double powl(long double x, long double y)
212212 }
213213 if (x == 1.0)
214214 return 1.0; /* 1**y = 1, even if y is nan */
215 if (x == -1.0 && !isfinite(y))
216 return 1.0; /* -1**inf = 1 */
217215 if (y == 0.0)
218216 return 1.0; /* x**0 = 1, even if x is nan */
219217 if (y == 1.0)
220218 return x;
221 if (y >= LDBL_MAX) {
222 if (x > 1.0 || x < -1.0)
223 return INFINITY;
224 if (x != 0.0)
225 return 0.0;
226 }
227 if (y <= -LDBL_MAX) {
228 if (x > 1.0 || x < -1.0)
219 /* if y*log2(x) < log2(LDBL_TRUE_MIN)-1 then x^y uflows to 0
220 if y*log2(x) > -log2(LDBL_TRUE_MIN)+1 > LDBL_MAX_EXP then x^y oflows
221 if |x|!=1 then |log2(x)| > |log(x)| > LDBL_EPSILON/2 so
222 x^y oflows/uflows if |y|*LDBL_EPSILON/2 > -log2(LDBL_TRUE_MIN)+1 */
223 if (fabsl(y) > 2*(-LDBL_MIN_EXP+LDBL_MANT_DIG+1)/LDBL_EPSILON) {
224 /* y is not an odd int */
225 if (x == -1.0)
226 return 1.0;
227 if (y == INFINITY) {
228 if (x > 1.0 || x < -1.0)
229 return INFINITY;
229230 return 0.0;
230 if (x != 0.0 || y == -INFINITY)
231 }
232 if (y == -INFINITY) {
233 if (x > 1.0 || x < -1.0)
234 return 0.0;
231235 return INFINITY;
236 }
237 if ((x > 1.0 || x < -1.0) == (y > 0))
238 return huge * huge;
239 return twom10000 * twom10000;
232240 }
233 if (x >= LDBL_MAX) {
241 if (x == INFINITY) {
234242 if (y > 0.0)
235243 return INFINITY;
236244 return 0.0;
......@@ -253,7 +261,7 @@ long double powl(long double x, long double y)
253261 yoddint = 1;
254262 }
255263
256 if (x <= -LDBL_MAX) {
264 if (x == -INFINITY) {
257265 if (y > 0.0) {
258266 if (yoddint)
259267 return -INFINITY;
lib/libc/musl/src/math/riscv32/copysign.c created+15
......@@ -0,0 +1,15 @@
1#include <math.h>
2
3#if __riscv_flen >= 64
4
5double copysign(double x, double y)
6{
7 __asm__ ("fsgnj.d %0, %1, %2" : "=f"(x) : "f"(x), "f"(y));
8 return x;
9}
10
11#else
12
13#include "../copysign.c"
14
15#endif
lib/libc/musl/src/math/riscv32/copysignf.c created+15
......@@ -0,0 +1,15 @@
1#include <math.h>
2
3#if __riscv_flen >= 32
4
5float copysignf(float x, float y)
6{
7 __asm__ ("fsgnj.s %0, %1, %2" : "=f"(x) : "f"(x), "f"(y));
8 return x;
9}
10
11#else
12
13#include "../copysignf.c"
14
15#endif
lib/libc/musl/src/math/riscv32/fabs.c created+15
......@@ -0,0 +1,15 @@
1#include <math.h>
2
3#if __riscv_flen >= 64
4
5double fabs(double x)
6{
7 __asm__ ("fabs.d %0, %1" : "=f"(x) : "f"(x));
8 return x;
9}
10
11#else
12
13#include "../fabs.c"
14
15#endif
lib/libc/musl/src/math/riscv32/fabsf.c created+15
......@@ -0,0 +1,15 @@
1#include <math.h>
2
3#if __riscv_flen >= 32
4
5float fabsf(float x)
6{
7 __asm__ ("fabs.s %0, %1" : "=f"(x) : "f"(x));
8 return x;
9}
10
11#else
12
13#include "../fabsf.c"
14
15#endif
lib/libc/musl/src/math/riscv32/fma.c created+15
......@@ -0,0 +1,15 @@
1#include <math.h>
2
3#if __riscv_flen >= 64
4
5double fma(double x, double y, double z)
6{
7 __asm__ ("fmadd.d %0, %1, %2, %3" : "=f"(x) : "f"(x), "f"(y), "f"(z));
8 return x;
9}
10
11#else
12
13#include "../fma.c"
14
15#endif
lib/libc/musl/src/math/riscv32/fmaf.c created+15
......@@ -0,0 +1,15 @@
1#include <math.h>
2
3#if __riscv_flen >= 32
4
5float fmaf(float x, float y, float z)
6{
7 __asm__ ("fmadd.s %0, %1, %2, %3" : "=f"(x) : "f"(x), "f"(y), "f"(z));
8 return x;
9}
10
11#else
12
13#include "../fmaf.c"
14
15#endif
lib/libc/musl/src/math/riscv32/fmax.c created+15
......@@ -0,0 +1,15 @@
1#include <math.h>
2
3#if __riscv_flen >= 64
4
5double fmax(double x, double y)
6{
7 __asm__ ("fmax.d %0, %1, %2" : "=f"(x) : "f"(x), "f"(y));
8 return x;
9}
10
11#else
12
13#include "../fmax.c"
14
15#endif
lib/libc/musl/src/math/riscv32/fmaxf.c created+15
......@@ -0,0 +1,15 @@
1#include <math.h>
2
3#if __riscv_flen >= 32
4
5float fmaxf(float x, float y)
6{
7 __asm__ ("fmax.s %0, %1, %2" : "=f"(x) : "f"(x), "f"(y));
8 return x;
9}
10
11#else
12
13#include "../fmaxf.c"
14
15#endif
lib/libc/musl/src/math/riscv32/fmin.c created+15
......@@ -0,0 +1,15 @@
1#include <math.h>
2
3#if __riscv_flen >= 64
4
5double fmin(double x, double y)
6{
7 __asm__ ("fmin.d %0, %1, %2" : "=f"(x) : "f"(x), "f"(y));
8 return x;
9}
10
11#else
12
13#include "../fmin.c"
14
15#endif
lib/libc/musl/src/math/riscv32/fminf.c created+15
......@@ -0,0 +1,15 @@
1#include <math.h>
2
3#if __riscv_flen >= 32
4
5float fminf(float x, float y)
6{
7 __asm__ ("fmin.s %0, %1, %2" : "=f"(x) : "f"(x), "f"(y));
8 return x;
9}
10
11#else
12
13#include "../fminf.c"
14
15#endif
lib/libc/musl/src/math/riscv32/sqrt.c created+15
......@@ -0,0 +1,15 @@
1#include <math.h>
2
3#if __riscv_flen >= 64
4
5double sqrt(double x)
6{
7 __asm__ ("fsqrt.d %0, %1" : "=f"(x) : "f"(x));
8 return x;
9}
10
11#else
12
13#include "../sqrt.c"
14
15#endif
lib/libc/musl/src/math/riscv32/sqrtf.c created+15
......@@ -0,0 +1,15 @@
1#include <math.h>
2
3#if __riscv_flen >= 32
4
5float sqrtf(float x)
6{
7 __asm__ ("fsqrt.s %0, %1" : "=f"(x) : "f"(x));
8 return x;
9}
10
11#else
12
13#include "../sqrtf.c"
14
15#endif
lib/libc/musl/src/math/sqrtl.c+2-2
......@@ -205,7 +205,7 @@ long double sqrtl(long double x)
205205 top = (top + 0x3fff) >> 1;
206206
207207 /* r ~ 1/sqrt(m) */
208 static const uint64_t three = 0xc0000000;
208 const uint64_t three = 0xc0000000;
209209 uint64_t r, s, d, u, i;
210210 i = (ix.hi >> 42) % 128;
211211 r = (uint32_t)__rsqrt_tab[i] << 16;
......@@ -227,7 +227,7 @@ long double sqrtl(long double x)
227227 r = mul64(u, r) << 1;
228228 /* |r sqrt(m) - 1| < 0x1.c001p-59, switch to 128bit */
229229
230 static const u128 threel = {.hi=three<<32, .lo=0};
230 const u128 threel = {.hi=three<<32, .lo=0};
231231 u128 rl, sl, dl, ul;
232232 rl.hi = r;
233233 rl.lo = 0;
lib/libc/musl/src/misc/mntent.c+41-5
......@@ -20,6 +20,42 @@ int endmntent(FILE *f)
2020 return 1;
2121}
2222
23static char *unescape_ent(char *beg)
24{
25 char *dest = beg;
26 const char *src = beg;
27 while (*src) {
28 const char *val;
29 unsigned char cval = 0;
30 if (*src != '\\') {
31 *dest++ = *src++;
32 continue;
33 }
34 if (src[1] == '\\') {
35 ++src;
36 *dest++ = *src++;
37 continue;
38 }
39 val = src + 1;
40 for (int i = 0; i < 3; ++i) {
41 if (*val >= '0' && *val <= '7') {
42 cval <<= 3;
43 cval += *val++ - '0';
44 } else {
45 break;
46 }
47 }
48 if (cval) {
49 *dest++ = cval;
50 src = val;
51 } else {
52 *dest++ = *src++;
53 }
54 }
55 *dest = 0;
56 return beg;
57}
58
2359struct mntent *getmntent_r(FILE *f, struct mntent *mnt, char *linebuf, int buflen)
2460{
2561 int n[8], use_internal = (linebuf == SENTINEL);
......@@ -45,7 +81,7 @@ struct mntent *getmntent_r(FILE *f, struct mntent *mnt, char *linebuf, int bufle
4581 len = strlen(linebuf);
4682 if (len > INT_MAX) continue;
4783 for (i = 0; i < sizeof n / sizeof *n; i++) n[i] = len;
48 sscanf(linebuf, " %n%*s%n %n%*s%n %n%*s%n %n%*s%n %d %d",
84 sscanf(linebuf, " %n%*[^ \t]%n %n%*[^ \t]%n %n%*[^ \t]%n %n%*[^ \t]%n %d %d",
4985 n, n+1, n+2, n+3, n+4, n+5, n+6, n+7,
5086 &mnt->mnt_freq, &mnt->mnt_passno);
5187 } while (linebuf[n[0]] == '#' || n[1]==len);
......@@ -55,10 +91,10 @@ struct mntent *getmntent_r(FILE *f, struct mntent *mnt, char *linebuf, int bufle
5591 linebuf[n[5]] = 0;
5692 linebuf[n[7]] = 0;
5793
58 mnt->mnt_fsname = linebuf+n[0];
59 mnt->mnt_dir = linebuf+n[2];
60 mnt->mnt_type = linebuf+n[4];
61 mnt->mnt_opts = linebuf+n[6];
94 mnt->mnt_fsname = unescape_ent(linebuf+n[0]);
95 mnt->mnt_dir = unescape_ent(linebuf+n[2]);
96 mnt->mnt_type = unescape_ent(linebuf+n[4]);
97 mnt->mnt_opts = unescape_ent(linebuf+n[6]);
6298
6399 return mnt;
64100}
lib/libc/musl/src/misc/syslog.c+2-1
......@@ -11,6 +11,7 @@
1111#include <fcntl.h>
1212#include "lock.h"
1313#include "fork_impl.h"
14#include "locale_impl.h"
1415
1516static volatile int lock[1];
1617static char log_ident[32];
......@@ -99,7 +100,7 @@ static void _vsyslog(int priority, const char *message, va_list ap)
99100
100101 now = time(NULL);
101102 gmtime_r(&now, &tm);
102 strftime(timebuf, sizeof timebuf, "%b %e %T", &tm);
103 strftime_l(timebuf, sizeof timebuf, "%b %e %T", &tm, C_LOCALE);
103104
104105 pid = (log_opt & LOG_PID) ? getpid() : 0;
105106 l = snprintf(buf, sizeof buf, "<%d>%s %n%s%s%.0d%s: ",
lib/libc/musl/src/multibyte/mbrtowc.c+1-1
......@@ -8,7 +8,7 @@ size_t mbrtowc(wchar_t *restrict wc, const char *restrict src, size_t n, mbstate
88 static unsigned internal_state;
99 unsigned c;
1010 const unsigned char *s = (const void *)src;
11 const unsigned N = n;
11 const size_t N = n;
1212 wchar_t dummy;
1313
1414 if (!st) st = (void *)&internal_state;
lib/libc/musl/src/network/dns_parse.c+2-3
......@@ -12,16 +12,15 @@ int __dns_parse(const unsigned char *r, int rlen, int (*callback)(void *, int, c
1212 p = r+12;
1313 qdcount = r[4]*256 + r[5];
1414 ancount = r[6]*256 + r[7];
15 if (qdcount+ancount > 64) return -1;
1615 while (qdcount--) {
1716 while (p-r < rlen && *p-1U < 127) p++;
18 if (p>r+rlen-6 || *p>193 || (*p==193 && p[1]>254))
17 if (p>r+rlen-6)
1918 return -1;
2019 p += 5 + !!*p;
2120 }
2221 while (ancount--) {
2322 while (p-r < rlen && *p-1U < 127) p++;
24 if (p>r+rlen-12 || *p>193 || (*p==193 && p[1]>254))
23 if (p>r+rlen-12)
2524 return -1;
2625 p += 1 + !!*p;
2726 len = p[8]*256 + p[9];
lib/libc/musl/src/network/getnameinfo.c+3-1
......@@ -162,8 +162,10 @@ int getnameinfo(const struct sockaddr *restrict sa, socklen_t sl,
162162 query[3] = 0; /* don't need AD flag */
163163 int rlen = __res_send(query, qlen, reply, sizeof reply);
164164 buf[0] = 0;
165 if (rlen > 0)
165 if (rlen > 0) {
166 if (rlen > sizeof reply) rlen = sizeof reply;
166167 __dns_parse(reply, rlen, dns_parse_callback, buf);
168 }
167169 }
168170 if (!*buf) {
169171 if (flags & NI_NAMEREQD) return EAI_NONAME;
lib/libc/musl/src/network/lookup_name.c+1-1
......@@ -109,7 +109,7 @@ struct dpc_ctx {
109109#define RR_CNAME 5
110110#define RR_AAAA 28
111111
112#define ABUF_SIZE 768
112#define ABUF_SIZE 4800
113113
114114static int dns_parse_callback(void *c, int rr, const void *data, int len, const void *packet, int plen)
115115{
lib/libc/musl/src/process/_Fork.c+17-11
......@@ -5,24 +5,16 @@
55#include "lock.h"
66#include "pthread_impl.h"
77#include "aio_impl.h"
8#include "fork_impl.h"
89
910static void dummy(int x) { }
1011weak_alias(dummy, __aio_atfork);
1112
12pid_t _Fork(void)
13void __post_Fork(int ret)
1314{
14 pid_t ret;
15 sigset_t set;
16 __block_all_sigs(&set);
17 LOCK(__abort_lock);
18#ifdef SYS_fork
19 ret = __syscall(SYS_fork);
20#else
21 ret = __syscall(SYS_clone, SIGCHLD, 0);
22#endif
2315 if (!ret) {
2416 pthread_t self = __pthread_self();
25 self->tid = __syscall(SYS_gettid);
17 self->tid = __syscall(SYS_set_tid_address, &__thread_list_lock);
2618 self->robust_list.off = 0;
2719 self->robust_list.pending = 0;
2820 self->next = self->prev = self;
......@@ -32,6 +24,20 @@ pid_t _Fork(void)
3224 }
3325 UNLOCK(__abort_lock);
3426 if (!ret) __aio_atfork(1);
27}
28
29pid_t _Fork(void)
30{
31 pid_t ret;
32 sigset_t set;
33 __block_all_sigs(&set);
34 LOCK(__abort_lock);
35#ifdef SYS_fork
36 ret = __syscall(SYS_fork);
37#else
38 ret = __syscall(SYS_clone, SIGCHLD, 0);
39#endif
40 __post_Fork(ret);
3541 __restore_sigs(&set);
3642 return __syscall_ret(ret);
3743}
lib/libc/musl/src/process/posix_spawn.c+6-1
......@@ -4,6 +4,7 @@
44#include <unistd.h>
55#include <signal.h>
66#include <fcntl.h>
7#include <errno.h>
78#include <sys/wait.h>
89#include "syscall.h"
910#include "lock.h"
......@@ -156,7 +157,11 @@ static int child(void *args_vp)
156157fail:
157158 /* Since sizeof errno < PIPE_BUF, the write is atomic. */
158159 ret = -ret;
159 if (ret) while (__syscall(SYS_write, p, &ret, sizeof ret) < 0);
160 if (ret) {
161 int r;
162 do r = __syscall(SYS_write, p, &ret, sizeof ret);
163 while (r<0 && r!=-EPIPE);
164 }
160165 _exit(127);
161166}
162167
lib/libc/musl/src/process/waitpid.c+1-1
......@@ -3,5 +3,5 @@
33
44pid_t waitpid(pid_t pid, int *status, int options)
55{
6 return syscall_cp(SYS_wait4, pid, status, options, 0);
6 return sys_wait4_cp(pid, status, options, 0);
77}
lib/libc/musl/src/regex/glob.c+1-1
......@@ -265,7 +265,7 @@ int glob(const char *restrict pat, int flags, int (*errfunc)(const char *path, i
265265 if (append(&tail, pat, strlen(pat), 0))
266266 return GLOB_NOSPACE;
267267 cnt++;
268 } else
268 } else if (!error)
269269 return GLOB_NOMATCH;
270270 }
271271
lib/libc/musl/src/select/ppoll.c created+26
......@@ -0,0 +1,26 @@
1#define _BSD_SOURCE
2#include <poll.h>
3#include <signal.h>
4#include <errno.h>
5#include "syscall.h"
6
7#define IS32BIT(x) !((x)+0x80000000ULL>>32)
8#define CLAMP(x) (int)(IS32BIT(x) ? (x) : 0x7fffffffU+((0ULL+(x))>>63))
9
10int ppoll(struct pollfd *fds, nfds_t n, const struct timespec *to, const sigset_t *mask)
11{
12 time_t s = to ? to->tv_sec : 0;
13 long ns = to ? to->tv_nsec : 0;
14#ifdef SYS_ppoll_time64
15 int r = -ENOSYS;
16 if (SYS_ppoll == SYS_ppoll_time64 || !IS32BIT(s))
17 r = __syscall_cp(SYS_ppoll_time64, fds, n,
18 to ? ((long long[]){s, ns}) : 0,
19 mask, _NSIG/8);
20 if (SYS_ppoll == SYS_ppoll_time64 || r != -ENOSYS)
21 return __syscall_ret(r);
22 s = CLAMP(s);
23#endif
24 return syscall_cp(SYS_ppoll, fds, n,
25 to ? ((long[]){s, ns}) : 0, mask, _NSIG/8);
26}
lib/libc/musl/src/setjmp/loongarch64/longjmp.S created+32
......@@ -0,0 +1,32 @@
1.global _longjmp
2.global longjmp
3.type _longjmp,@function
4.type longjmp,@function
5_longjmp:
6longjmp:
7 ld.d $ra, $a0, 0
8 ld.d $sp, $a0, 8
9 ld.d $r21,$a0, 16
10 ld.d $fp, $a0, 24
11 ld.d $s0, $a0, 32
12 ld.d $s1, $a0, 40
13 ld.d $s2, $a0, 48
14 ld.d $s3, $a0, 56
15 ld.d $s4, $a0, 64
16 ld.d $s5, $a0, 72
17 ld.d $s6, $a0, 80
18 ld.d $s7, $a0, 88
19 ld.d $s8, $a0, 96
20#ifndef __loongarch_soft_float
21 fld.d $fs0, $a0, 104
22 fld.d $fs1, $a0, 112
23 fld.d $fs2, $a0, 120
24 fld.d $fs3, $a0, 128
25 fld.d $fs4, $a0, 136
26 fld.d $fs5, $a0, 144
27 fld.d $fs6, $a0, 152
28 fld.d $fs7, $a0, 160
29#endif
30 sltui $a0, $a1, 1
31 add.d $a0, $a0, $a1
32 jr $ra
lib/libc/musl/src/setjmp/loongarch64/setjmp.S created+34
......@@ -0,0 +1,34 @@
1.global __setjmp
2.global _setjmp
3.global setjmp
4.type __setjmp,@function
5.type _setjmp,@function
6.type setjmp,@function
7__setjmp:
8_setjmp:
9setjmp:
10 st.d $ra, $a0, 0
11 st.d $sp, $a0, 8
12 st.d $r21,$a0, 16
13 st.d $fp, $a0, 24
14 st.d $s0, $a0, 32
15 st.d $s1, $a0, 40
16 st.d $s2, $a0, 48
17 st.d $s3, $a0, 56
18 st.d $s4, $a0, 64
19 st.d $s5, $a0, 72
20 st.d $s6, $a0, 80
21 st.d $s7, $a0, 88
22 st.d $s8, $a0, 96
23#ifndef __loongarch_soft_float
24 fst.d $fs0, $a0, 104
25 fst.d $fs1, $a0, 112
26 fst.d $fs2, $a0, 120
27 fst.d $fs3, $a0, 128
28 fst.d $fs4, $a0, 136
29 fst.d $fs5, $a0, 144
30 fst.d $fs6, $a0, 152
31 fst.d $fs7, $a0, 160
32#endif
33 move $a0, $zero
34 jr $ra
lib/libc/musl/src/setjmp/riscv32/longjmp.S created+42
......@@ -0,0 +1,42 @@
1.global __longjmp
2.global _longjmp
3.global longjmp
4.type __longjmp, %function
5.type _longjmp, %function
6.type longjmp, %function
7__longjmp:
8_longjmp:
9longjmp:
10 lw s0, 0(a0)
11 lw s1, 4(a0)
12 lw s2, 8(a0)
13 lw s3, 12(a0)
14 lw s4, 16(a0)
15 lw s5, 20(a0)
16 lw s6, 24(a0)
17 lw s7, 28(a0)
18 lw s8, 32(a0)
19 lw s9, 36(a0)
20 lw s10, 40(a0)
21 lw s11, 44(a0)
22 lw sp, 48(a0)
23 lw ra, 52(a0)
24
25#ifndef __riscv_float_abi_soft
26 fld fs0, 56(a0)
27 fld fs1, 64(a0)
28 fld fs2, 72(a0)
29 fld fs3, 80(a0)
30 fld fs4, 88(a0)
31 fld fs5, 96(a0)
32 fld fs6, 104(a0)
33 fld fs7, 112(a0)
34 fld fs8, 120(a0)
35 fld fs9, 128(a0)
36 fld fs10, 136(a0)
37 fld fs11, 144(a0)
38#endif
39
40 seqz a0, a1
41 add a0, a0, a1
42 ret
lib/libc/musl/src/setjmp/riscv32/setjmp.S created+41
......@@ -0,0 +1,41 @@
1.global __setjmp
2.global _setjmp
3.global setjmp
4.type __setjmp, %function
5.type _setjmp, %function
6.type setjmp, %function
7__setjmp:
8_setjmp:
9setjmp:
10 sw s0, 0(a0)
11 sw s1, 4(a0)
12 sw s2, 8(a0)
13 sw s3, 12(a0)
14 sw s4, 16(a0)
15 sw s5, 20(a0)
16 sw s6, 24(a0)
17 sw s7, 28(a0)
18 sw s8, 32(a0)
19 sw s9, 36(a0)
20 sw s10, 40(a0)
21 sw s11, 44(a0)
22 sw sp, 48(a0)
23 sw ra, 52(a0)
24
25#ifndef __riscv_float_abi_soft
26 fsd fs0, 56(a0)
27 fsd fs1, 64(a0)
28 fsd fs2, 72(a0)
29 fsd fs3, 80(a0)
30 fsd fs4, 88(a0)
31 fsd fs5, 96(a0)
32 fsd fs6, 104(a0)
33 fsd fs7, 112(a0)
34 fsd fs8, 120(a0)
35 fsd fs9, 128(a0)
36 fsd fs10, 136(a0)
37 fsd fs11, 144(a0)
38#endif
39
40 li a0, 0
41 ret
lib/libc/musl/src/signal/loongarch64/restore.s created+10
......@@ -0,0 +1,10 @@
1.global __restore_rt
2.global __restore
3.hidden __restore_rt
4.hidden __restore
5.type __restore_rt,@function
6.type __restore,@function
7__restore_rt:
8__restore:
9 li.w $a7, 139
10 syscall 0
lib/libc/musl/src/signal/loongarch64/sigsetjmp.s created+25
......@@ -0,0 +1,25 @@
1.global sigsetjmp
2.global __sigsetjmp
3.type sigsetjmp,@function
4.type __sigsetjmp,@function
5sigsetjmp:
6__sigsetjmp:
7 beq $a1, $zero, 1f
8 st.d $ra, $a0, 184
9 st.d $s0, $a0, 200 #184+8+8
10 move $s0, $a0
11
12 la.global $t0, setjmp
13 jirl $ra, $t0, 0
14
15 move $a1, $a0 # Return from 'setjmp' or 'longjmp'
16 move $a0, $s0
17 ld.d $ra, $a0, 184
18 ld.d $s0, $a0, 200 #184+8+8
19
20.hidden __sigsetjmp_tail
21 la.global $t0, __sigsetjmp_tail
22 jr $t0
231:
24 la.global $t0, setjmp
25 jr $t0
lib/libc/musl/src/signal/riscv32/restore.s created+8
......@@ -0,0 +1,8 @@
1.global __restore
2.type __restore, %function
3__restore:
4.global __restore_rt
5.type __restore_rt, %function
6__restore_rt:
7 li a7, 139 # SYS_rt_sigreturn
8 ecall
lib/libc/musl/src/signal/riscv32/sigsetjmp.s created+23
......@@ -0,0 +1,23 @@
1.global sigsetjmp
2.global __sigsetjmp
3.type sigsetjmp, %function
4.type __sigsetjmp, %function
5sigsetjmp:
6__sigsetjmp:
7 bnez a1, 1f
8 tail setjmp
91:
10
11 sw ra, 152(a0)
12 sw s0, 164(a0)
13 mv s0, a0
14
15 call setjmp
16
17 mv a1, a0
18 mv a0, s0
19 lw s0, 164(a0)
20 lw ra, 152(a0)
21
22.hidden __sigsetjmp_tail
23 tail __sigsetjmp_tail
lib/libc/musl/src/signal/sh/sigsetjmp.s+1-1
......@@ -27,7 +27,7 @@ __sigsetjmp:
2727
2828 mov.l 3f, r0
29294: braf r0
30 mov.l @(4+8,r4), r8
30 mov.l @(4+8,r6), r8
3131
32329: mov.l 5f, r0
33336: braf r0
lib/libc/musl/src/stat/fchmodat.c+5-2
......@@ -5,13 +5,16 @@
55
66int fchmodat(int fd, const char *path, mode_t mode, int flag)
77{
8 if (!flag) return syscall(SYS_fchmodat, fd, path, mode, flag);
8 if (!flag) return syscall(SYS_fchmodat, fd, path, mode);
9
10 int ret = __syscall(SYS_fchmodat2, fd, path, mode, flag);
11 if (ret != -ENOSYS) return __syscall_ret(ret);
912
1013 if (flag != AT_SYMLINK_NOFOLLOW)
1114 return __syscall_ret(-EINVAL);
1215
1316 struct stat st;
14 int ret, fd2;
17 int fd2;
1518 char proc[15+3*sizeof(int)];
1619
1720 if (fstatat(fd, path, &st, flag))
lib/libc/musl/src/stat/fstatat.c+1
......@@ -36,6 +36,7 @@ static int fstatat_statx(int fd, const char *restrict path, struct stat *restric
3636{
3737 struct statx stx;
3838
39 flag |= AT_NO_AUTOMOUNT;
3940 int ret = __syscall(SYS_statx, fd, path, flag, 0x7ff, &stx);
4041 if (ret) return ret;
4142
lib/libc/musl/src/stat/statvfs.c+1
......@@ -39,6 +39,7 @@ static void fixup(struct statvfs *out, const struct statfs *in)
3939 out->f_fsid = in->f_fsid.__val[0];
4040 out->f_flag = in->f_flags;
4141 out->f_namemax = in->f_namelen;
42 out->f_type = in->f_type;
4243}
4344
4445int statvfs(const char *restrict path, struct statvfs *restrict buf)
lib/libc/musl/src/stdio/pclose.c+1-1
......@@ -7,7 +7,7 @@ int pclose(FILE *f)
77 int status, r;
88 pid_t pid = f->pipe_pid;
99 fclose(f);
10 while ((r=__syscall(SYS_wait4, pid, &status, 0, 0)) == -EINTR);
10 while ((r=__sys_wait4(pid, &status, 0, 0)) == -EINTR);
1111 if (r<0) return __syscall_ret(r);
1212 return status;
1313}
lib/libc/musl/src/stdio/vfprintf.c+5-3
......@@ -52,7 +52,7 @@ static const unsigned char states[]['z'-'A'+1] = {
5252 S('o') = UINT, S('u') = UINT, S('x') = UINT, S('X') = UINT,
5353 S('e') = DBL, S('f') = DBL, S('g') = DBL, S('a') = DBL,
5454 S('E') = DBL, S('F') = DBL, S('G') = DBL, S('A') = DBL,
55 S('c') = CHAR, S('C') = INT,
55 S('c') = INT, S('C') = UINT,
5656 S('s') = PTR, S('S') = PTR, S('p') = UIPTR, S('n') = PTR,
5757 S('m') = NOARG,
5858 S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
......@@ -62,7 +62,7 @@ static const unsigned char states[]['z'-'A'+1] = {
6262 S('o') = ULONG, S('u') = ULONG, S('x') = ULONG, S('X') = ULONG,
6363 S('e') = DBL, S('f') = DBL, S('g') = DBL, S('a') = DBL,
6464 S('E') = DBL, S('F') = DBL, S('G') = DBL, S('A') = DBL,
65 S('c') = INT, S('s') = PTR, S('n') = PTR,
65 S('c') = UINT, S('s') = PTR, S('n') = PTR,
6666 S('l') = LLPRE,
6767 }, { /* 2: ll-prefixed */
6868 S('d') = LLONG, S('i') = LLONG,
......@@ -437,7 +437,7 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg,
437437 unsigned st, ps;
438438 int cnt=0, l=0;
439439 size_t i;
440 char buf[sizeof(uintmax_t)*3+3+LDBL_MANT_DIG/4];
440 char buf[sizeof(uintmax_t)*3];
441441 const char *prefix;
442442 int t, pl;
443443 wchar_t wc[2], *ws;
......@@ -588,6 +588,7 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg,
588588 }
589589 p = MAX(p, z-a + !arg.i);
590590 break;
591 narrow_c:
591592 case 'c':
592593 *(a=z-(p=1))=arg.i;
593594 fl &= ~ZERO_PAD;
......@@ -602,6 +603,7 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg,
602603 fl &= ~ZERO_PAD;
603604 break;
604605 case 'C':
606 if (!arg.i) goto narrow_c;
605607 wc[0] = arg.i;
606608 wc[1] = 0;
607609 arg.p = wc;
lib/libc/musl/src/stdio/vfwprintf.c+2-2
......@@ -45,7 +45,7 @@ static const unsigned char states[]['z'-'A'+1] = {
4545 S('o') = UINT, S('u') = UINT, S('x') = UINT, S('X') = UINT,
4646 S('e') = DBL, S('f') = DBL, S('g') = DBL, S('a') = DBL,
4747 S('E') = DBL, S('F') = DBL, S('G') = DBL, S('A') = DBL,
48 S('c') = CHAR, S('C') = INT,
48 S('c') = INT, S('C') = UINT,
4949 S('s') = PTR, S('S') = PTR, S('p') = UIPTR, S('n') = PTR,
5050 S('m') = NOARG,
5151 S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
......@@ -55,7 +55,7 @@ static const unsigned char states[]['z'-'A'+1] = {
5555 S('o') = ULONG, S('u') = ULONG, S('x') = ULONG, S('X') = ULONG,
5656 S('e') = DBL, S('f') = DBL, S('g') = DBL, S('a') = DBL,
5757 S('E') = DBL, S('F') = DBL, S('G') = DBL, S('A') = DBL,
58 S('c') = INT, S('s') = PTR, S('n') = PTR,
58 S('c') = UINT, S('s') = PTR, S('n') = PTR,
5959 S('l') = LLPRE,
6060 }, { /* 2: ll-prefixed */
6161 S('d') = LLONG, S('i') = LLONG,
lib/libc/musl/src/stdio/vsnprintf.c-5
......@@ -45,11 +45,6 @@ int vsnprintf(char *restrict s, size_t n, const char *restrict fmt, va_list ap)
4545 .cookie = &c,
4646 };
4747
48 if (n > INT_MAX) {
49 errno = EOVERFLOW;
50 return -1;
51 }
52
5348 *c.s = 0;
5449 return vfprintf(&f, fmt, ap);
5550}
lib/libc/musl/src/stdio/vswprintf.c-3
......@@ -51,9 +51,6 @@ int vswprintf(wchar_t *restrict s, size_t n, const wchar_t *restrict fmt, va_lis
5151
5252 if (!n) {
5353 return -1;
54 } else if (n > INT_MAX) {
55 errno = EOVERFLOW;
56 return -1;
5754 }
5855 r = vfwprintf(&f, fmt, ap);
5956 sw_write(&f, 0, 0);
lib/libc/musl/src/thread/loongarch64/__set_thread_area.s created+7
......@@ -0,0 +1,7 @@
1.global __set_thread_area
2.hidden __set_thread_area
3.type __set_thread_area,@function
4__set_thread_area:
5 move $tp, $a0
6 move $a0, $zero
7 jr $ra
lib/libc/musl/src/thread/loongarch64/__unmapself.s created+7
......@@ -0,0 +1,7 @@
1.global __unmapself
2.type __unmapself, @function
3__unmapself:
4 li.d $a7, 215 # call munmap
5 syscall 0
6 li.d $a7, 93 # call exit
7 syscall 0
lib/libc/musl/src/thread/loongarch64/clone.s created+29
......@@ -0,0 +1,29 @@
1#__clone(func, stack, flags, arg, ptid, tls, ctid)
2# a0, a1, a2, a3, a4, a5, a6
3# sys_clone(flags, stack, ptid, ctid, tls)
4# a0, a1, a2, a3, a4
5
6.global __clone
7.hidden __clone
8.type __clone,@function
9__clone:
10 bstrins.d $a1, $zero, 3, 0 #stack to 16 align
11 # Save function pointer and argument pointer on new thread stack
12 addi.d $a1, $a1, -16
13 st.d $a0, $a1, 0 # save function pointer
14 st.d $a3, $a1, 8 # save argument pointer
15 or $a0, $a2, $zero
16 or $a2, $a4, $zero
17 or $a3, $a6, $zero
18 or $a4, $a5, $zero
19 ori $a7, $zero, 220
20 syscall 0 # call clone
21
22 beqz $a0, 1f # whether child process
23 jirl $zero, $ra, 0 # parent process return
241:
25 ld.d $t8, $sp, 0 # function pointer
26 ld.d $a0, $sp, 8 # argument pointer
27 jirl $ra, $t8, 0 # call the user's function
28 ori $a7, $zero, 93
29 syscall 0 # child process exit
lib/libc/musl/src/thread/loongarch64/syscall_cp.s created+29
......@@ -0,0 +1,29 @@
1.global __cp_begin
2.hidden __cp_begin
3.global __cp_end
4.hidden __cp_end
5.global __cp_cancel
6.hidden __cp_cancel
7.hidden __cancel
8.global __syscall_cp_asm
9.hidden __syscall_cp_asm
10.type __syscall_cp_asm,@function
11
12__syscall_cp_asm:
13__cp_begin:
14 ld.w $a0, $a0, 0
15 bnez $a0, __cp_cancel
16 move $t8, $a1 # reserve system call number
17 move $a0, $a2
18 move $a1, $a3
19 move $a2, $a4
20 move $a3, $a5
21 move $a4, $a6
22 move $a5, $a7
23 move $a7, $t8
24 syscall 0
25__cp_end:
26 jr $ra
27__cp_cancel:
28 la.local $t8, __cancel
29 jr $t8
lib/libc/musl/src/thread/riscv32/__set_thread_area.s created+6
......@@ -0,0 +1,6 @@
1.global __set_thread_area
2.type __set_thread_area, %function
3__set_thread_area:
4 mv tp, a0
5 li a0, 0
6 ret
lib/libc/musl/src/thread/riscv32/__unmapself.s created+7
......@@ -0,0 +1,7 @@
1.global __unmapself
2.type __unmapself, %function
3__unmapself:
4 li a7, 215 # SYS_munmap
5 ecall
6 li a7, 93 # SYS_exit
7 ecall
lib/libc/musl/src/thread/riscv32/clone.s created+34
......@@ -0,0 +1,34 @@
1# __clone(func, stack, flags, arg, ptid, tls, ctid)
2# a0, a1, a2, a3, a4, a5, a6
3
4# syscall(SYS_clone, flags, stack, ptid, tls, ctid)
5# a7 a0, a1, a2, a3, a4
6
7.global __clone
8.type __clone, %function
9__clone:
10 # Save func and arg to stack
11 addi a1, a1, -16
12 sw a0, 0(a1)
13 sw a3, 4(a1)
14
15 # Call SYS_clone
16 mv a0, a2
17 mv a2, a4
18 mv a3, a5
19 mv a4, a6
20 li a7, 220 # SYS_clone
21 ecall
22
23 beqz a0, 1f
24 # Parent
25 ret
26
27 # Child
281: lw a1, 0(sp)
29 lw a0, 4(sp)
30 jalr a1
31
32 # Exit
33 li a7, 93 # SYS_exit
34 ecall
lib/libc/musl/src/thread/riscv32/syscall_cp.s created+29
......@@ -0,0 +1,29 @@
1.global __cp_begin
2.hidden __cp_begin
3.global __cp_end
4.hidden __cp_end
5.global __cp_cancel
6.hidden __cp_cancel
7.hidden __cancel
8.global __syscall_cp_asm
9.hidden __syscall_cp_asm
10.type __syscall_cp_asm, %function
11__syscall_cp_asm:
12__cp_begin:
13 lw t0, 0(a0)
14 bnez t0, __cp_cancel
15
16 mv t0, a1
17 mv a0, a2
18 mv a1, a3
19 mv a2, a4
20 mv a3, a5
21 mv a4, a6
22 mv a5, a7
23 lw a6, 0(sp)
24 mv a7, t0
25 ecall
26__cp_end:
27 ret
28__cp_cancel:
29 tail __cancel
lib/libc/musl/src/thread/synccall.c+5-3
......@@ -11,7 +11,7 @@ weak_alias(dummy_0, __tl_unlock);
1111
1212static int target_tid;
1313static void (*callback)(void *), *context;
14static sem_t target_sem, caller_sem;
14static sem_t target_sem, caller_sem, exit_sem;
1515
1616static void dummy(void *p)
1717{
......@@ -33,7 +33,7 @@ static void handler(int sig)
3333 /* Inform caller we've complered the callback and wait
3434 * for the caller to release us to return. */
3535 sem_post(&caller_sem);
36 sem_wait(&target_sem);
36 sem_wait(&exit_sem);
3737
3838 /* Inform caller we are returning and state is destroyable. */
3939 sem_post(&caller_sem);
......@@ -62,6 +62,7 @@ void __synccall(void (*func)(void *), void *ctx)
6262
6363 sem_init(&target_sem, 0, 0);
6464 sem_init(&caller_sem, 0, 0);
65 sem_init(&exit_sem, 0, 0);
6566
6667 if (!libc.threads_minus_1 || __syscall(SYS_gettid) != self->tid)
6768 goto single_threaded;
......@@ -107,12 +108,13 @@ single_threaded:
107108 /* Only release the caught threads once all threads, including the
108109 * caller, have returned from the callback function. */
109110 for (i=0; i<count; i++)
110 sem_post(&target_sem);
111 sem_post(&exit_sem);
111112 for (i=0; i<count; i++)
112113 sem_wait(&caller_sem);
113114
114115 sem_destroy(&caller_sem);
115116 sem_destroy(&target_sem);
117 sem_destroy(&exit_sem);
116118
117119 pthread_setcancelstate(cs, 0);
118120 __tl_unlock();
lib/libc/musl/src/time/__year_to_secs.c+2-2
......@@ -10,9 +10,9 @@ long long __year_to_secs(long long year, int *is_leap)
1010 return 31536000*(y-70) + 86400*leaps;
1111 }
1212
13 int cycles, centuries, leaps, rem;
13 int cycles, centuries, leaps, rem, dummy;
1414
15 if (!is_leap) is_leap = &(int){0};
15 if (!is_leap) is_leap = &dummy;
1616 cycles = (year-100) / 400;
1717 rem = (year-100) % 400;
1818 if (rem < 0) {
lib/libc/musl/src/time/strftime.c+7-1
......@@ -3,6 +3,7 @@
33#include <string.h>
44#include <langinfo.h>
55#include <locale.h>
6#include <ctype.h>
67#include <time.h>
78#include <limits.h>
89#include "locale_impl.h"
......@@ -233,7 +234,12 @@ size_t __strftime_l(char *restrict s, size_t n, const char *restrict f, const st
233234 pad = 0;
234235 if (*f == '-' || *f == '_' || *f == '0') pad = *f++;
235236 if ((plus = (*f == '+'))) f++;
236 width = strtoul(f, &p, 10);
237 if (isdigit(*f)) {
238 width = strtoul(f, &p, 10);
239 } else {
240 width = 0;
241 p = (void *)f;
242 }
237243 if (*p == 'C' || *p == 'F' || *p == 'G' || *p == 'Y') {
238244 if (!width && p!=f) width = 1;
239245 } else {
lib/libc/musl/src/time/timer_create.c+1-1
......@@ -61,7 +61,7 @@ static void *start(void *arg)
6161
6262int timer_create(clockid_t clk, struct sigevent *restrict evp, timer_t *restrict res)
6363{
64 volatile static int init = 0;
64 static volatile int init = 0;
6565 pthread_t td;
6666 pthread_attr_t attr;
6767 int r;
lib/libc/musl/src/unistd/faccessat.c+1-1
......@@ -53,7 +53,7 @@ int faccessat(int fd, const char *filename, int amode, int flag)
5353 if (pid<0 || __syscall(SYS_read, p[0], &ret, sizeof ret) != sizeof(ret))
5454 ret = -EBUSY;
5555 __syscall(SYS_close, p[0]);
56 __syscall(SYS_wait4, pid, &status, __WCLONE, 0);
56 __sys_wait4(pid, &status, __WCLONE, 0);
5757
5858 __restore_sigs(&set);
5959
lib/libc/musl/src/unistd/setxid.c+1-1
......@@ -30,5 +30,5 @@ int __setxid(int nr, int id, int eid, int sid)
3030 * trigger the safety kill above. */
3131 struct ctx c = { .nr = nr, .id = id, .eid = eid, .sid = sid, .ret = 1 };
3232 __synccall(do_setxid, &c);
33 return __syscall_ret(c.ret);
33 return __syscall_ret(c.ret > 0 ? -EAGAIN : c.ret);
3434}
lib/std/zig/target.zig+2
......@@ -102,10 +102,12 @@ pub fn muslArchName(arch: std.Target.Cpu.Arch) [:0]const u8 {
102102 .aarch64, .aarch64_be => return "aarch64",
103103 .arm, .armeb, .thumb, .thumbeb => return "arm",
104104 .x86 => return "i386",
105 .loongarch64 => return "loongarch64",
105106 .mips, .mipsel => return "mips",
106107 .mips64el, .mips64 => return "mips64",
107108 .powerpc => return "powerpc",
108109 .powerpc64, .powerpc64le => return "powerpc64",
110 .riscv32 => return "riscv32",
109111 .riscv64 => return "riscv64",
110112 .s390x => return "s390x",
111113 .wasm32, .wasm64 => return "wasm",
src/musl.zig+41-1
......@@ -314,6 +314,7 @@ fn isMuslArchName(name: []const u8) bool {
314314 "arm",
315315 "generic",
316316 "i386",
317 "loongarch64",
317318 "m68k",
318319 "microblaze",
319320 "mips",
......@@ -322,6 +323,7 @@ fn isMuslArchName(name: []const u8) bool {
322323 "or1k",
323324 "powerpc",
324325 "powerpc64",
326 "riscv32",
325327 "riscv64",
326328 "s390x",
327329 "sh",
......@@ -607,6 +609,7 @@ const src_files = [_][]const u8{
607609 "musl/src/fenv/fesetround.c",
608610 "musl/src/fenv/feupdateenv.c",
609611 "musl/src/fenv/i386/fenv.s",
612 "musl/src/fenv/loongarch64/fenv.S",
610613 "musl/src/fenv/m68k/fenv.c",
611614 "musl/src/fenv/mips/fenv-sf.c",
612615 "musl/src/fenv/mips/fenv.S",
......@@ -617,6 +620,8 @@ const src_files = [_][]const u8{
617620 "musl/src/fenv/powerpc/fenv-sf.c",
618621 "musl/src/fenv/powerpc/fenv.S",
619622 "musl/src/fenv/powerpc64/fenv.c",
623 "musl/src/fenv/riscv32/fenv-sf.c",
624 "musl/src/fenv/riscv32/fenv.S",
620625 "musl/src/fenv/riscv64/fenv-sf.c",
621626 "musl/src/fenv/riscv64/fenv.S",
622627 "musl/src/fenv/s390x/fenv.c",
......@@ -625,6 +630,7 @@ const src_files = [_][]const u8{
625630 "musl/src/fenv/x32/fenv.s",
626631 "musl/src/fenv/x86_64/fenv.s",
627632 "musl/src/internal/defsysinfo.c",
633 "musl/src/internal/emulate_wait4.c",
628634 "musl/src/internal/floatscan.c",
629635 "musl/src/internal/i386/defsysinfo.s",
630636 "musl/src/internal/intscan.c",
......@@ -665,6 +671,7 @@ const src_files = [_][]const u8{
665671 "musl/src/ldso/i386/dlsym.s",
666672 "musl/src/ldso/i386/dlsym_time64.S",
667673 "musl/src/ldso/i386/tlsdesc.s",
674 "musl/src/ldso/loongarch64/dlsym.s",
668675 "musl/src/ldso/m68k/dlsym.s",
669676 "musl/src/ldso/m68k/dlsym_time64.S",
670677 "musl/src/ldso/microblaze/dlsym.s",
......@@ -679,7 +686,9 @@ const src_files = [_][]const u8{
679686 "musl/src/ldso/powerpc/dlsym.s",
680687 "musl/src/ldso/powerpc/dlsym_time64.S",
681688 "musl/src/ldso/powerpc64/dlsym.s",
689 "musl/src/ldso/riscv32/dlsym.s",
682690 "musl/src/ldso/riscv64/dlsym.s",
691 "musl/src/ldso/riscv64/tlsdesc.s",
683692 "musl/src/ldso/s390x/dlsym.s",
684693 "musl/src/ldso/sh/dlsym.s",
685694 "musl/src/ldso/sh/dlsym_time64.S",
......@@ -734,11 +743,12 @@ const src_files = [_][]const u8{
734743 "musl/src/linux/open_by_handle_at.c",
735744 "musl/src/linux/personality.c",
736745 "musl/src/linux/pivot_root.c",
737 "musl/src/linux/ppoll.c",
738746 "musl/src/linux/prctl.c",
747 "musl/src/linux/preadv2.c",
739748 "musl/src/linux/prlimit.c",
740749 "musl/src/linux/process_vm.c",
741750 "musl/src/linux/ptrace.c",
751 "musl/src/linux/pwritev2.c",
742752 "musl/src/linux/quotactl.c",
743753 "musl/src/linux/readahead.c",
744754 "musl/src/linux/reboot.c",
......@@ -753,6 +763,7 @@ const src_files = [_][]const u8{
753763 "musl/src/linux/settimeofday.c",
754764 "musl/src/linux/signalfd.c",
755765 "musl/src/linux/splice.c",
766 "musl/src/linux/statx.c",
756767 "musl/src/linux/stime.c",
757768 "musl/src/linux/swap.c",
758769 "musl/src/linux/sync_file_range.c",
......@@ -1147,6 +1158,18 @@ const src_files = [_][]const u8{
11471158 "musl/src/math/rint.c",
11481159 "musl/src/math/rintf.c",
11491160 "musl/src/math/rintl.c",
1161 "musl/src/math/riscv32/copysign.c",
1162 "musl/src/math/riscv32/copysignf.c",
1163 "musl/src/math/riscv32/fabs.c",
1164 "musl/src/math/riscv32/fabsf.c",
1165 "musl/src/math/riscv32/fma.c",
1166 "musl/src/math/riscv32/fmaf.c",
1167 "musl/src/math/riscv32/fmax.c",
1168 "musl/src/math/riscv32/fmaxf.c",
1169 "musl/src/math/riscv32/fmin.c",
1170 "musl/src/math/riscv32/fminf.c",
1171 "musl/src/math/riscv32/sqrt.c",
1172 "musl/src/math/riscv32/sqrtf.c",
11501173 "musl/src/math/riscv64/copysign.c",
11511174 "musl/src/math/riscv64/copysignf.c",
11521175 "musl/src/math/riscv64/fabs.c",
......@@ -1546,6 +1569,7 @@ const src_files = [_][]const u8{
15461569 "musl/src/search/tsearch.c",
15471570 "musl/src/search/twalk.c",
15481571 "musl/src/select/poll.c",
1572 "musl/src/select/ppoll.c",
15491573 "musl/src/select/pselect.c",
15501574 "musl/src/select/select.c",
15511575 "musl/src/setjmp/aarch64/longjmp.s",
......@@ -1555,6 +1579,8 @@ const src_files = [_][]const u8{
15551579 "musl/src/setjmp/i386/longjmp.s",
15561580 "musl/src/setjmp/i386/setjmp.s",
15571581 "musl/src/setjmp/longjmp.c",
1582 "musl/src/setjmp/loongarch64/longjmp.S",
1583 "musl/src/setjmp/loongarch64/setjmp.S",
15581584 "musl/src/setjmp/m68k/longjmp.s",
15591585 "musl/src/setjmp/m68k/setjmp.s",
15601586 "musl/src/setjmp/microblaze/longjmp.s",
......@@ -1571,6 +1597,8 @@ const src_files = [_][]const u8{
15711597 "musl/src/setjmp/powerpc/setjmp.S",
15721598 "musl/src/setjmp/powerpc64/longjmp.s",
15731599 "musl/src/setjmp/powerpc64/setjmp.s",
1600 "musl/src/setjmp/riscv32/longjmp.S",
1601 "musl/src/setjmp/riscv32/setjmp.S",
15741602 "musl/src/setjmp/riscv64/longjmp.S",
15751603 "musl/src/setjmp/riscv64/setjmp.S",
15761604 "musl/src/setjmp/s390x/longjmp.s",
......@@ -1592,6 +1620,8 @@ const src_files = [_][]const u8{
15921620 "musl/src/signal/i386/sigsetjmp.s",
15931621 "musl/src/signal/kill.c",
15941622 "musl/src/signal/killpg.c",
1623 "musl/src/signal/loongarch64/restore.s",
1624 "musl/src/signal/loongarch64/sigsetjmp.s",
15951625 "musl/src/signal/m68k/sigsetjmp.s",
15961626 "musl/src/signal/microblaze/restore.s",
15971627 "musl/src/signal/microblaze/sigsetjmp.s",
......@@ -1607,6 +1637,8 @@ const src_files = [_][]const u8{
16071637 "musl/src/signal/psignal.c",
16081638 "musl/src/signal/raise.c",
16091639 "musl/src/signal/restore.c",
1640 "musl/src/signal/riscv32/restore.s",
1641 "musl/src/signal/riscv32/sigsetjmp.s",
16101642 "musl/src/signal/riscv64/restore.s",
16111643 "musl/src/signal/riscv64/sigsetjmp.s",
16121644 "musl/src/signal/s390x/restore.s",
......@@ -1943,6 +1975,10 @@ const src_files = [_][]const u8{
19431975 "musl/src/thread/i386/syscall_cp.s",
19441976 "musl/src/thread/i386/tls.s",
19451977 "musl/src/thread/lock_ptc.c",
1978 "musl/src/thread/loongarch64/__set_thread_area.s",
1979 "musl/src/thread/loongarch64/__unmapself.s",
1980 "musl/src/thread/loongarch64/clone.s",
1981 "musl/src/thread/loongarch64/syscall_cp.s",
19461982 "musl/src/thread/m68k/__m68k_read_tp.s",
19471983 "musl/src/thread/m68k/clone.s",
19481984 "musl/src/thread/m68k/syscall_cp.s",
......@@ -2063,6 +2099,10 @@ const src_files = [_][]const u8{
20632099 "musl/src/thread/pthread_spin_trylock.c",
20642100 "musl/src/thread/pthread_spin_unlock.c",
20652101 "musl/src/thread/pthread_testcancel.c",
2102 "musl/src/thread/riscv32/__set_thread_area.s",
2103 "musl/src/thread/riscv32/__unmapself.s",
2104 "musl/src/thread/riscv32/clone.s",
2105 "musl/src/thread/riscv32/syscall_cp.s",
20662106 "musl/src/thread/riscv64/__set_thread_area.s",
20672107 "musl/src/thread/riscv64/__unmapself.s",
20682108 "musl/src/thread/riscv64/clone.s",