authorgravatar for 124872+jedisct1@users.noreply.github.comFrank Denis <124872+jedisct1@users.noreply.github.com> 2024-04-11 15:50:05+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-01-29 11:54:02+01:00
log3f4c43b0aac48903b52c7d44b3f89f83064c7d19
tree2572a71bdea5dd234f588ceb3eb41863bf611ee9
parentbf6ee7cb3448faf981edc689791b0a9cbf728a1b
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

Update wasi-libc to d03829489904d38c624f6de9983190f1e5e7c9c5


127 files changed, 914 insertions(+), 8385 deletions(-)

lib/libc/include/wasm-wasi-musl/__errno.h-5
......@@ -5,16 +5,11 @@
55extern "C" {
66#endif
77
8#ifdef __cplusplus
9extern thread_local int errno;
10#else
118extern _Thread_local int errno;
12#endif
139
1410#define errno errno
1511
1612#ifdef __cplusplus
1713}
1814#endif
19
2015#endif
lib/libc/include/wasm-wasi-musl/__header_dirent.h+10-3
......@@ -11,12 +11,16 @@
1111#define DT_REG __WASI_FILETYPE_REGULAR_FILE
1212#define DT_UNKNOWN __WASI_FILETYPE_UNKNOWN
1313
14// DT_SOCK is not supported in WASI Preview 1 (but will be in Preview 2). We
15// define it regardless so that libc++'s `<filesystem>` implementation builds.
16// The exact value is mostly arbitrary, but chosen so it doesn't conflict with
17// any of the existing `__WASI_FILETYPE_*` flags. We do not expect any new
18// flags to be added to WASI Preview 1, so that should be sufficient.
19#define DT_SOCK 20
20
1421#define IFTODT(x) (__wasilibc_iftodt(x))
1522#define DTTOIF(x) (__wasilibc_dttoif(x))
1623
17int __wasilibc_iftodt(int x);
18int __wasilibc_dttoif(int x);
19
2024#include <__struct_dirent.h>
2125#include <__typedef_DIR.h>
2226
......@@ -24,6 +28,9 @@ int __wasilibc_dttoif(int x);
2428extern "C" {
2529#endif
2630
31int __wasilibc_iftodt(int x);
32int __wasilibc_dttoif(int x);
33
2734int closedir(DIR *);
2835DIR *opendir(const char *);
2936DIR *fdopendir(int);
lib/libc/include/wasm-wasi-musl/__header_sys_socket.h+42-4
......@@ -1,6 +1,7 @@
11#ifndef __wasilibc___header_sys_socket_h
22#define __wasilibc___header_sys_socket_h
33
4#include <__wasi_snapshot.h>
45#include <__struct_msghdr.h>
56#include <__struct_sockaddr.h>
67#include <__struct_sockaddr_storage.h>
......@@ -11,9 +12,42 @@
1112#define SHUT_WR __WASI_SDFLAGS_WR
1213#define SHUT_RDWR (SHUT_RD | SHUT_WR)
1314
15#ifdef __wasilibc_use_wasip2
16#define MSG_DONTWAIT 0x0040
17#define MSG_NOSIGNAL 0x4000
18#define MSG_PEEK 0x0002
19#define MSG_WAITALL 0x0100
20#define MSG_TRUNC 0x0020
21
22#define SOL_IP 0
23#define SOL_TCP 6
24#define SOL_UDP 17
25#define SOL_IPV6 41
26
27#define SOMAXCONN 128
28
29#define SO_REUSEADDR 2
30#define SO_ERROR 4
31#define SO_SNDBUF 7
32#define SO_RCVBUF 8
33#define SO_KEEPALIVE 9
34#define SO_ACCEPTCONN 30
35#define SO_PROTOCOL 38
36#define SO_DOMAIN 39
37
38#if __LONG_MAX == 0x7fffffff
39#define SO_RCVTIMEO 66
40#define SO_SNDTIMEO 67
41#else
42#define SO_RCVTIMEO 20
43#define SO_SNDTIMEO 21
44#endif
45
46#else // __wasilibc_use_wasip2
1447#define MSG_PEEK __WASI_RIFLAGS_RECV_PEEK
1548#define MSG_WAITALL __WASI_RIFLAGS_RECV_WAITALL
16#define MSG_TRUNC __WASI_RIFLAGS_RECV_DATA_TRUNCATED
49#define MSG_TRUNC __WASI_ROFLAGS_RECV_DATA_TRUNCATED
50#endif // __wasilibc_use_wasip2
1751
1852#define SOCK_DGRAM __WASI_FILETYPE_SOCKET_DGRAM
1953#define SOCK_STREAM __WASI_FILETYPE_SOCKET_STREAM
......@@ -25,9 +59,13 @@
2559
2660#define SO_TYPE 3
2761
28#define AF_UNSPEC 0
29#define AF_INET 1
30#define AF_INET6 2
62#define PF_UNSPEC 0
63#define PF_INET 1
64#define PF_INET6 2
65
66#define AF_UNSPEC PF_UNSPEC
67#define AF_INET PF_INET
68#define AF_INET6 PF_INET6
3169#define AF_UNIX 3
3270
3371#ifdef __cplusplus
lib/libc/include/wasm-wasi-musl/__mode_t.h+1-1
......@@ -9,7 +9,7 @@
99#define S_IFLNK (0xa000)
1010#define S_IFREG (0x8000)
1111#define S_IFSOCK (0xc000)
12#define S_IFIFO (0xc000)
12#define S_IFIFO (0x1000)
1313
1414#define S_ISBLK(m) (((m)&S_IFMT) == S_IFBLK)
1515#define S_ISCHR(m) (((m)&S_IFMT) == S_IFCHR)
lib/libc/include/wasm-wasi-musl/__struct_sockaddr.h-3
......@@ -1,9 +1,6 @@
11#ifndef __wasilibc___struct_sockaddr_h
22#define __wasilibc___struct_sockaddr_h
33
4#define __need_STDDEF_H_misc
5#include <stddef.h>
6
74#include <__typedef_sa_family_t.h>
85
96struct sockaddr {
lib/libc/include/wasm-wasi-musl/__struct_sockaddr_in.h+1-4
......@@ -1,15 +1,12 @@
11#ifndef __wasilibc___struct_sockaddr_in_h
22#define __wasilibc___struct_sockaddr_in_h
33
4#define __need_STDDEF_H_misc
5#include <stddef.h>
6
74#include <__typedef_sa_family_t.h>
85#include <__typedef_in_port_t.h>
96#include <__struct_in_addr.h>
107
118struct sockaddr_in {
12 _Alignas(max_align_t) sa_family_t sin_family;
9 __attribute__((aligned(__BIGGEST_ALIGNMENT__))) sa_family_t sin_family;
1310 in_port_t sin_port;
1411 struct in_addr sin_addr;
1512};
lib/libc/include/wasm-wasi-musl/__struct_sockaddr_in6.h+1-4
......@@ -1,15 +1,12 @@
11#ifndef __wasilibc___struct_sockaddr_in6_h
22#define __wasilibc___struct_sockaddr_in6_h
33
4#define __need_STDDEF_H_misc
5#include <stddef.h>
6
74#include <__typedef_sa_family_t.h>
85#include <__typedef_in_port_t.h>
96#include <__struct_in6_addr.h>
107
118struct sockaddr_in6 {
12 _Alignas(max_align_t) sa_family_t sin6_family;
9 __attribute__((aligned(__BIGGEST_ALIGNMENT__))) sa_family_t sin6_family;
1310 in_port_t sin6_port;
1411 unsigned sin6_flowinfo;
1512 struct in6_addr sin6_addr;
lib/libc/include/wasm-wasi-musl/__struct_sockaddr_storage.h+1-4
......@@ -1,13 +1,10 @@
11#ifndef __wasilibc___struct_sockaddr_storage_h
22#define __wasilibc___struct_sockaddr_storage_h
33
4#define __need_STDDEF_H_misc
5#include <stddef.h>
6
74#include <__typedef_sa_family_t.h>
85
96struct sockaddr_storage {
10 _Alignas(max_align_t) sa_family_t ss_family;
7 __attribute__((aligned(__BIGGEST_ALIGNMENT__))) sa_family_t ss_family;
118 char __ss_data[32];
129};
1310
lib/libc/include/wasm-wasi-musl/__struct_sockaddr_un.h+1-4
......@@ -1,13 +1,10 @@
11#ifndef __wasilibc___struct_sockaddr_un_h
22#define __wasilibc___struct_sockaddr_un_h
33
4#define __need_STDDEF_H_misc
5#include <stddef.h>
6
74#include <__typedef_sa_family_t.h>
85
96struct sockaddr_un {
10 _Alignas(max_align_t) sa_family_t sun_family;
7 __attribute__((aligned(__BIGGEST_ALIGNMENT__))) sa_family_t sun_family;
118};
129
1310#endif
lib/libc/include/wasm-wasi-musl/__wasi_snapshot.h created
lib/libc/include/wasm-wasi-musl/bits/setjmp.h created+1
......@@ -0,0 +1 @@
1typedef unsigned long __jmp_buf[8];
lib/libc/include/wasm-wasi-musl/setjmp.h created+55
......@@ -0,0 +1,55 @@
1#ifndef _SETJMP_H
2#define _SETJMP_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <features.h>
9
10#ifndef __wasilibc_unmodified_upstream
11/* WASI has no setjmp */
12#if !defined(__wasm_exception_handling__)
13#error Setjmp/longjmp support requires Exception handling support, which is [not yet standardized](https://github.com/WebAssembly/proposals?tab=readme-ov-file#phase-3---implementation-phase-cg--wg). To enable it, compile with `-mllvm -wasm-enable-sjlj` and use an engine that implements the Exception handling proposal.
14#endif
15#endif
16#include <bits/setjmp.h>
17
18typedef struct __jmp_buf_tag {
19 __jmp_buf __jb;
20 unsigned long __fl;
21 unsigned long __ss[128/sizeof(long)];
22} jmp_buf[1];
23
24#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
25#define __setjmp_attr __attribute__((__returns_twice__))
26#else
27#define __setjmp_attr
28#endif
29
30#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
31 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
32 || defined(_BSD_SOURCE)
33typedef jmp_buf sigjmp_buf;
34int sigsetjmp (sigjmp_buf, int) __setjmp_attr;
35_Noreturn void siglongjmp (sigjmp_buf, int);
36#endif
37
38#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
39 || defined(_BSD_SOURCE)
40int _setjmp (jmp_buf) __setjmp_attr;
41_Noreturn void _longjmp (jmp_buf, int);
42#endif
43
44int setjmp (jmp_buf) __setjmp_attr;
45_Noreturn void longjmp (jmp_buf, int);
46
47#define setjmp setjmp
48
49#undef __setjmp_attr
50
51#ifdef __cplusplus
52}
53#endif
54
55#endif
lib/libc/include/wasm-wasi-musl/stdlib.h-2
......@@ -128,9 +128,7 @@ int rand_r (unsigned *);
128128
129129#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
130130 || defined(_BSD_SOURCE)
131#ifdef __wasilibc_unmodified_upstream /* WASI has no absolute paths */
132131char *realpath (const char *__restrict, char *__restrict);
133#endif
134132long int random (void);
135133void srandom (unsigned int);
136134char *initstate (unsigned int, char *, size_t);
lib/libc/include/wasm-wasi-musl/sys/socket.h+12-6
......@@ -1,5 +1,8 @@
11#ifndef _SYS_SOCKET_H
22#define _SYS_SOCKET_H
3
4#include <__wasi_snapshot.h>
5
36#ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */
47#else
58#include <__header_sys_socket.h>
......@@ -395,30 +398,33 @@ struct sockaddr_storage {
395398#include <__struct_sockaddr_storage.h>
396399#endif
397400
398#ifdef __wasilibc_unmodified_upstream /* WASI has no socket/socketpair */
401#if (defined __wasilibc_unmodified_upstream) || (defined __wasilibc_use_wasip2)
399402int socket (int, int, int);
403#endif
404
405#ifdef __wasilibc_unmodified_upstream /* WASI has no socketpair */
400406int socketpair (int, int, int, int [2]);
401407#endif
402408
403409int shutdown (int, int);
404410
405#ifdef __wasilibc_unmodified_upstream /* WASI has no bind/connect/listen/accept */
406int bind (int, const struct sockaddr *, socklen_t);
411#if (defined __wasilibc_unmodified_upstream) || (defined __wasilibc_use_wasip2)
407412int connect (int, const struct sockaddr *, socklen_t);
413int bind (int, const struct sockaddr *, socklen_t);
408414int listen (int, int);
409415#endif
410416
411417int accept (int, struct sockaddr *__restrict, socklen_t *__restrict);
412418int accept4(int, struct sockaddr *__restrict, socklen_t *__restrict, int);
413419
414#ifdef __wasilibc_unmodified_upstream /* WASI has no getsockname/getpeername */
420#if (defined __wasilibc_unmodified_upstream) || (defined __wasilibc_use_wasip2)
415421int getsockname (int, struct sockaddr *__restrict, socklen_t *__restrict);
416422int getpeername (int, struct sockaddr *__restrict, socklen_t *__restrict);
417423#endif
418424
419425ssize_t send (int, const void *, size_t, int);
420426ssize_t recv (int, void *, size_t, int);
421#ifdef __wasilibc_unmodified_upstream /* WASI has no sendto/recvfrom */
427#if (defined __wasilibc_unmodified_upstream) || (defined __wasilibc_use_wasip2)
422428ssize_t sendto (int, const void *, size_t, int, const struct sockaddr *, socklen_t);
423429ssize_t recvfrom (int, void *__restrict, size_t, int, struct sockaddr *__restrict, socklen_t *__restrict);
424430#endif
......@@ -428,7 +434,7 @@ ssize_t recvmsg (int, struct msghdr *, int);
428434#endif
429435
430436int getsockopt (int, int, int, void *__restrict, socklen_t *__restrict);
431#ifdef __wasilibc_unmodified_upstream /* WASI has no setsockopt */
437#if (defined __wasilibc_unmodified_upstream) || (defined __wasilibc_use_wasip2)
432438int setsockopt (int, int, int, const void *, socklen_t);
433439#endif
434440
lib/libc/include/wasm-wasi-musl/sys/stat.h-2
......@@ -78,11 +78,9 @@ int stat(const char *__restrict, struct stat *__restrict);
7878int fstat(int, struct stat *);
7979int lstat(const char *__restrict, struct stat *__restrict);
8080int fstatat(int, const char *__restrict, struct stat *__restrict, int);
81#ifdef __wasilibc_unmodified_upstream /* WASI has no chmod */
8281int chmod(const char *, mode_t);
8382int fchmod(int, mode_t);
8483int fchmodat(int, const char *, mode_t, int);
85#endif
8684#ifdef __wasilibc_unmodified_upstream /* WASI has no umask */
8785mode_t umask(mode_t);
8886#endif
lib/libc/include/wasm-wasi-musl/sys/statvfs.h created+56
......@@ -0,0 +1,56 @@
1#ifndef _SYS_STATVFS_H
2#define _SYS_STATVFS_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <features.h>
9
10#define __NEED_fsblkcnt_t
11#define __NEED_fsfilcnt_t
12#include <bits/alltypes.h>
13
14struct statvfs {
15 unsigned long f_bsize, f_frsize;
16 fsblkcnt_t f_blocks, f_bfree, f_bavail;
17 fsfilcnt_t f_files, f_ffree, f_favail;
18#if __BYTE_ORDER == __LITTLE_ENDIAN
19 unsigned long f_fsid;
20 unsigned :8*(2*sizeof(int)-sizeof(long));
21#else
22 unsigned :8*(2*sizeof(int)-sizeof(long));
23 unsigned long f_fsid;
24#endif
25 unsigned long f_flag, f_namemax;
26 int __reserved[6];
27};
28
29int statvfs (const char *__restrict, struct statvfs *__restrict);
30int fstatvfs (int, struct statvfs *);
31
32#define ST_RDONLY 1
33#define ST_NOSUID 2
34#define ST_NODEV 4
35#define ST_NOEXEC 8
36#define ST_SYNCHRONOUS 16
37#define ST_MANDLOCK 64
38#define ST_WRITE 128
39#define ST_APPEND 256
40#define ST_IMMUTABLE 512
41#define ST_NOATIME 1024
42#define ST_NODIRATIME 2048
43#define ST_RELATIME 4096
44
45#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
46#define statvfs64 statvfs
47#define fstatvfs64 fstatvfs
48#define fsblkcnt64_t fsblkcnt_t
49#define fsfilcnt64_t fsfilcnt_t
50#endif
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
lib/libc/include/wasm-wasi-musl/unistd.h+2
......@@ -336,7 +336,9 @@ pid_t gettid(void);
336336#endif
337337#define _POSIX_VDISABLE 0
338338
339#if defined(__wasilibc_unmodified_upstream) || defined(_REENTRANT)
339340#define _POSIX_THREADS _POSIX_VERSION
341#endif
340342#define _POSIX_THREAD_PROCESS_SHARED _POSIX_VERSION
341343#define _POSIX_THREAD_SAFE_FUNCTIONS _POSIX_VERSION
342344#define _POSIX_THREAD_ATTR_STACKADDR _POSIX_VERSION
lib/libc/include/wasm-wasi-musl/wasi/libc.h+6
......@@ -11,6 +11,12 @@ extern "C" {
1111struct stat;
1212struct timespec;
1313
14/// Populate libc's preopen tables. This is normally done automatically
15/// just before it's needed, however if you call `__wasi_fd_renumber` or
16/// `__wasi_fd_close` directly, and you need the preopens to be accurate
17/// afterward, you should call this before doing so.
18void __wasilibc_populate_preopens(void);
19
1420/// Register the given pre-opened file descriptor under the given path.
1521///
1622/// This function does not take ownership of `prefix` (it makes its own copy).
lib/libc/wasi/emmalloc/emmalloc.c+8-7
......@@ -56,7 +56,7 @@
5656
5757// Defind by the linker to have the address of the start of the heap.
5858extern unsigned char __heap_base;
59extern unsigned char __heap_end __attribute__((__weak__));
59extern unsigned char __heap_end;
6060
6161// Behavior of right shifting a signed integer is compiler implementation defined.
6262static_assert((((int32_t)0x80000000U) >> 31) == -1, "This malloc implementation requires that right-shifting a signed integer produces a sign-extending (arithmetic) shift!");
......@@ -66,7 +66,7 @@ static_assert((((int32_t)0x80000000U) >> 31) == -1, "This malloc implementation
6666#define MALLOC_ALIGNMENT alignof(max_align_t)
6767static_assert(alignof(max_align_t) == 16, "max_align_t must be correct");
6868
69#define EMMALLOC_EXPORT __attribute__((__weak__))
69#define EMMALLOC_EXPORT __attribute__((weak))
7070
7171#define MIN(x, y) ((x) < (y) ? (x) : (y))
7272#define MAX(x, y) ((x) > (y) ? (x) : (y))
......@@ -546,12 +546,13 @@ static bool claim_more_memory(size_t numBytes)
546546 // If this is the first time we're called, see if we can use
547547 // the initial heap memory set up by wasm-ld.
548548 if (!listOfAllRegions) {
549 unsigned char *heap_base = &__heap_base;
549550 unsigned char *heap_end = &__heap_end;
550 if (heap_end == NULL)
551 heap_end = sbrk(0);
552
553 if (numBytes <= (size_t)(heap_end - &__heap_base)) {
554 startPtr = &__heap_base;
551 if (heap_end < heap_base) {
552 __builtin_trap();
553 }
554 if (numBytes <= (size_t)(heap_end - heap_base)) {
555 startPtr = heap_base;
555556 endPtr = heap_end;
556557 break;
557558 }
lib/libc/wasi/libc-bottom-half/cloudlibc/src/libc/poll/poll.c+46-1
......@@ -7,7 +7,7 @@
77#include <poll.h>
88#include <stdbool.h>
99
10int poll(struct pollfd *fds, size_t nfds, int timeout) {
10static int poll_wasip1(struct pollfd *fds, size_t nfds, int timeout) {
1111 // Construct events for poll().
1212 size_t maxevents = 2 * nfds + 1;
1313 __wasi_subscription_t subscriptions[maxevents];
......@@ -127,3 +127,48 @@ int poll(struct pollfd *fds, size_t nfds, int timeout) {
127127 }
128128 return retval;
129129}
130
131#ifdef __wasilibc_use_wasip2
132#include <wasi/descriptor_table.h>
133
134int poll_wasip2(struct pollfd *fds, size_t nfds, int timeout);
135
136int poll(struct pollfd* fds, nfds_t nfds, int timeout)
137{
138 bool found_socket = false;
139 bool found_non_socket = false;
140 for (size_t i = 0; i < nfds; ++i) {
141 descriptor_table_entry_t* entry;
142 if (descriptor_table_get_ref(fds[i].fd, &entry)) {
143 found_socket = true;
144 } else {
145 found_non_socket = true;
146 }
147 }
148
149 if (found_socket) {
150 if (found_non_socket) {
151 // We currently don't support polling a mix of non-sockets and
152 // sockets here (though you can do it by using the host APIs
153 // directly), and we probably won't until we've migrated entirely to
154 // WASI 0.2.
155 errno = ENOTSUP;
156 return -1;
157 }
158
159 return poll_wasip2(fds, nfds, timeout);
160 } else if (found_non_socket) {
161 return poll_wasip1(fds, nfds, timeout);
162 } else if (timeout >= 0) {
163 return poll_wasip2(fds, nfds, timeout);
164 } else {
165 errno = ENOTSUP;
166 return -1;
167 }
168}
169#else // not __wasilibc_use_wasip2
170int poll(struct pollfd* fds, nfds_t nfds, int timeout)
171{
172 return poll_wasip1(fds, nfds, timeout);
173}
174#endif // not __wasilibc_use_wasip2
lib/libc/wasi/libc-bottom-half/cloudlibc/src/libc/sys/ioctl/ioctl.c+56-1
......@@ -4,11 +4,66 @@
44
55#include <sys/ioctl.h>
66
7#include <wasi/api.h>
87#include <errno.h>
98#include <stdarg.h>
109
10#include <wasi/api.h>
11#ifdef __wasilibc_use_wasip2
12#include <wasi/descriptor_table.h>
13#endif
14
1115int ioctl(int fildes, int request, ...) {
16#ifdef __wasilibc_use_wasip2
17 descriptor_table_entry_t *entry;
18 if (descriptor_table_get_ref(fildes, &entry)) {
19 switch (entry->tag) {
20 case DESCRIPTOR_TABLE_ENTRY_TCP_SOCKET: {
21 tcp_socket_t *socket = &entry->tcp_socket;
22 switch (request) {
23 case FIONBIO: {
24 va_list ap;
25 va_start(ap, request);
26 socket->blocking = *va_arg(ap, const int *) ==
27 0;
28 va_end(ap);
29
30 return 0;
31 }
32
33 default:
34 // TODO wasi-sockets: anything else we should support?
35 errno = EINVAL;
36 return -1;
37 }
38 }
39
40 case DESCRIPTOR_TABLE_ENTRY_UDP_SOCKET: {
41 udp_socket_t *socket = &entry->udp_socket;
42 switch (request) {
43 case FIONBIO: {
44 va_list ap;
45 va_start(ap, request);
46 socket->blocking = *va_arg(ap, const int *) ==
47 0;
48 va_end(ap);
49
50 return 0;
51 }
52
53 default:
54 // TODO wasi-sockets: anything else we should support?
55 errno = EINVAL;
56 return -1;
57 }
58 }
59
60 default:
61 errno = ENOPROTOOPT;
62 return -1;
63 }
64 }
65#endif // __wasilibc_use_wasip2
66
1267 switch (request) {
1368 case FIONREAD: {
1469 // Poll the file descriptor to determine how many bytes can be read.
lib/libc/wasi/libc-bottom-half/cloudlibc/src/libc/sys/select/pselect.c+38-64
......@@ -8,6 +8,7 @@
88
99#include <wasi/api.h>
1010#include <errno.h>
11#include <poll.h>
1112
1213int pselect(int nfds, fd_set *restrict readfds, fd_set *restrict writefds,
1314 fd_set *restrict errorfds, const struct timespec *restrict timeout,
......@@ -33,93 +34,66 @@ int pselect(int nfds, fd_set *restrict readfds, fd_set *restrict writefds,
3334 if (writefds == NULL)
3435 writefds = &empty;
3536
36 // Determine the maximum number of events.
37 size_t maxevents = readfds->__nfds + writefds->__nfds + 1;
38 __wasi_subscription_t subscriptions[maxevents];
39 size_t nsubscriptions = 0;
40
41 // Convert the readfds set.
37 struct pollfd poll_fds[readfds->__nfds + writefds->__nfds];
38 size_t poll_nfds = 0;
39
4240 for (size_t i = 0; i < readfds->__nfds; ++i) {
4341 int fd = readfds->__fds[i];
4442 if (fd < nfds) {
45 __wasi_subscription_t *subscription = &subscriptions[nsubscriptions++];
46 *subscription = (__wasi_subscription_t){
47 .userdata = fd,
48 .u.tag = __WASI_EVENTTYPE_FD_READ,
49 .u.u.fd_read.file_descriptor = fd,
50 };
43 poll_fds[poll_nfds++] = (struct pollfd){
44 .fd = fd,
45 .events = POLLRDNORM,
46 .revents = 0
47 };
5148 }
5249 }
53
54 // Convert the writefds set.
50
5551 for (size_t i = 0; i < writefds->__nfds; ++i) {
5652 int fd = writefds->__fds[i];
5753 if (fd < nfds) {
58 __wasi_subscription_t *subscription = &subscriptions[nsubscriptions++];
59 *subscription = (__wasi_subscription_t){
60 .userdata = fd,
61 .u.tag = __WASI_EVENTTYPE_FD_WRITE,
62 .u.u.fd_write.file_descriptor = fd,
54 poll_fds[poll_nfds++] = (struct pollfd){
55 .fd = fd,
56 .events = POLLWRNORM,
57 .revents = 0
6358 };
6459 }
6560 }
6661
67 // Create extra event for the timeout.
68 if (timeout != NULL) {
69 __wasi_subscription_t *subscription = &subscriptions[nsubscriptions++];
70 *subscription = (__wasi_subscription_t){
71 .u.tag = __WASI_EVENTTYPE_CLOCK,
72 .u.u.clock.id = __WASI_CLOCKID_REALTIME,
73 };
74 if (!timespec_to_timestamp_clamp(timeout, &subscription->u.u.clock.timeout)) {
62 int poll_timeout;
63 if (timeout) {
64 uint64_t timeout_u64;
65 if (!timespec_to_timestamp_clamp(timeout, &timeout_u64) ) {
7566 errno = EINVAL;
7667 return -1;
7768 }
78 }
7969
80 // Execute poll().
81 size_t nevents;
82 __wasi_event_t events[nsubscriptions];
83 __wasi_errno_t error =
84 __wasi_poll_oneoff(subscriptions, events, nsubscriptions, &nevents);
85 if (error != 0) {
86 // WASI's poll requires at least one subscription, or else it returns
87 // `EINVAL`. Since a `pselect` with nothing to wait for is valid in POSIX,
88 // return `ENOTSUP` to indicate that we don't support that case.
89 //
90 // Wasm has no signal handling, so if none of the user-provided `pollfd`
91 // elements, nor the timeout, led us to producing even one subscription
92 // to wait for, there would be no way for the poll to wake up. WASI
93 // returns `EINVAL` in this case, but for users of `poll`, `ENOTSUP` is
94 // more likely to be understood.
95 if (nsubscriptions == 0)
96 errno = ENOTSUP;
97 else
98 errno = error;
99 return -1;
100 }
70 // Convert nanoseconds to milliseconds:
71 timeout_u64 /= 1000000;
10172
102 // Test for EBADF.
103 for (size_t i = 0; i < nevents; ++i) {
104 const __wasi_event_t *event = &events[i];
105 if ((event->type == __WASI_EVENTTYPE_FD_READ ||
106 event->type == __WASI_EVENTTYPE_FD_WRITE) &&
107 event->error == __WASI_ERRNO_BADF) {
108 errno = EBADF;
109 return -1;
73 if (timeout_u64 > INT_MAX) {
74 timeout_u64 = INT_MAX;
11075 }
76
77 poll_timeout = (int) timeout_u64;
78 } else {
79 poll_timeout = -1;
80 };
81
82 if (poll(poll_fds, poll_nfds, poll_timeout) < 0) {
83 return -1;
11184 }
11285
113 // Clear and set entries in the result sets.
11486 FD_ZERO(readfds);
11587 FD_ZERO(writefds);
116 for (size_t i = 0; i < nevents; ++i) {
117 const __wasi_event_t *event = &events[i];
118 if (event->type == __WASI_EVENTTYPE_FD_READ) {
119 readfds->__fds[readfds->__nfds++] = event->userdata;
120 } else if (event->type == __WASI_EVENTTYPE_FD_WRITE) {
121 writefds->__fds[writefds->__nfds++] = event->userdata;
88 for (size_t i = 0; i < poll_nfds; ++i) {
89 struct pollfd* pollfd = poll_fds + i;
90 if ((pollfd->revents & POLLRDNORM) != 0) {
91 readfds->__fds[readfds->__nfds++] = pollfd->fd;
92 }
93 if ((pollfd->revents & POLLWRNORM) != 0) {
94 writefds->__fds[writefds->__nfds++] = pollfd->fd;
12295 }
12396 }
97
12498 return readfds->__nfds + writefds->__nfds;
12599}
lib/libc/wasi/libc-bottom-half/cloudlibc/src/libc/unistd/close.c-16
......@@ -1,16 +0,0 @@
1// Copyright (c) 2015-2016 Nuxi, https://nuxi.nl/
2//
3// SPDX-License-Identifier: BSD-2-Clause
4
5#include <wasi/api.h>
6#include <errno.h>
7#include <unistd.h>
8
9int close(int fildes) {
10 __wasi_errno_t error = __wasi_fd_close(fildes);
11 if (error != 0) {
12 errno = error;
13 return -1;
14 }
15 return 0;
16}
lib/libc/wasi/libc-bottom-half/crt/crt1-command.c+3-3
......@@ -20,18 +20,18 @@ void _start(void) {
2020 static volatile _Atomic int started = 0;
2121 int expected = 0;
2222 if (!atomic_compare_exchange_strong(&started, &expected, 1)) {
23 __builtin_trap();
23 __builtin_trap();
2424 }
2525#else
2626 static volatile int started = 0;
2727 if (started != 0) {
28 __builtin_trap();
28 __builtin_trap();
2929 }
3030 started = 1;
3131#endif
3232
3333#ifdef _REENTRANT
34 __wasi_init_tp();
34 __wasi_init_tp();
3535#endif
3636
3737 // The linker synthesizes this to call constructors.
lib/libc/wasi/libc-bottom-half/headers/private/wasi/descriptor_table.h created+127
......@@ -0,0 +1,127 @@
1#ifndef DESCRIPTOR_TABLE_H
2#define DESCRIPTOR_TABLE_H
3
4#include <wasi/wasip2.h>
5
6typedef struct {
7 int dummy;
8} tcp_socket_state_unbound_t;
9typedef struct {
10 int dummy;
11} tcp_socket_state_bound_t;
12typedef struct {
13 int dummy;
14} tcp_socket_state_connecting_t;
15typedef struct {
16 int dummy;
17} tcp_socket_state_listening_t;
18
19typedef struct {
20 streams_own_input_stream_t input;
21 poll_own_pollable_t input_pollable;
22 streams_own_output_stream_t output;
23 poll_own_pollable_t output_pollable;
24} tcp_socket_state_connected_t;
25
26typedef struct {
27 network_error_code_t error_code;
28} tcp_socket_state_connect_failed_t;
29
30// This is a tagged union. When adding/removing/renaming cases, be sure to keep the tag and union definitions in sync.
31typedef struct {
32 enum {
33 TCP_SOCKET_STATE_UNBOUND,
34 TCP_SOCKET_STATE_BOUND,
35 TCP_SOCKET_STATE_CONNECTING,
36 TCP_SOCKET_STATE_CONNECTED,
37 TCP_SOCKET_STATE_CONNECT_FAILED,
38 TCP_SOCKET_STATE_LISTENING,
39 } tag;
40 union {
41 tcp_socket_state_unbound_t unbound;
42 tcp_socket_state_bound_t bound;
43 tcp_socket_state_connecting_t connecting;
44 tcp_socket_state_connected_t connected;
45 tcp_socket_state_connect_failed_t connect_failed;
46 tcp_socket_state_listening_t listening;
47 };
48} tcp_socket_state_t;
49
50typedef struct {
51 tcp_own_tcp_socket_t socket;
52 poll_own_pollable_t socket_pollable;
53 bool blocking;
54 bool fake_nodelay;
55 bool fake_reuseaddr;
56 network_ip_address_family_t family;
57 tcp_socket_state_t state;
58} tcp_socket_t;
59
60typedef struct {
61 udp_own_incoming_datagram_stream_t incoming;
62 poll_own_pollable_t incoming_pollable;
63 udp_own_outgoing_datagram_stream_t outgoing;
64 poll_own_pollable_t outgoing_pollable;
65} udp_socket_streams_t;
66
67typedef struct {
68 int dummy;
69} udp_socket_state_unbound_t;
70typedef struct {
71 int dummy;
72} udp_socket_state_bound_nostreams_t;
73
74typedef struct {
75 udp_socket_streams_t streams; // Streams have no remote_address
76} udp_socket_state_bound_streaming_t;
77
78typedef struct {
79 udp_socket_streams_t streams; // Streams have a remote_address
80} udp_socket_state_connected_t;
81
82// This is a tagged union. When adding/removing/renaming cases, be sure to keep the tag and union definitions in sync.
83// The "bound" state is split up into two distinct tags:
84// - "bound_nostreams": Bound, but no datagram streams set up (yet). That will be done the first time send or recv is called.
85// - "bound_streaming": Bound with active streams.
86typedef struct {
87 enum {
88 UDP_SOCKET_STATE_UNBOUND,
89 UDP_SOCKET_STATE_BOUND_NOSTREAMS,
90 UDP_SOCKET_STATE_BOUND_STREAMING,
91 UDP_SOCKET_STATE_CONNECTED,
92 } tag;
93 union {
94 udp_socket_state_unbound_t unbound;
95 udp_socket_state_bound_nostreams_t bound_nostreams;
96 udp_socket_state_bound_streaming_t bound_streaming;
97 udp_socket_state_connected_t connected;
98 };
99} udp_socket_state_t;
100
101typedef struct {
102 udp_own_udp_socket_t socket;
103 poll_own_pollable_t socket_pollable;
104 bool blocking;
105 network_ip_address_family_t family;
106 udp_socket_state_t state;
107} udp_socket_t;
108
109// This is a tagged union. When adding/removing/renaming cases, be sure to keep the tag and union definitions in sync.
110typedef struct {
111 enum {
112 DESCRIPTOR_TABLE_ENTRY_TCP_SOCKET,
113 DESCRIPTOR_TABLE_ENTRY_UDP_SOCKET,
114 } tag;
115 union {
116 tcp_socket_t tcp_socket;
117 udp_socket_t udp_socket;
118 };
119} descriptor_table_entry_t;
120
121bool descriptor_table_insert(descriptor_table_entry_t entry, int *fd);
122
123bool descriptor_table_get_ref(int fd, descriptor_table_entry_t **entry);
124
125bool descriptor_table_remove(int fd, descriptor_table_entry_t *entry);
126
127#endif
lib/libc/wasi/libc-bottom-half/headers/private/wasi/sockets_utils.h created+53
......@@ -0,0 +1,53 @@
1#ifndef __wasi_sockets_utils_h
2#define __wasi_sockets_utils_h
3
4#include <netinet/in.h>
5
6#include <wasi/descriptor_table.h>
7
8typedef struct {
9 enum {
10 OUTPUT_SOCKADDR_NULL,
11 OUTPUT_SOCKADDR_V4,
12 OUTPUT_SOCKADDR_V6,
13 } tag;
14 union {
15 struct {
16 int dummy;
17 } null;
18 struct {
19 struct sockaddr_in *addr;
20 socklen_t *addrlen;
21 } v4;
22 struct {
23 struct sockaddr_in6 *addr;
24 socklen_t *addrlen;
25 } v6;
26 };
27} output_sockaddr_t;
28
29network_borrow_network_t __wasi_sockets_utils__borrow_network();
30int __wasi_sockets_utils__map_error(network_error_code_t wasi_error);
31bool __wasi_sockets_utils__parse_address(
32 network_ip_address_family_t expected_family,
33 const struct sockaddr *address, socklen_t len,
34 network_ip_socket_address_t *result, int *error);
35bool __wasi_sockets_utils__output_addr_validate(
36 network_ip_address_family_t expected_family, struct sockaddr *addr,
37 socklen_t *addrlen, output_sockaddr_t *result);
38void __wasi_sockets_utils__output_addr_write(
39 const network_ip_socket_address_t input, output_sockaddr_t *output);
40int __wasi_sockets_utils__posix_family(network_ip_address_family_t wasi_family);
41network_ip_socket_address_t
42__wasi_sockets_utils__any_addr(network_ip_address_family_t family);
43int __wasi_sockets_utils__tcp_bind(tcp_socket_t *socket,
44 network_ip_socket_address_t *address);
45int __wasi_sockets_utils__udp_bind(udp_socket_t *socket,
46 network_ip_socket_address_t *address);
47bool __wasi_sockets_utils__stream(udp_socket_t *socket,
48 network_ip_socket_address_t *remote_address,
49 udp_socket_streams_t *result,
50 network_error_code_t *error);
51void __wasi_sockets_utils__drop_streams(udp_socket_streams_t streams);
52
53#endif
lib/libc/wasi/libc-bottom-half/signal/signal.c+2-2
......@@ -30,13 +30,13 @@ static void core_handler(int sig) {
3030
3131_Noreturn
3232static void terminate_handler(int sig) {
33 fprintf(stderr, "Program recieved termination signal: %s\n", strsignal(sig));
33 fprintf(stderr, "Program received termination signal: %s\n", strsignal(sig));
3434 abort();
3535}
3636
3737_Noreturn
3838static void stop_handler(int sig) {
39 fprintf(stderr, "Program recieved stop signal: %s\n", strsignal(sig));
39 fprintf(stderr, "Program received stop signal: %s\n", strsignal(sig));
4040 abort();
4141}
4242
lib/libc/wasi/libc-bottom-half/sources/__main_void.c+10
......@@ -5,6 +5,11 @@
55int __wasilibc_main(int argc, char *argv[]) asm("main");
66
77// The user's `main` function, expecting arguments.
8//
9// Note that we make this a weak symbol so that it will have a
10// `WASM_SYM_BINDING_WEAK` flag in libc.so, which tells the dynamic linker that
11// it need not be defined (e.g. in reactor-style apps with no main function).
12// See also the TODO comment on `__main_void` below.
813__attribute__((__weak__, nodebug))
914int __main_argc_argv(int argc, char *argv[]) {
1015 return __wasilibc_main(argc, argv);
......@@ -13,6 +18,11 @@ int __main_argc_argv(int argc, char *argv[]) {
1318// If the user's `main` function expects arguments, the compiler will rename
1419// it to `__main_argc_argv`, and this version will get linked in, which
1520// initializes the argument data and calls `__main_argc_argv`.
21//
22// TODO: Ideally this function would be defined in a crt*.o file and linked in
23// as necessary by the Clang driver. However, moving it to crt1-command.c
24// breaks `--no-gc-sections`, so we'll probably need to create a new file
25// (e.g. crt0.o or crtend.o) and teach Clang to use it when needed.
1626__attribute__((__weak__, nodebug))
1727int __main_void(void) {
1828 __wasi_errno_t err;
lib/libc/wasi/libc-bottom-half/sources/__wasilibc_fd_renumber.c+94
......@@ -11,3 +11,97 @@ int __wasilibc_fd_renumber(int fd, int newfd) {
1111 }
1212 return 0;
1313}
14
15#ifdef __wasilibc_use_wasip2
16#include <wasi/descriptor_table.h>
17
18void drop_tcp_socket(tcp_socket_t socket) {
19 switch (socket.state.tag) {
20 case TCP_SOCKET_STATE_UNBOUND:
21 case TCP_SOCKET_STATE_BOUND:
22 case TCP_SOCKET_STATE_CONNECTING:
23 case TCP_SOCKET_STATE_LISTENING:
24 case TCP_SOCKET_STATE_CONNECT_FAILED:
25 // No additional resources to drop.
26 break;
27 case TCP_SOCKET_STATE_CONNECTED: {
28 tcp_socket_state_connected_t connection = socket.state.connected;
29
30 poll_pollable_drop_own(connection.input_pollable);
31 poll_pollable_drop_own(connection.output_pollable);
32 streams_input_stream_drop_own(connection.input);
33 streams_output_stream_drop_own(connection.output);
34 break;
35 }
36 default: /* unreachable */ abort();
37 }
38
39 poll_pollable_drop_own(socket.socket_pollable);
40 tcp_tcp_socket_drop_own(socket.socket);
41}
42
43void drop_udp_socket_streams(udp_socket_streams_t streams) {
44 poll_pollable_drop_own(streams.incoming_pollable);
45 poll_pollable_drop_own(streams.outgoing_pollable);
46 udp_incoming_datagram_stream_drop_own(streams.incoming);
47 udp_outgoing_datagram_stream_drop_own(streams.outgoing);
48}
49
50void drop_udp_socket(udp_socket_t socket) {
51 switch (socket.state.tag) {
52 case UDP_SOCKET_STATE_UNBOUND:
53 case UDP_SOCKET_STATE_BOUND_NOSTREAMS:
54 // No additional resources to drop.
55 break;
56 case UDP_SOCKET_STATE_BOUND_STREAMING:
57 drop_udp_socket_streams(socket.state.bound_streaming.streams);
58 break;
59 case UDP_SOCKET_STATE_CONNECTED: {
60 drop_udp_socket_streams(socket.state.connected.streams);
61 break;
62 }
63 default: /* unreachable */ abort();
64 }
65
66 poll_pollable_drop_own(socket.socket_pollable);
67 udp_udp_socket_drop_own(socket.socket);
68}
69#endif // __wasilibc_use_wasip2
70
71int close(int fd) {
72 // Scan the preopen fds before making any changes.
73 __wasilibc_populate_preopens();
74
75#ifdef __wasilibc_use_wasip2
76 descriptor_table_entry_t entry;
77 if (descriptor_table_remove(fd, &entry)) {
78
79 switch (entry.tag)
80 {
81 case DESCRIPTOR_TABLE_ENTRY_TCP_SOCKET:
82 drop_tcp_socket(entry.tcp_socket);
83 break;
84 case DESCRIPTOR_TABLE_ENTRY_UDP_SOCKET:
85 drop_udp_socket(entry.udp_socket);
86 break;
87 default: /* unreachable */ abort();
88 }
89
90 return 0;
91 }
92#endif // __wasilibc_use_wasip2
93
94 __wasi_errno_t error = __wasi_fd_close(fd);
95 if (error != 0) {
96 errno = error;
97 return -1;
98 }
99
100 return 0;
101}
102
103weak void __wasilibc_populate_preopens(void) {
104 // This version does nothing. It may be overridden by a version which does
105 // something if `__wasilibc_find_abspath` or `__wasilibc_find_relpath` are
106 // used.
107}
lib/libc/wasi/libc-bottom-half/sources/accept-wasip1.c created+51
......@@ -0,0 +1,51 @@
1// SPDX-License-Identifier: BSD-2-Clause
2
3#include <sys/socket.h>
4
5#include <assert.h>
6#include <wasi/api.h>
7#include <errno.h>
8#include <string.h>
9
10int accept(int socket, struct sockaddr *restrict addr, socklen_t *restrict addrlen) {
11 int ret = -1;
12
13 __wasi_errno_t error = __wasi_sock_accept(socket, 0, &ret);
14
15 if (error != 0) {
16 errno = error;
17 return -1;
18 }
19
20 // Clear sockaddr to indicate undefined address
21 memset(addr, 0, *addrlen);
22 // might be AF_UNIX or AF_INET
23 addr->sa_family = AF_UNSPEC;
24 *addrlen = sizeof(struct sockaddr);
25
26 return ret;
27}
28
29int accept4(int socket, struct sockaddr *restrict addr, socklen_t *restrict addrlen, int flags) {
30 int ret = -1;
31
32 if (flags & ~(SOCK_NONBLOCK | SOCK_CLOEXEC)) {
33 errno = EINVAL;
34 return -1;
35 }
36
37 __wasi_errno_t error = __wasi_sock_accept(socket, (flags & SOCK_NONBLOCK) ? __WASI_FDFLAGS_NONBLOCK : 0, &ret);
38
39 if (error != 0) {
40 errno = error;
41 return -1;
42 }
43
44 // Clear sockaddr to indicate undefined address
45 memset(addr, 0, *addrlen);
46 // might be AF_UNIX or AF_INET
47 addr->sa_family = AF_UNSPEC;
48 *addrlen = sizeof(struct sockaddr);
49
50 return ret;
51}
lib/libc/wasi/libc-bottom-half/sources/accept.c deleted-51
......@@ -1,51 +0,0 @@
1// SPDX-License-Identifier: BSD-2-Clause
2
3#include <sys/socket.h>
4
5#include <assert.h>
6#include <wasi/api.h>
7#include <errno.h>
8#include <string.h>
9
10int accept(int socket, struct sockaddr *restrict addr, socklen_t *restrict addrlen) {
11 int ret = -1;
12
13 __wasi_errno_t error = __wasi_sock_accept(socket, 0, &ret);
14
15 if (error != 0) {
16 errno = error;
17 return -1;
18 }
19
20 // Clear sockaddr to indicate undefined address
21 memset(addr, 0, *addrlen);
22 // might be AF_UNIX or AF_INET
23 addr->sa_family = AF_UNSPEC;
24 *addrlen = sizeof(struct sockaddr);
25
26 return ret;
27}
28
29int accept4(int socket, struct sockaddr *restrict addr, socklen_t *restrict addrlen, int flags) {
30 int ret = -1;
31
32 if (flags & ~(SOCK_NONBLOCK | SOCK_CLOEXEC)) {
33 errno = EINVAL;
34 return -1;
35 }
36
37 __wasi_errno_t error = __wasi_sock_accept(socket, (flags & SOCK_NONBLOCK) ? __WASI_FDFLAGS_NONBLOCK : 0, &ret);
38
39 if (error != 0) {
40 errno = error;
41 return -1;
42 }
43
44 // Clear sockaddr to indicate undefined address
45 memset(addr, 0, *addrlen);
46 // might be AF_UNIX or AF_INET
47 addr->sa_family = AF_UNSPEC;
48 *addrlen = sizeof(struct sockaddr);
49
50 return ret;
51}
lib/libc/wasi/libc-bottom-half/sources/posix.c+41
......@@ -6,6 +6,7 @@
66#include <fcntl.h>
77#include <stdlib.h>
88#include <sys/stat.h>
9#include <sys/statvfs.h>
910#include <unistd.h>
1011#include <utime.h>
1112#include <wasi/libc.h>
......@@ -310,6 +311,46 @@ int rename(const char *old, const char *new) {
310311 return -1;
311312}
312313
314int chmod(const char *path, mode_t mode) {
315 // TODO: We plan to support this eventually in WASI, but not yet.
316 // Meanwhile, we provide a stub so that libc++'s `<filesystem>`
317 // implementation will build unmodified.
318 errno = ENOSYS;
319 return -1;
320}
321
322int fchmod(int fd, mode_t mode) {
323 // TODO: We plan to support this eventually in WASI, but not yet.
324 // Meanwhile, we provide a stub so that libc++'s `<filesystem>`
325 // implementation will build unmodified.
326 errno = ENOSYS;
327 return -1;
328}
329
330int fchmodat(int fd, const char *path, mode_t mode, int flag) {
331 // TODO: We plan to support this eventually in WASI, but not yet.
332 // Meanwhile, we provide a stub so that libc++'s `<filesystem>`
333 // implementation will build unmodified.
334 errno = ENOSYS;
335 return -1;
336}
337
338int statvfs(const char *__restrict path, struct statvfs *__restrict buf) {
339 // TODO: We plan to support this eventually in WASI, but not yet.
340 // Meanwhile, we provide a stub so that libc++'s `<filesystem>`
341 // implementation will build unmodified.
342 errno = ENOSYS;
343 return -1;
344}
345
346int fstatvfs(int fd, struct statvfs *buf) {
347 // TODO: We plan to support this eventually in WASI, but not yet.
348 // Meanwhile, we provide a stub so that libc++'s `<filesystem>`
349 // implementation will build unmodified.
350 errno = ENOSYS;
351 return -1;
352}
353
313354// Like `access`, but with `faccessat`'s flags argument.
314355int
315356__wasilibc_access(const char *path, int mode, int flags)
lib/libc/wasi/libc-bottom-half/sources/preopens.c-48
......@@ -218,51 +218,3 @@ int __wasilibc_find_abspath(const char *path,
218218 *relative_path = computed;
219219 return fd;
220220}
221
222/// This is referenced by weak reference from crt1.c and lives in the same
223/// source file as `__wasilibc_find_relpath` so that it's linked in when it's
224/// needed.
225// Concerning the 51 -- see the comment by the constructor priority in
226// libc-bottom-half/sources/environ.c.
227__attribute__((constructor(51)))
228static void __wasilibc_populate_preopens(void) {
229 // Skip stdin, stdout, and stderr, and count up until we reach an invalid
230 // file descriptor.
231 for (__wasi_fd_t fd = 3; fd != 0; ++fd) {
232 __wasi_prestat_t prestat;
233 __wasi_errno_t ret = __wasi_fd_prestat_get(fd, &prestat);
234 if (ret == __WASI_ERRNO_BADF)
235 break;
236 if (ret != __WASI_ERRNO_SUCCESS)
237 goto oserr;
238 switch (prestat.tag) {
239 case __WASI_PREOPENTYPE_DIR: {
240 char *prefix = malloc(prestat.u.dir.pr_name_len + 1);
241 if (prefix == NULL)
242 goto software;
243
244 // TODO: Remove the cast on `path` once the witx is updated with
245 // char8 support.
246 ret = __wasi_fd_prestat_dir_name(fd, (uint8_t *)prefix,
247 prestat.u.dir.pr_name_len);
248 if (ret != __WASI_ERRNO_SUCCESS)
249 goto oserr;
250 prefix[prestat.u.dir.pr_name_len] = '\0';
251
252 if (internal_register_preopened_fd(fd, prefix) != 0)
253 goto software;
254 free(prefix);
255
256 break;
257 }
258 default:
259 break;
260 }
261 }
262
263 return;
264oserr:
265 _Exit(EX_OSERR);
266software:
267 _Exit(EX_SOFTWARE);
268}
lib/libc/wasi/libc-top-half/musl/.mailmap deleted-1
......@@ -1 +0,0 @@
1Ada Worcester <oss@ada.pikhq.com> <josiahw@gmail.com>
lib/libc/wasi/libc-top-half/musl/arch/wasm32/bits/setjmp.h created+1
......@@ -0,0 +1 @@
1typedef unsigned long __jmp_buf[8];
lib/libc/wasi/libc-top-half/musl/include/aio.h deleted-73
......@@ -1,73 +0,0 @@
1#ifndef _AIO_H
2#define _AIO_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <features.h>
9#include <signal.h>
10#include <time.h>
11
12#define __NEED_ssize_t
13#define __NEED_off_t
14
15#include <bits/alltypes.h>
16
17struct aiocb {
18 int aio_fildes, aio_lio_opcode, aio_reqprio;
19 volatile void *aio_buf;
20 size_t aio_nbytes;
21 struct sigevent aio_sigevent;
22 void *__td;
23 int __lock[2];
24 volatile int __err;
25 ssize_t __ret;
26 off_t aio_offset;
27 void *__next, *__prev;
28 char __dummy4[32-2*sizeof(void *)];
29};
30
31#define AIO_CANCELED 0
32#define AIO_NOTCANCELED 1
33#define AIO_ALLDONE 2
34
35#define LIO_READ 0
36#define LIO_WRITE 1
37#define LIO_NOP 2
38
39#define LIO_WAIT 0
40#define LIO_NOWAIT 1
41
42int aio_read(struct aiocb *);
43int aio_write(struct aiocb *);
44int aio_error(const struct aiocb *);
45ssize_t aio_return(struct aiocb *);
46int aio_cancel(int, struct aiocb *);
47int aio_suspend(const struct aiocb *const [], int, const struct timespec *);
48int aio_fsync(int, struct aiocb *);
49
50int lio_listio(int, struct aiocb *__restrict const *__restrict, int, struct sigevent *__restrict);
51
52#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
53#define aiocb64 aiocb
54#define aio_read64 aio_read
55#define aio_write64 aio_write
56#define aio_error64 aio_error
57#define aio_return64 aio_return
58#define aio_cancel64 aio_cancel
59#define aio_suspend64 aio_suspend
60#define aio_fsync64 aio_fsync
61#define lio_listio64 lio_listio
62#define off64_t off_t
63#endif
64
65#if _REDIR_TIME64
66__REDIR(aio_suspend, __aio_suspend_time64);
67#endif
68
69#ifdef __cplusplus
70}
71#endif
72
73#endif
lib/libc/wasi/libc-top-half/musl/include/alltypes.h.in deleted-118
......@@ -1,118 +0,0 @@
1#define __LITTLE_ENDIAN 1234
2#define __BIG_ENDIAN 4321
3#define __USE_TIME_BITS64 1
4
5TYPEDEF unsigned _Addr size_t;
6TYPEDEF unsigned _Addr uintptr_t;
7TYPEDEF _Addr ptrdiff_t;
8TYPEDEF _Addr ssize_t;
9TYPEDEF _Addr intptr_t;
10TYPEDEF _Addr regoff_t;
11TYPEDEF _Reg register_t;
12#ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */
13TYPEDEF _Int64 time_t;
14TYPEDEF _Int64 suseconds_t;
15#else
16#if defined(__NEED_time_t) && !defined(__DEFINED_time_t)
17#include <__typedef_time_t.h>
18#define __DEFINED_time_t
19#endif
20
21#if defined(__NEED_suseconds_t) && !defined(__DEFINED_suseconds_t)
22#include <__typedef_suseconds_t.h>
23#define __DEFINED_suseconds_t
24#endif
25#endif
26
27TYPEDEF signed char int8_t;
28TYPEDEF signed short int16_t;
29TYPEDEF signed int int32_t;
30TYPEDEF signed _Int64 int64_t;
31TYPEDEF signed _Int64 intmax_t;
32TYPEDEF unsigned char uint8_t;
33TYPEDEF unsigned short uint16_t;
34TYPEDEF unsigned int uint32_t;
35TYPEDEF unsigned _Int64 uint64_t;
36TYPEDEF unsigned _Int64 u_int64_t;
37TYPEDEF unsigned _Int64 uintmax_t;
38
39TYPEDEF unsigned mode_t;
40TYPEDEF unsigned _Reg nlink_t;
41TYPEDEF _Int64 off_t;
42TYPEDEF unsigned _Int64 ino_t;
43TYPEDEF unsigned _Int64 dev_t;
44TYPEDEF long blksize_t;
45TYPEDEF _Int64 blkcnt_t;
46TYPEDEF unsigned _Int64 fsblkcnt_t;
47TYPEDEF unsigned _Int64 fsfilcnt_t;
48
49TYPEDEF unsigned wint_t;
50TYPEDEF unsigned long wctype_t;
51
52TYPEDEF void * timer_t;
53TYPEDEF int clockid_t;
54TYPEDEF long clock_t;
55#ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */
56STRUCT timeval { time_t tv_sec; suseconds_t tv_usec; };
57STRUCT timespec { time_t tv_sec; int :8*(sizeof(time_t)-sizeof(long))*(__BYTE_ORDER==4321); long tv_nsec; int :8*(sizeof(time_t)-sizeof(long))*(__BYTE_ORDER!=4321); };
58#else
59#include <__struct_timeval.h>
60#include <__struct_timespec.h>
61#endif
62
63TYPEDEF int pid_t;
64TYPEDEF unsigned id_t;
65TYPEDEF unsigned uid_t;
66TYPEDEF unsigned gid_t;
67TYPEDEF int key_t;
68TYPEDEF unsigned useconds_t;
69
70#ifdef __cplusplus
71TYPEDEF unsigned long pthread_t;
72#else
73TYPEDEF struct __pthread * pthread_t;
74#endif
75TYPEDEF int pthread_once_t;
76TYPEDEF unsigned pthread_key_t;
77TYPEDEF int pthread_spinlock_t;
78TYPEDEF struct { unsigned __attr; } pthread_mutexattr_t;
79TYPEDEF struct { unsigned __attr; } pthread_condattr_t;
80TYPEDEF struct { unsigned __attr; } pthread_barrierattr_t;
81TYPEDEF struct { unsigned __attr[2]; } pthread_rwlockattr_t;
82
83#ifdef __wasilibc_unmodified_upstream /* WASI doesn't need to define FILE as a complete type */
84STRUCT _IO_FILE { char __x; };
85#endif
86TYPEDEF struct _IO_FILE FILE;
87
88TYPEDEF __builtin_va_list va_list;
89TYPEDEF __builtin_va_list __isoc_va_list;
90
91TYPEDEF struct __mbstate_t { unsigned __opaque1, __opaque2; } mbstate_t;
92
93TYPEDEF struct __locale_struct * locale_t;
94
95TYPEDEF struct __sigset_t { unsigned long __bits[128/sizeof(long)]; } sigset_t;
96
97#ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */
98STRUCT iovec { void *iov_base; size_t iov_len; };
99#else
100#include <__struct_iovec.h>
101#endif
102
103STRUCT winsize { unsigned short ws_row, ws_col, ws_xpixel, ws_ypixel; };
104
105TYPEDEF unsigned socklen_t;
106TYPEDEF unsigned short sa_family_t;
107
108TYPEDEF struct { union { int __i[sizeof(long)==8?14:9]; volatile int __vi[sizeof(long)==8?14:9]; unsigned long __s[sizeof(long)==8?7:9]; } __u; } pthread_attr_t;
109TYPEDEF struct { union { int __i[sizeof(long)==8?10:6]; volatile int __vi[sizeof(long)==8?10:6]; volatile void *volatile __p[sizeof(long)==8?5:6]; } __u; } pthread_mutex_t;
110TYPEDEF struct { union { int __i[sizeof(long)==8?10:6]; volatile int __vi[sizeof(long)==8?10:6]; volatile void *volatile __p[sizeof(long)==8?5:6]; } __u; } mtx_t;
111TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12*sizeof(int)/sizeof(void*)]; } __u; } pthread_cond_t;
112TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12*sizeof(int)/sizeof(void*)]; } __u; } cnd_t;
113TYPEDEF struct { union { int __i[sizeof(long)==8?14:8]; volatile int __vi[sizeof(long)==8?14:8]; void *__p[sizeof(long)==8?7:8]; } __u; } pthread_rwlock_t;
114TYPEDEF struct { union { int __i[sizeof(long)==8?8:5]; volatile int __vi[sizeof(long)==8?8:5]; void *__p[sizeof(long)==8?4:5]; } __u; } pthread_barrier_t;
115
116#undef _Addr
117#undef _Int64
118#undef _Reg
lib/libc/wasi/libc-top-half/musl/include/dlfcn.h+11-1
......@@ -12,19 +12,29 @@ extern "C" {
1212#define RTLD_NOLOAD 4
1313#define RTLD_NODELETE 4096
1414#define RTLD_GLOBAL 256
15#ifdef __wasilibc_unmodified_upstream
1516#define RTLD_LOCAL 0
17#else
18/* For WASI, we give `RTLD_LOCAL` a non-zero value, avoiding ambiguity and
19 * allowing us to defer the decision of whether `RTLD_LOCAL` or `RTLD_GLOBAL`
20 * should be the default when neither is specified.
21 */
22#define RTLD_LOCAL 8
23#endif
1624
1725#define RTLD_NEXT ((void *)-1)
1826#define RTLD_DEFAULT ((void *)0)
1927
28#ifdef __wasilibc_unmodified_upstream
2029#define RTLD_DI_LINKMAP 2
30#endif
2131
2232int dlclose(void *);
2333char *dlerror(void);
2434void *dlopen(const char *, int);
2535void *dlsym(void *__restrict, const char *__restrict);
2636
27#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
37#if defined(__wasilibc_unmodified_upstream) && (defined(_GNU_SOURCE) || defined(_BSD_SOURCE))
2838typedef struct {
2939 const char *dli_fname;
3040 void *dli_fbase;
lib/libc/wasi/libc-top-half/musl/include/elf.h deleted-3296
......@@ -1,3296 +0,0 @@
1#ifndef _ELF_H
2#define _ELF_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <stdint.h>
9
10typedef uint16_t Elf32_Half;
11typedef uint16_t Elf64_Half;
12
13typedef uint32_t Elf32_Word;
14typedef int32_t Elf32_Sword;
15typedef uint32_t Elf64_Word;
16typedef int32_t Elf64_Sword;
17
18typedef uint64_t Elf32_Xword;
19typedef int64_t Elf32_Sxword;
20typedef uint64_t Elf64_Xword;
21typedef int64_t Elf64_Sxword;
22
23typedef uint32_t Elf32_Addr;
24typedef uint64_t Elf64_Addr;
25
26typedef uint32_t Elf32_Off;
27typedef uint64_t Elf64_Off;
28
29typedef uint16_t Elf32_Section;
30typedef uint16_t Elf64_Section;
31
32typedef Elf32_Half Elf32_Versym;
33typedef Elf64_Half Elf64_Versym;
34
35#define EI_NIDENT (16)
36
37typedef struct {
38 unsigned char e_ident[EI_NIDENT];
39 Elf32_Half e_type;
40 Elf32_Half e_machine;
41 Elf32_Word e_version;
42 Elf32_Addr e_entry;
43 Elf32_Off e_phoff;
44 Elf32_Off e_shoff;
45 Elf32_Word e_flags;
46 Elf32_Half e_ehsize;
47 Elf32_Half e_phentsize;
48 Elf32_Half e_phnum;
49 Elf32_Half e_shentsize;
50 Elf32_Half e_shnum;
51 Elf32_Half e_shstrndx;
52} Elf32_Ehdr;
53
54typedef struct {
55 unsigned char e_ident[EI_NIDENT];
56 Elf64_Half e_type;
57 Elf64_Half e_machine;
58 Elf64_Word e_version;
59 Elf64_Addr e_entry;
60 Elf64_Off e_phoff;
61 Elf64_Off e_shoff;
62 Elf64_Word e_flags;
63 Elf64_Half e_ehsize;
64 Elf64_Half e_phentsize;
65 Elf64_Half e_phnum;
66 Elf64_Half e_shentsize;
67 Elf64_Half e_shnum;
68 Elf64_Half e_shstrndx;
69} Elf64_Ehdr;
70
71#define EI_MAG0 0
72#define ELFMAG0 0x7f
73
74#define EI_MAG1 1
75#define ELFMAG1 'E'
76
77#define EI_MAG2 2
78#define ELFMAG2 'L'
79
80#define EI_MAG3 3
81#define ELFMAG3 'F'
82
83
84#define ELFMAG "\177ELF"
85#define SELFMAG 4
86
87#define EI_CLASS 4
88#define ELFCLASSNONE 0
89#define ELFCLASS32 1
90#define ELFCLASS64 2
91#define ELFCLASSNUM 3
92
93#define EI_DATA 5
94#define ELFDATANONE 0
95#define ELFDATA2LSB 1
96#define ELFDATA2MSB 2
97#define ELFDATANUM 3
98
99#define EI_VERSION 6
100
101
102#define EI_OSABI 7
103#define ELFOSABI_NONE 0
104#define ELFOSABI_SYSV 0
105#define ELFOSABI_HPUX 1
106#define ELFOSABI_NETBSD 2
107#define ELFOSABI_LINUX 3
108#define ELFOSABI_GNU 3
109#define ELFOSABI_SOLARIS 6
110#define ELFOSABI_AIX 7
111#define ELFOSABI_IRIX 8
112#define ELFOSABI_FREEBSD 9
113#define ELFOSABI_TRU64 10
114#define ELFOSABI_MODESTO 11
115#define ELFOSABI_OPENBSD 12
116#define ELFOSABI_ARM 97
117#define ELFOSABI_STANDALONE 255
118
119#define EI_ABIVERSION 8
120
121#define EI_PAD 9
122
123
124
125#define ET_NONE 0
126#define ET_REL 1
127#define ET_EXEC 2
128#define ET_DYN 3
129#define ET_CORE 4
130#define ET_NUM 5
131#define ET_LOOS 0xfe00
132#define ET_HIOS 0xfeff
133#define ET_LOPROC 0xff00
134#define ET_HIPROC 0xffff
135
136
137
138#define EM_NONE 0
139#define EM_M32 1
140#define EM_SPARC 2
141#define EM_386 3
142#define EM_68K 4
143#define EM_88K 5
144#define EM_860 7
145#define EM_MIPS 8
146#define EM_S370 9
147#define EM_MIPS_RS3_LE 10
148
149#define EM_PARISC 15
150#define EM_VPP500 17
151#define EM_SPARC32PLUS 18
152#define EM_960 19
153#define EM_PPC 20
154#define EM_PPC64 21
155#define EM_S390 22
156
157#define EM_V800 36
158#define EM_FR20 37
159#define EM_RH32 38
160#define EM_RCE 39
161#define EM_ARM 40
162#define EM_FAKE_ALPHA 41
163#define EM_SH 42
164#define EM_SPARCV9 43
165#define EM_TRICORE 44
166#define EM_ARC 45
167#define EM_H8_300 46
168#define EM_H8_300H 47
169#define EM_H8S 48
170#define EM_H8_500 49
171#define EM_IA_64 50
172#define EM_MIPS_X 51
173#define EM_COLDFIRE 52
174#define EM_68HC12 53
175#define EM_MMA 54
176#define EM_PCP 55
177#define EM_NCPU 56
178#define EM_NDR1 57
179#define EM_STARCORE 58
180#define EM_ME16 59
181#define EM_ST100 60
182#define EM_TINYJ 61
183#define EM_X86_64 62
184#define EM_PDSP 63
185
186#define EM_FX66 66
187#define EM_ST9PLUS 67
188#define EM_ST7 68
189#define EM_68HC16 69
190#define EM_68HC11 70
191#define EM_68HC08 71
192#define EM_68HC05 72
193#define EM_SVX 73
194#define EM_ST19 74
195#define EM_VAX 75
196#define EM_CRIS 76
197#define EM_JAVELIN 77
198#define EM_FIREPATH 78
199#define EM_ZSP 79
200#define EM_MMIX 80
201#define EM_HUANY 81
202#define EM_PRISM 82
203#define EM_AVR 83
204#define EM_FR30 84
205#define EM_D10V 85
206#define EM_D30V 86
207#define EM_V850 87
208#define EM_M32R 88
209#define EM_MN10300 89
210#define EM_MN10200 90
211#define EM_PJ 91
212#define EM_OR1K 92
213#define EM_OPENRISC 92
214#define EM_ARC_A5 93
215#define EM_ARC_COMPACT 93
216#define EM_XTENSA 94
217#define EM_VIDEOCORE 95
218#define EM_TMM_GPP 96
219#define EM_NS32K 97
220#define EM_TPC 98
221#define EM_SNP1K 99
222#define EM_ST200 100
223#define EM_IP2K 101
224#define EM_MAX 102
225#define EM_CR 103
226#define EM_F2MC16 104
227#define EM_MSP430 105
228#define EM_BLACKFIN 106
229#define EM_SE_C33 107
230#define EM_SEP 108
231#define EM_ARCA 109
232#define EM_UNICORE 110
233#define EM_EXCESS 111
234#define EM_DXP 112
235#define EM_ALTERA_NIOS2 113
236#define EM_CRX 114
237#define EM_XGATE 115
238#define EM_C166 116
239#define EM_M16C 117
240#define EM_DSPIC30F 118
241#define EM_CE 119
242#define EM_M32C 120
243#define EM_TSK3000 131
244#define EM_RS08 132
245#define EM_SHARC 133
246#define EM_ECOG2 134
247#define EM_SCORE7 135
248#define EM_DSP24 136
249#define EM_VIDEOCORE3 137
250#define EM_LATTICEMICO32 138
251#define EM_SE_C17 139
252#define EM_TI_C6000 140
253#define EM_TI_C2000 141
254#define EM_TI_C5500 142
255#define EM_TI_ARP32 143
256#define EM_TI_PRU 144
257#define EM_MMDSP_PLUS 160
258#define EM_CYPRESS_M8C 161
259#define EM_R32C 162
260#define EM_TRIMEDIA 163
261#define EM_QDSP6 164
262#define EM_8051 165
263#define EM_STXP7X 166
264#define EM_NDS32 167
265#define EM_ECOG1X 168
266#define EM_MAXQ30 169
267#define EM_XIMO16 170
268#define EM_MANIK 171
269#define EM_CRAYNV2 172
270#define EM_RX 173
271#define EM_METAG 174
272#define EM_MCST_ELBRUS 175
273#define EM_ECOG16 176
274#define EM_CR16 177
275#define EM_ETPU 178
276#define EM_SLE9X 179
277#define EM_L10M 180
278#define EM_K10M 181
279#define EM_AARCH64 183
280#define EM_AVR32 185
281#define EM_STM8 186
282#define EM_TILE64 187
283#define EM_TILEPRO 188
284#define EM_MICROBLAZE 189
285#define EM_CUDA 190
286#define EM_TILEGX 191
287#define EM_CLOUDSHIELD 192
288#define EM_COREA_1ST 193
289#define EM_COREA_2ND 194
290#define EM_ARC_COMPACT2 195
291#define EM_OPEN8 196
292#define EM_RL78 197
293#define EM_VIDEOCORE5 198
294#define EM_78KOR 199
295#define EM_56800EX 200
296#define EM_BA1 201
297#define EM_BA2 202
298#define EM_XCORE 203
299#define EM_MCHP_PIC 204
300#define EM_KM32 210
301#define EM_KMX32 211
302#define EM_EMX16 212
303#define EM_EMX8 213
304#define EM_KVARC 214
305#define EM_CDP 215
306#define EM_COGE 216
307#define EM_COOL 217
308#define EM_NORC 218
309#define EM_CSR_KALIMBA 219
310#define EM_Z80 220
311#define EM_VISIUM 221
312#define EM_FT32 222
313#define EM_MOXIE 223
314#define EM_AMDGPU 224
315#define EM_RISCV 243
316#define EM_BPF 247
317#define EM_CSKY 252
318#define EM_NUM 253
319
320#define EM_ALPHA 0x9026
321
322#define EV_NONE 0
323#define EV_CURRENT 1
324#define EV_NUM 2
325
326typedef struct {
327 Elf32_Word sh_name;
328 Elf32_Word sh_type;
329 Elf32_Word sh_flags;
330 Elf32_Addr sh_addr;
331 Elf32_Off sh_offset;
332 Elf32_Word sh_size;
333 Elf32_Word sh_link;
334 Elf32_Word sh_info;
335 Elf32_Word sh_addralign;
336 Elf32_Word sh_entsize;
337} Elf32_Shdr;
338
339typedef struct {
340 Elf64_Word sh_name;
341 Elf64_Word sh_type;
342 Elf64_Xword sh_flags;
343 Elf64_Addr sh_addr;
344 Elf64_Off sh_offset;
345 Elf64_Xword sh_size;
346 Elf64_Word sh_link;
347 Elf64_Word sh_info;
348 Elf64_Xword sh_addralign;
349 Elf64_Xword sh_entsize;
350} Elf64_Shdr;
351
352
353
354#define SHN_UNDEF 0
355#define SHN_LORESERVE 0xff00
356#define SHN_LOPROC 0xff00
357#define SHN_BEFORE 0xff00
358
359#define SHN_AFTER 0xff01
360
361#define SHN_HIPROC 0xff1f
362#define SHN_LOOS 0xff20
363#define SHN_HIOS 0xff3f
364#define SHN_ABS 0xfff1
365#define SHN_COMMON 0xfff2
366#define SHN_XINDEX 0xffff
367#define SHN_HIRESERVE 0xffff
368
369
370
371#define SHT_NULL 0
372#define SHT_PROGBITS 1
373#define SHT_SYMTAB 2
374#define SHT_STRTAB 3
375#define SHT_RELA 4
376#define SHT_HASH 5
377#define SHT_DYNAMIC 6
378#define SHT_NOTE 7
379#define SHT_NOBITS 8
380#define SHT_REL 9
381#define SHT_SHLIB 10
382#define SHT_DYNSYM 11
383#define SHT_INIT_ARRAY 14
384#define SHT_FINI_ARRAY 15
385#define SHT_PREINIT_ARRAY 16
386#define SHT_GROUP 17
387#define SHT_SYMTAB_SHNDX 18
388#define SHT_NUM 19
389#define SHT_LOOS 0x60000000
390#define SHT_GNU_ATTRIBUTES 0x6ffffff5
391#define SHT_GNU_HASH 0x6ffffff6
392#define SHT_GNU_LIBLIST 0x6ffffff7
393#define SHT_CHECKSUM 0x6ffffff8
394#define SHT_LOSUNW 0x6ffffffa
395#define SHT_SUNW_move 0x6ffffffa
396#define SHT_SUNW_COMDAT 0x6ffffffb
397#define SHT_SUNW_syminfo 0x6ffffffc
398#define SHT_GNU_verdef 0x6ffffffd
399#define SHT_GNU_verneed 0x6ffffffe
400#define SHT_GNU_versym 0x6fffffff
401#define SHT_HISUNW 0x6fffffff
402#define SHT_HIOS 0x6fffffff
403#define SHT_LOPROC 0x70000000
404#define SHT_HIPROC 0x7fffffff
405#define SHT_LOUSER 0x80000000
406#define SHT_HIUSER 0x8fffffff
407
408#define SHF_WRITE (1 << 0)
409#define SHF_ALLOC (1 << 1)
410#define SHF_EXECINSTR (1 << 2)
411#define SHF_MERGE (1 << 4)
412#define SHF_STRINGS (1 << 5)
413#define SHF_INFO_LINK (1 << 6)
414#define SHF_LINK_ORDER (1 << 7)
415#define SHF_OS_NONCONFORMING (1 << 8)
416
417#define SHF_GROUP (1 << 9)
418#define SHF_TLS (1 << 10)
419#define SHF_COMPRESSED (1 << 11)
420#define SHF_MASKOS 0x0ff00000
421#define SHF_MASKPROC 0xf0000000
422#define SHF_ORDERED (1 << 30)
423#define SHF_EXCLUDE (1U << 31)
424
425typedef struct {
426 Elf32_Word ch_type;
427 Elf32_Word ch_size;
428 Elf32_Word ch_addralign;
429} Elf32_Chdr;
430
431typedef struct {
432 Elf64_Word ch_type;
433 Elf64_Word ch_reserved;
434 Elf64_Xword ch_size;
435 Elf64_Xword ch_addralign;
436} Elf64_Chdr;
437
438#define ELFCOMPRESS_ZLIB 1
439#define ELFCOMPRESS_LOOS 0x60000000
440#define ELFCOMPRESS_HIOS 0x6fffffff
441#define ELFCOMPRESS_LOPROC 0x70000000
442#define ELFCOMPRESS_HIPROC 0x7fffffff
443
444
445#define GRP_COMDAT 0x1
446
447typedef struct {
448 Elf32_Word st_name;
449 Elf32_Addr st_value;
450 Elf32_Word st_size;
451 unsigned char st_info;
452 unsigned char st_other;
453 Elf32_Section st_shndx;
454} Elf32_Sym;
455
456typedef struct {
457 Elf64_Word st_name;
458 unsigned char st_info;
459 unsigned char st_other;
460 Elf64_Section st_shndx;
461 Elf64_Addr st_value;
462 Elf64_Xword st_size;
463} Elf64_Sym;
464
465typedef struct {
466 Elf32_Half si_boundto;
467 Elf32_Half si_flags;
468} Elf32_Syminfo;
469
470typedef struct {
471 Elf64_Half si_boundto;
472 Elf64_Half si_flags;
473} Elf64_Syminfo;
474
475#define SYMINFO_BT_SELF 0xffff
476#define SYMINFO_BT_PARENT 0xfffe
477#define SYMINFO_BT_LOWRESERVE 0xff00
478
479#define SYMINFO_FLG_DIRECT 0x0001
480#define SYMINFO_FLG_PASSTHRU 0x0002
481#define SYMINFO_FLG_COPY 0x0004
482#define SYMINFO_FLG_LAZYLOAD 0x0008
483
484#define SYMINFO_NONE 0
485#define SYMINFO_CURRENT 1
486#define SYMINFO_NUM 2
487
488#define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4)
489#define ELF32_ST_TYPE(val) ((val) & 0xf)
490#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
491
492#define ELF64_ST_BIND(val) ELF32_ST_BIND (val)
493#define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val)
494#define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type))
495
496#define STB_LOCAL 0
497#define STB_GLOBAL 1
498#define STB_WEAK 2
499#define STB_NUM 3
500#define STB_LOOS 10
501#define STB_GNU_UNIQUE 10
502#define STB_HIOS 12
503#define STB_LOPROC 13
504#define STB_HIPROC 15
505
506#define STT_NOTYPE 0
507#define STT_OBJECT 1
508#define STT_FUNC 2
509#define STT_SECTION 3
510#define STT_FILE 4
511#define STT_COMMON 5
512#define STT_TLS 6
513#define STT_NUM 7
514#define STT_LOOS 10
515#define STT_GNU_IFUNC 10
516#define STT_HIOS 12
517#define STT_LOPROC 13
518#define STT_HIPROC 15
519
520#define STN_UNDEF 0
521
522#define ELF32_ST_VISIBILITY(o) ((o) & 0x03)
523#define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o)
524
525#define STV_DEFAULT 0
526#define STV_INTERNAL 1
527#define STV_HIDDEN 2
528#define STV_PROTECTED 3
529
530
531
532
533typedef struct {
534 Elf32_Addr r_offset;
535 Elf32_Word r_info;
536} Elf32_Rel;
537
538typedef struct {
539 Elf64_Addr r_offset;
540 Elf64_Xword r_info;
541} Elf64_Rel;
542
543
544
545typedef struct {
546 Elf32_Addr r_offset;
547 Elf32_Word r_info;
548 Elf32_Sword r_addend;
549} Elf32_Rela;
550
551typedef struct {
552 Elf64_Addr r_offset;
553 Elf64_Xword r_info;
554 Elf64_Sxword r_addend;
555} Elf64_Rela;
556
557
558
559#define ELF32_R_SYM(val) ((val) >> 8)
560#define ELF32_R_TYPE(val) ((val) & 0xff)
561#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff))
562
563#define ELF64_R_SYM(i) ((i) >> 32)
564#define ELF64_R_TYPE(i) ((i) & 0xffffffff)
565#define ELF64_R_INFO(sym,type) ((((Elf64_Xword) (sym)) << 32) + (type))
566
567
568
569typedef struct {
570 Elf32_Word p_type;
571 Elf32_Off p_offset;
572 Elf32_Addr p_vaddr;
573 Elf32_Addr p_paddr;
574 Elf32_Word p_filesz;
575 Elf32_Word p_memsz;
576 Elf32_Word p_flags;
577 Elf32_Word p_align;
578} Elf32_Phdr;
579
580typedef struct {
581 Elf64_Word p_type;
582 Elf64_Word p_flags;
583 Elf64_Off p_offset;
584 Elf64_Addr p_vaddr;
585 Elf64_Addr p_paddr;
586 Elf64_Xword p_filesz;
587 Elf64_Xword p_memsz;
588 Elf64_Xword p_align;
589} Elf64_Phdr;
590
591
592
593#define PT_NULL 0
594#define PT_LOAD 1
595#define PT_DYNAMIC 2
596#define PT_INTERP 3
597#define PT_NOTE 4
598#define PT_SHLIB 5
599#define PT_PHDR 6
600#define PT_TLS 7
601#define PT_NUM 8
602#define PT_LOOS 0x60000000
603#define PT_GNU_EH_FRAME 0x6474e550
604#define PT_GNU_STACK 0x6474e551
605#define PT_GNU_RELRO 0x6474e552
606#define PT_GNU_PROPERTY 0x6474e553
607#define PT_LOSUNW 0x6ffffffa
608#define PT_SUNWBSS 0x6ffffffa
609#define PT_SUNWSTACK 0x6ffffffb
610#define PT_HISUNW 0x6fffffff
611#define PT_HIOS 0x6fffffff
612#define PT_LOPROC 0x70000000
613#define PT_HIPROC 0x7fffffff
614
615
616#define PN_XNUM 0xffff
617
618
619#define PF_X (1 << 0)
620#define PF_W (1 << 1)
621#define PF_R (1 << 2)
622#define PF_MASKOS 0x0ff00000
623#define PF_MASKPROC 0xf0000000
624
625
626
627#define NT_PRSTATUS 1
628#define NT_PRFPREG 2
629#define NT_FPREGSET 2
630#define NT_PRPSINFO 3
631#define NT_PRXREG 4
632#define NT_TASKSTRUCT 4
633#define NT_PLATFORM 5
634#define NT_AUXV 6
635#define NT_GWINDOWS 7
636#define NT_ASRS 8
637#define NT_PSTATUS 10
638#define NT_PSINFO 13
639#define NT_PRCRED 14
640#define NT_UTSNAME 15
641#define NT_LWPSTATUS 16
642#define NT_LWPSINFO 17
643#define NT_PRFPXREG 20
644#define NT_SIGINFO 0x53494749
645#define NT_FILE 0x46494c45
646#define NT_PRXFPREG 0x46e62b7f
647#define NT_PPC_VMX 0x100
648#define NT_PPC_SPE 0x101
649#define NT_PPC_VSX 0x102
650#define NT_PPC_TAR 0x103
651#define NT_PPC_PPR 0x104
652#define NT_PPC_DSCR 0x105
653#define NT_PPC_EBB 0x106
654#define NT_PPC_PMU 0x107
655#define NT_PPC_TM_CGPR 0x108
656#define NT_PPC_TM_CFPR 0x109
657#define NT_PPC_TM_CVMX 0x10a
658#define NT_PPC_TM_CVSX 0x10b
659#define NT_PPC_TM_SPR 0x10c
660#define NT_PPC_TM_CTAR 0x10d
661#define NT_PPC_TM_CPPR 0x10e
662#define NT_PPC_TM_CDSCR 0x10f
663#define NT_386_TLS 0x200
664#define NT_386_IOPERM 0x201
665#define NT_X86_XSTATE 0x202
666#define NT_S390_HIGH_GPRS 0x300
667#define NT_S390_TIMER 0x301
668#define NT_S390_TODCMP 0x302
669#define NT_S390_TODPREG 0x303
670#define NT_S390_CTRS 0x304
671#define NT_S390_PREFIX 0x305
672#define NT_S390_LAST_BREAK 0x306
673#define NT_S390_SYSTEM_CALL 0x307
674#define NT_S390_TDB 0x308
675#define NT_S390_VXRS_LOW 0x309
676#define NT_S390_VXRS_HIGH 0x30a
677#define NT_S390_GS_CB 0x30b
678#define NT_S390_GS_BC 0x30c
679#define NT_S390_RI_CB 0x30d
680#define NT_ARM_VFP 0x400
681#define NT_ARM_TLS 0x401
682#define NT_ARM_HW_BREAK 0x402
683#define NT_ARM_HW_WATCH 0x403
684#define NT_ARM_SYSTEM_CALL 0x404
685#define NT_ARM_SVE 0x405
686#define NT_ARM_PAC_MASK 0x406
687#define NT_ARM_PACA_KEYS 0x407
688#define NT_ARM_PACG_KEYS 0x408
689#define NT_ARM_TAGGED_ADDR_CTRL 0x409
690#define NT_ARM_PAC_ENABLED_KEYS 0x40a
691#define NT_METAG_CBUF 0x500
692#define NT_METAG_RPIPE 0x501
693#define NT_METAG_TLS 0x502
694#define NT_ARC_V2 0x600
695#define NT_VMCOREDD 0x700
696#define NT_MIPS_DSP 0x800
697#define NT_MIPS_FP_MODE 0x801
698#define NT_MIPS_MSA 0x802
699#define NT_VERSION 1
700
701
702
703
704typedef struct {
705 Elf32_Sword d_tag;
706 union {
707 Elf32_Word d_val;
708 Elf32_Addr d_ptr;
709 } d_un;
710} Elf32_Dyn;
711
712typedef struct {
713 Elf64_Sxword d_tag;
714 union {
715 Elf64_Xword d_val;
716 Elf64_Addr d_ptr;
717 } d_un;
718} Elf64_Dyn;
719
720
721
722#define DT_NULL 0
723#define DT_NEEDED 1
724#define DT_PLTRELSZ 2
725#define DT_PLTGOT 3
726#define DT_HASH 4
727#define DT_STRTAB 5
728#define DT_SYMTAB 6
729#define DT_RELA 7
730#define DT_RELASZ 8
731#define DT_RELAENT 9
732#define DT_STRSZ 10
733#define DT_SYMENT 11
734#define DT_INIT 12
735#define DT_FINI 13
736#define DT_SONAME 14
737#define DT_RPATH 15
738#define DT_SYMBOLIC 16
739#define DT_REL 17
740#define DT_RELSZ 18
741#define DT_RELENT 19
742#define DT_PLTREL 20
743#define DT_DEBUG 21
744#define DT_TEXTREL 22
745#define DT_JMPREL 23
746#define DT_BIND_NOW 24
747#define DT_INIT_ARRAY 25
748#define DT_FINI_ARRAY 26
749#define DT_INIT_ARRAYSZ 27
750#define DT_FINI_ARRAYSZ 28
751#define DT_RUNPATH 29
752#define DT_FLAGS 30
753#define DT_ENCODING 32
754#define DT_PREINIT_ARRAY 32
755#define DT_PREINIT_ARRAYSZ 33
756#define DT_SYMTAB_SHNDX 34
757#define DT_NUM 35
758#define DT_LOOS 0x6000000d
759#define DT_HIOS 0x6ffff000
760#define DT_LOPROC 0x70000000
761#define DT_HIPROC 0x7fffffff
762#define DT_PROCNUM DT_MIPS_NUM
763
764#define DT_VALRNGLO 0x6ffffd00
765#define DT_GNU_PRELINKED 0x6ffffdf5
766#define DT_GNU_CONFLICTSZ 0x6ffffdf6
767#define DT_GNU_LIBLISTSZ 0x6ffffdf7
768#define DT_CHECKSUM 0x6ffffdf8
769#define DT_PLTPADSZ 0x6ffffdf9
770#define DT_MOVEENT 0x6ffffdfa
771#define DT_MOVESZ 0x6ffffdfb
772#define DT_FEATURE_1 0x6ffffdfc
773#define DT_POSFLAG_1 0x6ffffdfd
774
775#define DT_SYMINSZ 0x6ffffdfe
776#define DT_SYMINENT 0x6ffffdff
777#define DT_VALRNGHI 0x6ffffdff
778#define DT_VALTAGIDX(tag) (DT_VALRNGHI - (tag))
779#define DT_VALNUM 12
780
781#define DT_ADDRRNGLO 0x6ffffe00
782#define DT_GNU_HASH 0x6ffffef5
783#define DT_TLSDESC_PLT 0x6ffffef6
784#define DT_TLSDESC_GOT 0x6ffffef7
785#define DT_GNU_CONFLICT 0x6ffffef8
786#define DT_GNU_LIBLIST 0x6ffffef9
787#define DT_CONFIG 0x6ffffefa
788#define DT_DEPAUDIT 0x6ffffefb
789#define DT_AUDIT 0x6ffffefc
790#define DT_PLTPAD 0x6ffffefd
791#define DT_MOVETAB 0x6ffffefe
792#define DT_SYMINFO 0x6ffffeff
793#define DT_ADDRRNGHI 0x6ffffeff
794#define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag))
795#define DT_ADDRNUM 11
796
797
798
799#define DT_VERSYM 0x6ffffff0
800
801#define DT_RELACOUNT 0x6ffffff9
802#define DT_RELCOUNT 0x6ffffffa
803
804
805#define DT_FLAGS_1 0x6ffffffb
806#define DT_VERDEF 0x6ffffffc
807
808#define DT_VERDEFNUM 0x6ffffffd
809#define DT_VERNEED 0x6ffffffe
810
811#define DT_VERNEEDNUM 0x6fffffff
812#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag))
813#define DT_VERSIONTAGNUM 16
814
815
816
817#define DT_AUXILIARY 0x7ffffffd
818#define DT_FILTER 0x7fffffff
819#define DT_EXTRATAGIDX(tag) ((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1)
820#define DT_EXTRANUM 3
821
822
823#define DF_ORIGIN 0x00000001
824#define DF_SYMBOLIC 0x00000002
825#define DF_TEXTREL 0x00000004
826#define DF_BIND_NOW 0x00000008
827#define DF_STATIC_TLS 0x00000010
828
829
830
831#define DF_1_NOW 0x00000001
832#define DF_1_GLOBAL 0x00000002
833#define DF_1_GROUP 0x00000004
834#define DF_1_NODELETE 0x00000008
835#define DF_1_LOADFLTR 0x00000010
836#define DF_1_INITFIRST 0x00000020
837#define DF_1_NOOPEN 0x00000040
838#define DF_1_ORIGIN 0x00000080
839#define DF_1_DIRECT 0x00000100
840#define DF_1_TRANS 0x00000200
841#define DF_1_INTERPOSE 0x00000400
842#define DF_1_NODEFLIB 0x00000800
843#define DF_1_NODUMP 0x00001000
844#define DF_1_CONFALT 0x00002000
845#define DF_1_ENDFILTEE 0x00004000
846#define DF_1_DISPRELDNE 0x00008000
847#define DF_1_DISPRELPND 0x00010000
848#define DF_1_NODIRECT 0x00020000
849#define DF_1_IGNMULDEF 0x00040000
850#define DF_1_NOKSYMS 0x00080000
851#define DF_1_NOHDR 0x00100000
852#define DF_1_EDITED 0x00200000
853#define DF_1_NORELOC 0x00400000
854#define DF_1_SYMINTPOSE 0x00800000
855#define DF_1_GLOBAUDIT 0x01000000
856#define DF_1_SINGLETON 0x02000000
857#define DF_1_STUB 0x04000000
858#define DF_1_PIE 0x08000000
859
860#define DTF_1_PARINIT 0x00000001
861#define DTF_1_CONFEXP 0x00000002
862
863
864#define DF_P1_LAZYLOAD 0x00000001
865#define DF_P1_GROUPPERM 0x00000002
866
867
868
869
870typedef struct {
871 Elf32_Half vd_version;
872 Elf32_Half vd_flags;
873 Elf32_Half vd_ndx;
874 Elf32_Half vd_cnt;
875 Elf32_Word vd_hash;
876 Elf32_Word vd_aux;
877 Elf32_Word vd_next;
878} Elf32_Verdef;
879
880typedef struct {
881 Elf64_Half vd_version;
882 Elf64_Half vd_flags;
883 Elf64_Half vd_ndx;
884 Elf64_Half vd_cnt;
885 Elf64_Word vd_hash;
886 Elf64_Word vd_aux;
887 Elf64_Word vd_next;
888} Elf64_Verdef;
889
890
891
892#define VER_DEF_NONE 0
893#define VER_DEF_CURRENT 1
894#define VER_DEF_NUM 2
895
896
897#define VER_FLG_BASE 0x1
898#define VER_FLG_WEAK 0x2
899
900
901#define VER_NDX_LOCAL 0
902#define VER_NDX_GLOBAL 1
903#define VER_NDX_LORESERVE 0xff00
904#define VER_NDX_ELIMINATE 0xff01
905
906
907
908typedef struct {
909 Elf32_Word vda_name;
910 Elf32_Word vda_next;
911} Elf32_Verdaux;
912
913typedef struct {
914 Elf64_Word vda_name;
915 Elf64_Word vda_next;
916} Elf64_Verdaux;
917
918
919
920
921typedef struct {
922 Elf32_Half vn_version;
923 Elf32_Half vn_cnt;
924 Elf32_Word vn_file;
925 Elf32_Word vn_aux;
926 Elf32_Word vn_next;
927} Elf32_Verneed;
928
929typedef struct {
930 Elf64_Half vn_version;
931 Elf64_Half vn_cnt;
932 Elf64_Word vn_file;
933 Elf64_Word vn_aux;
934 Elf64_Word vn_next;
935} Elf64_Verneed;
936
937
938
939#define VER_NEED_NONE 0
940#define VER_NEED_CURRENT 1
941#define VER_NEED_NUM 2
942
943
944
945typedef struct {
946 Elf32_Word vna_hash;
947 Elf32_Half vna_flags;
948 Elf32_Half vna_other;
949 Elf32_Word vna_name;
950 Elf32_Word vna_next;
951} Elf32_Vernaux;
952
953typedef struct {
954 Elf64_Word vna_hash;
955 Elf64_Half vna_flags;
956 Elf64_Half vna_other;
957 Elf64_Word vna_name;
958 Elf64_Word vna_next;
959} Elf64_Vernaux;
960
961
962
963#define VER_FLG_WEAK 0x2
964
965
966
967typedef struct {
968 uint32_t a_type;
969 union {
970 uint32_t a_val;
971 } a_un;
972} Elf32_auxv_t;
973
974typedef struct {
975 uint64_t a_type;
976 union {
977 uint64_t a_val;
978 } a_un;
979} Elf64_auxv_t;
980
981
982
983#define AT_NULL 0
984#define AT_IGNORE 1
985#define AT_EXECFD 2
986#define AT_PHDR 3
987#define AT_PHENT 4
988#define AT_PHNUM 5
989#define AT_PAGESZ 6
990#define AT_BASE 7
991#define AT_FLAGS 8
992#define AT_ENTRY 9
993#define AT_NOTELF 10
994#define AT_UID 11
995#define AT_EUID 12
996#define AT_GID 13
997#define AT_EGID 14
998#define AT_CLKTCK 17
999
1000
1001#define AT_PLATFORM 15
1002#define AT_HWCAP 16
1003
1004
1005
1006
1007#define AT_FPUCW 18
1008
1009
1010#define AT_DCACHEBSIZE 19
1011#define AT_ICACHEBSIZE 20
1012#define AT_UCACHEBSIZE 21
1013
1014
1015
1016#define AT_IGNOREPPC 22
1017
1018#define AT_SECURE 23
1019
1020#define AT_BASE_PLATFORM 24
1021
1022#define AT_RANDOM 25
1023
1024#define AT_HWCAP2 26
1025
1026#define AT_EXECFN 31
1027
1028
1029
1030#define AT_SYSINFO 32
1031#define AT_SYSINFO_EHDR 33
1032
1033
1034
1035#define AT_L1I_CACHESHAPE 34
1036#define AT_L1D_CACHESHAPE 35
1037#define AT_L2_CACHESHAPE 36
1038#define AT_L3_CACHESHAPE 37
1039
1040#define AT_L1I_CACHESIZE 40
1041#define AT_L1I_CACHEGEOMETRY 41
1042#define AT_L1D_CACHESIZE 42
1043#define AT_L1D_CACHEGEOMETRY 43
1044#define AT_L2_CACHESIZE 44
1045#define AT_L2_CACHEGEOMETRY 45
1046#define AT_L3_CACHESIZE 46
1047#define AT_L3_CACHEGEOMETRY 47
1048
1049#define AT_MINSIGSTKSZ 51
1050
1051
1052typedef struct {
1053 Elf32_Word n_namesz;
1054 Elf32_Word n_descsz;
1055 Elf32_Word n_type;
1056} Elf32_Nhdr;
1057
1058typedef struct {
1059 Elf64_Word n_namesz;
1060 Elf64_Word n_descsz;
1061 Elf64_Word n_type;
1062} Elf64_Nhdr;
1063
1064
1065
1066
1067#define ELF_NOTE_SOLARIS "SUNW Solaris"
1068
1069
1070#define ELF_NOTE_GNU "GNU"
1071
1072
1073
1074
1075
1076#define ELF_NOTE_PAGESIZE_HINT 1
1077
1078
1079#define NT_GNU_ABI_TAG 1
1080#define ELF_NOTE_ABI NT_GNU_ABI_TAG
1081
1082
1083
1084#define ELF_NOTE_OS_LINUX 0
1085#define ELF_NOTE_OS_GNU 1
1086#define ELF_NOTE_OS_SOLARIS2 2
1087#define ELF_NOTE_OS_FREEBSD 3
1088
1089#define NT_GNU_BUILD_ID 3
1090#define NT_GNU_GOLD_VERSION 4
1091#define NT_GNU_PROPERTY_TYPE_0 5
1092
1093
1094
1095typedef struct {
1096 Elf32_Xword m_value;
1097 Elf32_Word m_info;
1098 Elf32_Word m_poffset;
1099 Elf32_Half m_repeat;
1100 Elf32_Half m_stride;
1101} Elf32_Move;
1102
1103typedef struct {
1104 Elf64_Xword m_value;
1105 Elf64_Xword m_info;
1106 Elf64_Xword m_poffset;
1107 Elf64_Half m_repeat;
1108 Elf64_Half m_stride;
1109} Elf64_Move;
1110
1111
1112#define ELF32_M_SYM(info) ((info) >> 8)
1113#define ELF32_M_SIZE(info) ((unsigned char) (info))
1114#define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char) (size))
1115
1116#define ELF64_M_SYM(info) ELF32_M_SYM (info)
1117#define ELF64_M_SIZE(info) ELF32_M_SIZE (info)
1118#define ELF64_M_INFO(sym, size) ELF32_M_INFO (sym, size)
1119
1120#define EF_CPU32 0x00810000
1121
1122#define R_68K_NONE 0
1123#define R_68K_32 1
1124#define R_68K_16 2
1125#define R_68K_8 3
1126#define R_68K_PC32 4
1127#define R_68K_PC16 5
1128#define R_68K_PC8 6
1129#define R_68K_GOT32 7
1130#define R_68K_GOT16 8
1131#define R_68K_GOT8 9
1132#define R_68K_GOT32O 10
1133#define R_68K_GOT16O 11
1134#define R_68K_GOT8O 12
1135#define R_68K_PLT32 13
1136#define R_68K_PLT16 14
1137#define R_68K_PLT8 15
1138#define R_68K_PLT32O 16
1139#define R_68K_PLT16O 17
1140#define R_68K_PLT8O 18
1141#define R_68K_COPY 19
1142#define R_68K_GLOB_DAT 20
1143#define R_68K_JMP_SLOT 21
1144#define R_68K_RELATIVE 22
1145#define R_68K_TLS_GD32 25
1146#define R_68K_TLS_GD16 26
1147#define R_68K_TLS_GD8 27
1148#define R_68K_TLS_LDM32 28
1149#define R_68K_TLS_LDM16 29
1150#define R_68K_TLS_LDM8 30
1151#define R_68K_TLS_LDO32 31
1152#define R_68K_TLS_LDO16 32
1153#define R_68K_TLS_LDO8 33
1154#define R_68K_TLS_IE32 34
1155#define R_68K_TLS_IE16 35
1156#define R_68K_TLS_IE8 36
1157#define R_68K_TLS_LE32 37
1158#define R_68K_TLS_LE16 38
1159#define R_68K_TLS_LE8 39
1160#define R_68K_TLS_DTPMOD32 40
1161#define R_68K_TLS_DTPREL32 41
1162#define R_68K_TLS_TPREL32 42
1163#define R_68K_NUM 43
1164
1165#define R_386_NONE 0
1166#define R_386_32 1
1167#define R_386_PC32 2
1168#define R_386_GOT32 3
1169#define R_386_PLT32 4
1170#define R_386_COPY 5
1171#define R_386_GLOB_DAT 6
1172#define R_386_JMP_SLOT 7
1173#define R_386_RELATIVE 8
1174#define R_386_GOTOFF 9
1175#define R_386_GOTPC 10
1176#define R_386_32PLT 11
1177#define R_386_TLS_TPOFF 14
1178#define R_386_TLS_IE 15
1179#define R_386_TLS_GOTIE 16
1180#define R_386_TLS_LE 17
1181#define R_386_TLS_GD 18
1182#define R_386_TLS_LDM 19
1183#define R_386_16 20
1184#define R_386_PC16 21
1185#define R_386_8 22
1186#define R_386_PC8 23
1187#define R_386_TLS_GD_32 24
1188#define R_386_TLS_GD_PUSH 25
1189#define R_386_TLS_GD_CALL 26
1190#define R_386_TLS_GD_POP 27
1191#define R_386_TLS_LDM_32 28
1192#define R_386_TLS_LDM_PUSH 29
1193#define R_386_TLS_LDM_CALL 30
1194#define R_386_TLS_LDM_POP 31
1195#define R_386_TLS_LDO_32 32
1196#define R_386_TLS_IE_32 33
1197#define R_386_TLS_LE_32 34
1198#define R_386_TLS_DTPMOD32 35
1199#define R_386_TLS_DTPOFF32 36
1200#define R_386_TLS_TPOFF32 37
1201#define R_386_SIZE32 38
1202#define R_386_TLS_GOTDESC 39
1203#define R_386_TLS_DESC_CALL 40
1204#define R_386_TLS_DESC 41
1205#define R_386_IRELATIVE 42
1206#define R_386_GOT32X 43
1207#define R_386_NUM 44
1208
1209
1210
1211
1212
1213#define STT_SPARC_REGISTER 13
1214
1215
1216
1217#define EF_SPARCV9_MM 3
1218#define EF_SPARCV9_TSO 0
1219#define EF_SPARCV9_PSO 1
1220#define EF_SPARCV9_RMO 2
1221#define EF_SPARC_LEDATA 0x800000
1222#define EF_SPARC_EXT_MASK 0xFFFF00
1223#define EF_SPARC_32PLUS 0x000100
1224#define EF_SPARC_SUN_US1 0x000200
1225#define EF_SPARC_HAL_R1 0x000400
1226#define EF_SPARC_SUN_US3 0x000800
1227
1228
1229
1230#define R_SPARC_NONE 0
1231#define R_SPARC_8 1
1232#define R_SPARC_16 2
1233#define R_SPARC_32 3
1234#define R_SPARC_DISP8 4
1235#define R_SPARC_DISP16 5
1236#define R_SPARC_DISP32 6
1237#define R_SPARC_WDISP30 7
1238#define R_SPARC_WDISP22 8
1239#define R_SPARC_HI22 9
1240#define R_SPARC_22 10
1241#define R_SPARC_13 11
1242#define R_SPARC_LO10 12
1243#define R_SPARC_GOT10 13
1244#define R_SPARC_GOT13 14
1245#define R_SPARC_GOT22 15
1246#define R_SPARC_PC10 16
1247#define R_SPARC_PC22 17
1248#define R_SPARC_WPLT30 18
1249#define R_SPARC_COPY 19
1250#define R_SPARC_GLOB_DAT 20
1251#define R_SPARC_JMP_SLOT 21
1252#define R_SPARC_RELATIVE 22
1253#define R_SPARC_UA32 23
1254
1255
1256
1257#define R_SPARC_PLT32 24
1258#define R_SPARC_HIPLT22 25
1259#define R_SPARC_LOPLT10 26
1260#define R_SPARC_PCPLT32 27
1261#define R_SPARC_PCPLT22 28
1262#define R_SPARC_PCPLT10 29
1263#define R_SPARC_10 30
1264#define R_SPARC_11 31
1265#define R_SPARC_64 32
1266#define R_SPARC_OLO10 33
1267#define R_SPARC_HH22 34
1268#define R_SPARC_HM10 35
1269#define R_SPARC_LM22 36
1270#define R_SPARC_PC_HH22 37
1271#define R_SPARC_PC_HM10 38
1272#define R_SPARC_PC_LM22 39
1273#define R_SPARC_WDISP16 40
1274#define R_SPARC_WDISP19 41
1275#define R_SPARC_GLOB_JMP 42
1276#define R_SPARC_7 43
1277#define R_SPARC_5 44
1278#define R_SPARC_6 45
1279#define R_SPARC_DISP64 46
1280#define R_SPARC_PLT64 47
1281#define R_SPARC_HIX22 48
1282#define R_SPARC_LOX10 49
1283#define R_SPARC_H44 50
1284#define R_SPARC_M44 51
1285#define R_SPARC_L44 52
1286#define R_SPARC_REGISTER 53
1287#define R_SPARC_UA64 54
1288#define R_SPARC_UA16 55
1289#define R_SPARC_TLS_GD_HI22 56
1290#define R_SPARC_TLS_GD_LO10 57
1291#define R_SPARC_TLS_GD_ADD 58
1292#define R_SPARC_TLS_GD_CALL 59
1293#define R_SPARC_TLS_LDM_HI22 60
1294#define R_SPARC_TLS_LDM_LO10 61
1295#define R_SPARC_TLS_LDM_ADD 62
1296#define R_SPARC_TLS_LDM_CALL 63
1297#define R_SPARC_TLS_LDO_HIX22 64
1298#define R_SPARC_TLS_LDO_LOX10 65
1299#define R_SPARC_TLS_LDO_ADD 66
1300#define R_SPARC_TLS_IE_HI22 67
1301#define R_SPARC_TLS_IE_LO10 68
1302#define R_SPARC_TLS_IE_LD 69
1303#define R_SPARC_TLS_IE_LDX 70
1304#define R_SPARC_TLS_IE_ADD 71
1305#define R_SPARC_TLS_LE_HIX22 72
1306#define R_SPARC_TLS_LE_LOX10 73
1307#define R_SPARC_TLS_DTPMOD32 74
1308#define R_SPARC_TLS_DTPMOD64 75
1309#define R_SPARC_TLS_DTPOFF32 76
1310#define R_SPARC_TLS_DTPOFF64 77
1311#define R_SPARC_TLS_TPOFF32 78
1312#define R_SPARC_TLS_TPOFF64 79
1313#define R_SPARC_GOTDATA_HIX22 80
1314#define R_SPARC_GOTDATA_LOX10 81
1315#define R_SPARC_GOTDATA_OP_HIX22 82
1316#define R_SPARC_GOTDATA_OP_LOX10 83
1317#define R_SPARC_GOTDATA_OP 84
1318#define R_SPARC_H34 85
1319#define R_SPARC_SIZE32 86
1320#define R_SPARC_SIZE64 87
1321#define R_SPARC_GNU_VTINHERIT 250
1322#define R_SPARC_GNU_VTENTRY 251
1323#define R_SPARC_REV32 252
1324
1325#define R_SPARC_NUM 253
1326
1327
1328
1329#define DT_SPARC_REGISTER 0x70000001
1330#define DT_SPARC_NUM 2
1331
1332
1333#define EF_MIPS_NOREORDER 1
1334#define EF_MIPS_PIC 2
1335#define EF_MIPS_CPIC 4
1336#define EF_MIPS_XGOT 8
1337#define EF_MIPS_64BIT_WHIRL 16
1338#define EF_MIPS_ABI2 32
1339#define EF_MIPS_ABI_ON32 64
1340#define EF_MIPS_FP64 512
1341#define EF_MIPS_NAN2008 1024
1342#define EF_MIPS_ARCH 0xf0000000
1343
1344
1345
1346#define EF_MIPS_ARCH_1 0x00000000
1347#define EF_MIPS_ARCH_2 0x10000000
1348#define EF_MIPS_ARCH_3 0x20000000
1349#define EF_MIPS_ARCH_4 0x30000000
1350#define EF_MIPS_ARCH_5 0x40000000
1351#define EF_MIPS_ARCH_32 0x50000000
1352#define EF_MIPS_ARCH_64 0x60000000
1353#define EF_MIPS_ARCH_32R2 0x70000000
1354#define EF_MIPS_ARCH_64R2 0x80000000
1355
1356
1357#define E_MIPS_ARCH_1 0x00000000
1358#define E_MIPS_ARCH_2 0x10000000
1359#define E_MIPS_ARCH_3 0x20000000
1360#define E_MIPS_ARCH_4 0x30000000
1361#define E_MIPS_ARCH_5 0x40000000
1362#define E_MIPS_ARCH_32 0x50000000
1363#define E_MIPS_ARCH_64 0x60000000
1364
1365
1366
1367#define SHN_MIPS_ACOMMON 0xff00
1368#define SHN_MIPS_TEXT 0xff01
1369#define SHN_MIPS_DATA 0xff02
1370#define SHN_MIPS_SCOMMON 0xff03
1371#define SHN_MIPS_SUNDEFINED 0xff04
1372
1373
1374
1375#define SHT_MIPS_LIBLIST 0x70000000
1376#define SHT_MIPS_MSYM 0x70000001
1377#define SHT_MIPS_CONFLICT 0x70000002
1378#define SHT_MIPS_GPTAB 0x70000003
1379#define SHT_MIPS_UCODE 0x70000004
1380#define SHT_MIPS_DEBUG 0x70000005
1381#define SHT_MIPS_REGINFO 0x70000006
1382#define SHT_MIPS_PACKAGE 0x70000007
1383#define SHT_MIPS_PACKSYM 0x70000008
1384#define SHT_MIPS_RELD 0x70000009
1385#define SHT_MIPS_IFACE 0x7000000b
1386#define SHT_MIPS_CONTENT 0x7000000c
1387#define SHT_MIPS_OPTIONS 0x7000000d
1388#define SHT_MIPS_SHDR 0x70000010
1389#define SHT_MIPS_FDESC 0x70000011
1390#define SHT_MIPS_EXTSYM 0x70000012
1391#define SHT_MIPS_DENSE 0x70000013
1392#define SHT_MIPS_PDESC 0x70000014
1393#define SHT_MIPS_LOCSYM 0x70000015
1394#define SHT_MIPS_AUXSYM 0x70000016
1395#define SHT_MIPS_OPTSYM 0x70000017
1396#define SHT_MIPS_LOCSTR 0x70000018
1397#define SHT_MIPS_LINE 0x70000019
1398#define SHT_MIPS_RFDESC 0x7000001a
1399#define SHT_MIPS_DELTASYM 0x7000001b
1400#define SHT_MIPS_DELTAINST 0x7000001c
1401#define SHT_MIPS_DELTACLASS 0x7000001d
1402#define SHT_MIPS_DWARF 0x7000001e
1403#define SHT_MIPS_DELTADECL 0x7000001f
1404#define SHT_MIPS_SYMBOL_LIB 0x70000020
1405#define SHT_MIPS_EVENTS 0x70000021
1406#define SHT_MIPS_TRANSLATE 0x70000022
1407#define SHT_MIPS_PIXIE 0x70000023
1408#define SHT_MIPS_XLATE 0x70000024
1409#define SHT_MIPS_XLATE_DEBUG 0x70000025
1410#define SHT_MIPS_WHIRL 0x70000026
1411#define SHT_MIPS_EH_REGION 0x70000027
1412#define SHT_MIPS_XLATE_OLD 0x70000028
1413#define SHT_MIPS_PDR_EXCEPTION 0x70000029
1414
1415
1416
1417#define SHF_MIPS_GPREL 0x10000000
1418#define SHF_MIPS_MERGE 0x20000000
1419#define SHF_MIPS_ADDR 0x40000000
1420#define SHF_MIPS_STRINGS 0x80000000
1421#define SHF_MIPS_NOSTRIP 0x08000000
1422#define SHF_MIPS_LOCAL 0x04000000
1423#define SHF_MIPS_NAMES 0x02000000
1424#define SHF_MIPS_NODUPE 0x01000000
1425
1426
1427
1428
1429
1430#define STO_MIPS_DEFAULT 0x0
1431#define STO_MIPS_INTERNAL 0x1
1432#define STO_MIPS_HIDDEN 0x2
1433#define STO_MIPS_PROTECTED 0x3
1434#define STO_MIPS_PLT 0x8
1435#define STO_MIPS_SC_ALIGN_UNUSED 0xff
1436
1437
1438#define STB_MIPS_SPLIT_COMMON 13
1439
1440
1441
1442typedef union {
1443 struct {
1444 Elf32_Word gt_current_g_value;
1445 Elf32_Word gt_unused;
1446 } gt_header;
1447 struct {
1448 Elf32_Word gt_g_value;
1449 Elf32_Word gt_bytes;
1450 } gt_entry;
1451} Elf32_gptab;
1452
1453
1454
1455typedef struct {
1456 Elf32_Word ri_gprmask;
1457 Elf32_Word ri_cprmask[4];
1458 Elf32_Sword ri_gp_value;
1459} Elf32_RegInfo;
1460
1461
1462
1463typedef struct {
1464 unsigned char kind;
1465
1466 unsigned char size;
1467 Elf32_Section section;
1468
1469 Elf32_Word info;
1470} Elf_Options;
1471
1472
1473
1474#define ODK_NULL 0
1475#define ODK_REGINFO 1
1476#define ODK_EXCEPTIONS 2
1477#define ODK_PAD 3
1478#define ODK_HWPATCH 4
1479#define ODK_FILL 5
1480#define ODK_TAGS 6
1481#define ODK_HWAND 7
1482#define ODK_HWOR 8
1483
1484
1485
1486#define OEX_FPU_MIN 0x1f
1487#define OEX_FPU_MAX 0x1f00
1488#define OEX_PAGE0 0x10000
1489#define OEX_SMM 0x20000
1490#define OEX_FPDBUG 0x40000
1491#define OEX_PRECISEFP OEX_FPDBUG
1492#define OEX_DISMISS 0x80000
1493
1494#define OEX_FPU_INVAL 0x10
1495#define OEX_FPU_DIV0 0x08
1496#define OEX_FPU_OFLO 0x04
1497#define OEX_FPU_UFLO 0x02
1498#define OEX_FPU_INEX 0x01
1499
1500
1501
1502#define OHW_R4KEOP 0x1
1503#define OHW_R8KPFETCH 0x2
1504#define OHW_R5KEOP 0x4
1505#define OHW_R5KCVTL 0x8
1506
1507#define OPAD_PREFIX 0x1
1508#define OPAD_POSTFIX 0x2
1509#define OPAD_SYMBOL 0x4
1510
1511
1512
1513typedef struct {
1514 Elf32_Word hwp_flags1;
1515 Elf32_Word hwp_flags2;
1516} Elf_Options_Hw;
1517
1518
1519
1520#define OHWA0_R4KEOP_CHECKED 0x00000001
1521#define OHWA1_R4KEOP_CLEAN 0x00000002
1522
1523
1524
1525#define R_MIPS_NONE 0
1526#define R_MIPS_16 1
1527#define R_MIPS_32 2
1528#define R_MIPS_REL32 3
1529#define R_MIPS_26 4
1530#define R_MIPS_HI16 5
1531#define R_MIPS_LO16 6
1532#define R_MIPS_GPREL16 7
1533#define R_MIPS_LITERAL 8
1534#define R_MIPS_GOT16 9
1535#define R_MIPS_PC16 10
1536#define R_MIPS_CALL16 11
1537#define R_MIPS_GPREL32 12
1538
1539#define R_MIPS_SHIFT5 16
1540#define R_MIPS_SHIFT6 17
1541#define R_MIPS_64 18
1542#define R_MIPS_GOT_DISP 19
1543#define R_MIPS_GOT_PAGE 20
1544#define R_MIPS_GOT_OFST 21
1545#define R_MIPS_GOT_HI16 22
1546#define R_MIPS_GOT_LO16 23
1547#define R_MIPS_SUB 24
1548#define R_MIPS_INSERT_A 25
1549#define R_MIPS_INSERT_B 26
1550#define R_MIPS_DELETE 27
1551#define R_MIPS_HIGHER 28
1552#define R_MIPS_HIGHEST 29
1553#define R_MIPS_CALL_HI16 30
1554#define R_MIPS_CALL_LO16 31
1555#define R_MIPS_SCN_DISP 32
1556#define R_MIPS_REL16 33
1557#define R_MIPS_ADD_IMMEDIATE 34
1558#define R_MIPS_PJUMP 35
1559#define R_MIPS_RELGOT 36
1560#define R_MIPS_JALR 37
1561#define R_MIPS_TLS_DTPMOD32 38
1562#define R_MIPS_TLS_DTPREL32 39
1563#define R_MIPS_TLS_DTPMOD64 40
1564#define R_MIPS_TLS_DTPREL64 41
1565#define R_MIPS_TLS_GD 42
1566#define R_MIPS_TLS_LDM 43
1567#define R_MIPS_TLS_DTPREL_HI16 44
1568#define R_MIPS_TLS_DTPREL_LO16 45
1569#define R_MIPS_TLS_GOTTPREL 46
1570#define R_MIPS_TLS_TPREL32 47
1571#define R_MIPS_TLS_TPREL64 48
1572#define R_MIPS_TLS_TPREL_HI16 49
1573#define R_MIPS_TLS_TPREL_LO16 50
1574#define R_MIPS_GLOB_DAT 51
1575#define R_MIPS_COPY 126
1576#define R_MIPS_JUMP_SLOT 127
1577
1578#define R_MIPS_NUM 128
1579
1580
1581
1582#define PT_MIPS_REGINFO 0x70000000
1583#define PT_MIPS_RTPROC 0x70000001
1584#define PT_MIPS_OPTIONS 0x70000002
1585#define PT_MIPS_ABIFLAGS 0x70000003
1586
1587
1588
1589#define PF_MIPS_LOCAL 0x10000000
1590
1591
1592
1593#define DT_MIPS_RLD_VERSION 0x70000001
1594#define DT_MIPS_TIME_STAMP 0x70000002
1595#define DT_MIPS_ICHECKSUM 0x70000003
1596#define DT_MIPS_IVERSION 0x70000004
1597#define DT_MIPS_FLAGS 0x70000005
1598#define DT_MIPS_BASE_ADDRESS 0x70000006
1599#define DT_MIPS_MSYM 0x70000007
1600#define DT_MIPS_CONFLICT 0x70000008
1601#define DT_MIPS_LIBLIST 0x70000009
1602#define DT_MIPS_LOCAL_GOTNO 0x7000000a
1603#define DT_MIPS_CONFLICTNO 0x7000000b
1604#define DT_MIPS_LIBLISTNO 0x70000010
1605#define DT_MIPS_SYMTABNO 0x70000011
1606#define DT_MIPS_UNREFEXTNO 0x70000012
1607#define DT_MIPS_GOTSYM 0x70000013
1608#define DT_MIPS_HIPAGENO 0x70000014
1609#define DT_MIPS_RLD_MAP 0x70000016
1610#define DT_MIPS_DELTA_CLASS 0x70000017
1611#define DT_MIPS_DELTA_CLASS_NO 0x70000018
1612
1613#define DT_MIPS_DELTA_INSTANCE 0x70000019
1614#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a
1615
1616#define DT_MIPS_DELTA_RELOC 0x7000001b
1617#define DT_MIPS_DELTA_RELOC_NO 0x7000001c
1618
1619#define DT_MIPS_DELTA_SYM 0x7000001d
1620
1621#define DT_MIPS_DELTA_SYM_NO 0x7000001e
1622
1623#define DT_MIPS_DELTA_CLASSSYM 0x70000020
1624
1625#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021
1626
1627#define DT_MIPS_CXX_FLAGS 0x70000022
1628#define DT_MIPS_PIXIE_INIT 0x70000023
1629#define DT_MIPS_SYMBOL_LIB 0x70000024
1630#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025
1631#define DT_MIPS_LOCAL_GOTIDX 0x70000026
1632#define DT_MIPS_HIDDEN_GOTIDX 0x70000027
1633#define DT_MIPS_PROTECTED_GOTIDX 0x70000028
1634#define DT_MIPS_OPTIONS 0x70000029
1635#define DT_MIPS_INTERFACE 0x7000002a
1636#define DT_MIPS_DYNSTR_ALIGN 0x7000002b
1637#define DT_MIPS_INTERFACE_SIZE 0x7000002c
1638#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d
1639
1640#define DT_MIPS_PERF_SUFFIX 0x7000002e
1641
1642#define DT_MIPS_COMPACT_SIZE 0x7000002f
1643#define DT_MIPS_GP_VALUE 0x70000030
1644#define DT_MIPS_AUX_DYNAMIC 0x70000031
1645
1646#define DT_MIPS_PLTGOT 0x70000032
1647
1648#define DT_MIPS_RWPLT 0x70000034
1649#define DT_MIPS_RLD_MAP_REL 0x70000035
1650#define DT_MIPS_NUM 0x36
1651
1652
1653
1654#define RHF_NONE 0
1655#define RHF_QUICKSTART (1 << 0)
1656#define RHF_NOTPOT (1 << 1)
1657#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2)
1658#define RHF_NO_MOVE (1 << 3)
1659#define RHF_SGI_ONLY (1 << 4)
1660#define RHF_GUARANTEE_INIT (1 << 5)
1661#define RHF_DELTA_C_PLUS_PLUS (1 << 6)
1662#define RHF_GUARANTEE_START_INIT (1 << 7)
1663#define RHF_PIXIE (1 << 8)
1664#define RHF_DEFAULT_DELAY_LOAD (1 << 9)
1665#define RHF_REQUICKSTART (1 << 10)
1666#define RHF_REQUICKSTARTED (1 << 11)
1667#define RHF_CORD (1 << 12)
1668#define RHF_NO_UNRES_UNDEF (1 << 13)
1669#define RHF_RLD_ORDER_SAFE (1 << 14)
1670
1671
1672
1673typedef struct {
1674 Elf32_Word l_name;
1675 Elf32_Word l_time_stamp;
1676 Elf32_Word l_checksum;
1677 Elf32_Word l_version;
1678 Elf32_Word l_flags;
1679} Elf32_Lib;
1680
1681typedef struct {
1682 Elf64_Word l_name;
1683 Elf64_Word l_time_stamp;
1684 Elf64_Word l_checksum;
1685 Elf64_Word l_version;
1686 Elf64_Word l_flags;
1687} Elf64_Lib;
1688
1689
1690
1691
1692#define LL_NONE 0
1693#define LL_EXACT_MATCH (1 << 0)
1694#define LL_IGNORE_INT_VER (1 << 1)
1695#define LL_REQUIRE_MINOR (1 << 2)
1696#define LL_EXPORTS (1 << 3)
1697#define LL_DELAY_LOAD (1 << 4)
1698#define LL_DELTA (1 << 5)
1699
1700
1701
1702typedef Elf32_Addr Elf32_Conflict;
1703
1704typedef struct {
1705 Elf32_Half version;
1706 unsigned char isa_level;
1707 unsigned char isa_rev;
1708 unsigned char gpr_size;
1709 unsigned char cpr1_size;
1710 unsigned char cpr2_size;
1711 unsigned char fp_abi;
1712 Elf32_Word isa_ext;
1713 Elf32_Word ases;
1714 Elf32_Word flags1;
1715 Elf32_Word flags2;
1716} Elf_MIPS_ABIFlags_v0;
1717
1718#define MIPS_AFL_REG_NONE 0x00
1719#define MIPS_AFL_REG_32 0x01
1720#define MIPS_AFL_REG_64 0x02
1721#define MIPS_AFL_REG_128 0x03
1722
1723#define MIPS_AFL_ASE_DSP 0x00000001
1724#define MIPS_AFL_ASE_DSPR2 0x00000002
1725#define MIPS_AFL_ASE_EVA 0x00000004
1726#define MIPS_AFL_ASE_MCU 0x00000008
1727#define MIPS_AFL_ASE_MDMX 0x00000010
1728#define MIPS_AFL_ASE_MIPS3D 0x00000020
1729#define MIPS_AFL_ASE_MT 0x00000040
1730#define MIPS_AFL_ASE_SMARTMIPS 0x00000080
1731#define MIPS_AFL_ASE_VIRT 0x00000100
1732#define MIPS_AFL_ASE_MSA 0x00000200
1733#define MIPS_AFL_ASE_MIPS16 0x00000400
1734#define MIPS_AFL_ASE_MICROMIPS 0x00000800
1735#define MIPS_AFL_ASE_XPA 0x00001000
1736#define MIPS_AFL_ASE_MASK 0x00001fff
1737
1738#define MIPS_AFL_EXT_XLR 1
1739#define MIPS_AFL_EXT_OCTEON2 2
1740#define MIPS_AFL_EXT_OCTEONP 3
1741#define MIPS_AFL_EXT_LOONGSON_3A 4
1742#define MIPS_AFL_EXT_OCTEON 5
1743#define MIPS_AFL_EXT_5900 6
1744#define MIPS_AFL_EXT_4650 7
1745#define MIPS_AFL_EXT_4010 8
1746#define MIPS_AFL_EXT_4100 9
1747#define MIPS_AFL_EXT_3900 10
1748#define MIPS_AFL_EXT_10000 11
1749#define MIPS_AFL_EXT_SB1 12
1750#define MIPS_AFL_EXT_4111 13
1751#define MIPS_AFL_EXT_4120 14
1752#define MIPS_AFL_EXT_5400 15
1753#define MIPS_AFL_EXT_5500 16
1754#define MIPS_AFL_EXT_LOONGSON_2E 17
1755#define MIPS_AFL_EXT_LOONGSON_2F 18
1756
1757#define MIPS_AFL_FLAGS1_ODDSPREG 1
1758
1759enum
1760{
1761 Val_GNU_MIPS_ABI_FP_ANY = 0,
1762 Val_GNU_MIPS_ABI_FP_DOUBLE = 1,
1763 Val_GNU_MIPS_ABI_FP_SINGLE = 2,
1764 Val_GNU_MIPS_ABI_FP_SOFT = 3,
1765 Val_GNU_MIPS_ABI_FP_OLD_64 = 4,
1766 Val_GNU_MIPS_ABI_FP_XX = 5,
1767 Val_GNU_MIPS_ABI_FP_64 = 6,
1768 Val_GNU_MIPS_ABI_FP_64A = 7,
1769 Val_GNU_MIPS_ABI_FP_MAX = 7
1770};
1771
1772
1773
1774
1775#define EF_PARISC_TRAPNIL 0x00010000
1776#define EF_PARISC_EXT 0x00020000
1777#define EF_PARISC_LSB 0x00040000
1778#define EF_PARISC_WIDE 0x00080000
1779#define EF_PARISC_NO_KABP 0x00100000
1780
1781#define EF_PARISC_LAZYSWAP 0x00400000
1782#define EF_PARISC_ARCH 0x0000ffff
1783
1784
1785
1786#define EFA_PARISC_1_0 0x020b
1787#define EFA_PARISC_1_1 0x0210
1788#define EFA_PARISC_2_0 0x0214
1789
1790
1791
1792#define SHN_PARISC_ANSI_COMMON 0xff00
1793
1794#define SHN_PARISC_HUGE_COMMON 0xff01
1795
1796
1797
1798#define SHT_PARISC_EXT 0x70000000
1799#define SHT_PARISC_UNWIND 0x70000001
1800#define SHT_PARISC_DOC 0x70000002
1801
1802
1803
1804#define SHF_PARISC_SHORT 0x20000000
1805#define SHF_PARISC_HUGE 0x40000000
1806#define SHF_PARISC_SBP 0x80000000
1807
1808
1809
1810#define STT_PARISC_MILLICODE 13
1811
1812#define STT_HP_OPAQUE (STT_LOOS + 0x1)
1813#define STT_HP_STUB (STT_LOOS + 0x2)
1814
1815
1816
1817#define R_PARISC_NONE 0
1818#define R_PARISC_DIR32 1
1819#define R_PARISC_DIR21L 2
1820#define R_PARISC_DIR17R 3
1821#define R_PARISC_DIR17F 4
1822#define R_PARISC_DIR14R 6
1823#define R_PARISC_PCREL32 9
1824#define R_PARISC_PCREL21L 10
1825#define R_PARISC_PCREL17R 11
1826#define R_PARISC_PCREL17F 12
1827#define R_PARISC_PCREL14R 14
1828#define R_PARISC_DPREL21L 18
1829#define R_PARISC_DPREL14R 22
1830#define R_PARISC_GPREL21L 26
1831#define R_PARISC_GPREL14R 30
1832#define R_PARISC_LTOFF21L 34
1833#define R_PARISC_LTOFF14R 38
1834#define R_PARISC_SECREL32 41
1835#define R_PARISC_SEGBASE 48
1836#define R_PARISC_SEGREL32 49
1837#define R_PARISC_PLTOFF21L 50
1838#define R_PARISC_PLTOFF14R 54
1839#define R_PARISC_LTOFF_FPTR32 57
1840#define R_PARISC_LTOFF_FPTR21L 58
1841#define R_PARISC_LTOFF_FPTR14R 62
1842#define R_PARISC_FPTR64 64
1843#define R_PARISC_PLABEL32 65
1844#define R_PARISC_PLABEL21L 66
1845#define R_PARISC_PLABEL14R 70
1846#define R_PARISC_PCREL64 72
1847#define R_PARISC_PCREL22F 74
1848#define R_PARISC_PCREL14WR 75
1849#define R_PARISC_PCREL14DR 76
1850#define R_PARISC_PCREL16F 77
1851#define R_PARISC_PCREL16WF 78
1852#define R_PARISC_PCREL16DF 79
1853#define R_PARISC_DIR64 80
1854#define R_PARISC_DIR14WR 83
1855#define R_PARISC_DIR14DR 84
1856#define R_PARISC_DIR16F 85
1857#define R_PARISC_DIR16WF 86
1858#define R_PARISC_DIR16DF 87
1859#define R_PARISC_GPREL64 88
1860#define R_PARISC_GPREL14WR 91
1861#define R_PARISC_GPREL14DR 92
1862#define R_PARISC_GPREL16F 93
1863#define R_PARISC_GPREL16WF 94
1864#define R_PARISC_GPREL16DF 95
1865#define R_PARISC_LTOFF64 96
1866#define R_PARISC_LTOFF14WR 99
1867#define R_PARISC_LTOFF14DR 100
1868#define R_PARISC_LTOFF16F 101
1869#define R_PARISC_LTOFF16WF 102
1870#define R_PARISC_LTOFF16DF 103
1871#define R_PARISC_SECREL64 104
1872#define R_PARISC_SEGREL64 112
1873#define R_PARISC_PLTOFF14WR 115
1874#define R_PARISC_PLTOFF14DR 116
1875#define R_PARISC_PLTOFF16F 117
1876#define R_PARISC_PLTOFF16WF 118
1877#define R_PARISC_PLTOFF16DF 119
1878#define R_PARISC_LTOFF_FPTR64 120
1879#define R_PARISC_LTOFF_FPTR14WR 123
1880#define R_PARISC_LTOFF_FPTR14DR 124
1881#define R_PARISC_LTOFF_FPTR16F 125
1882#define R_PARISC_LTOFF_FPTR16WF 126
1883#define R_PARISC_LTOFF_FPTR16DF 127
1884#define R_PARISC_LORESERVE 128
1885#define R_PARISC_COPY 128
1886#define R_PARISC_IPLT 129
1887#define R_PARISC_EPLT 130
1888#define R_PARISC_TPREL32 153
1889#define R_PARISC_TPREL21L 154
1890#define R_PARISC_TPREL14R 158
1891#define R_PARISC_LTOFF_TP21L 162
1892#define R_PARISC_LTOFF_TP14R 166
1893#define R_PARISC_LTOFF_TP14F 167
1894#define R_PARISC_TPREL64 216
1895#define R_PARISC_TPREL14WR 219
1896#define R_PARISC_TPREL14DR 220
1897#define R_PARISC_TPREL16F 221
1898#define R_PARISC_TPREL16WF 222
1899#define R_PARISC_TPREL16DF 223
1900#define R_PARISC_LTOFF_TP64 224
1901#define R_PARISC_LTOFF_TP14WR 227
1902#define R_PARISC_LTOFF_TP14DR 228
1903#define R_PARISC_LTOFF_TP16F 229
1904#define R_PARISC_LTOFF_TP16WF 230
1905#define R_PARISC_LTOFF_TP16DF 231
1906#define R_PARISC_GNU_VTENTRY 232
1907#define R_PARISC_GNU_VTINHERIT 233
1908#define R_PARISC_TLS_GD21L 234
1909#define R_PARISC_TLS_GD14R 235
1910#define R_PARISC_TLS_GDCALL 236
1911#define R_PARISC_TLS_LDM21L 237
1912#define R_PARISC_TLS_LDM14R 238
1913#define R_PARISC_TLS_LDMCALL 239
1914#define R_PARISC_TLS_LDO21L 240
1915#define R_PARISC_TLS_LDO14R 241
1916#define R_PARISC_TLS_DTPMOD32 242
1917#define R_PARISC_TLS_DTPMOD64 243
1918#define R_PARISC_TLS_DTPOFF32 244
1919#define R_PARISC_TLS_DTPOFF64 245
1920#define R_PARISC_TLS_LE21L R_PARISC_TPREL21L
1921#define R_PARISC_TLS_LE14R R_PARISC_TPREL14R
1922#define R_PARISC_TLS_IE21L R_PARISC_LTOFF_TP21L
1923#define R_PARISC_TLS_IE14R R_PARISC_LTOFF_TP14R
1924#define R_PARISC_TLS_TPREL32 R_PARISC_TPREL32
1925#define R_PARISC_TLS_TPREL64 R_PARISC_TPREL64
1926#define R_PARISC_HIRESERVE 255
1927
1928
1929
1930#define PT_HP_TLS (PT_LOOS + 0x0)
1931#define PT_HP_CORE_NONE (PT_LOOS + 0x1)
1932#define PT_HP_CORE_VERSION (PT_LOOS + 0x2)
1933#define PT_HP_CORE_KERNEL (PT_LOOS + 0x3)
1934#define PT_HP_CORE_COMM (PT_LOOS + 0x4)
1935#define PT_HP_CORE_PROC (PT_LOOS + 0x5)
1936#define PT_HP_CORE_LOADABLE (PT_LOOS + 0x6)
1937#define PT_HP_CORE_STACK (PT_LOOS + 0x7)
1938#define PT_HP_CORE_SHM (PT_LOOS + 0x8)
1939#define PT_HP_CORE_MMF (PT_LOOS + 0x9)
1940#define PT_HP_PARALLEL (PT_LOOS + 0x10)
1941#define PT_HP_FASTBIND (PT_LOOS + 0x11)
1942#define PT_HP_OPT_ANNOT (PT_LOOS + 0x12)
1943#define PT_HP_HSL_ANNOT (PT_LOOS + 0x13)
1944#define PT_HP_STACK (PT_LOOS + 0x14)
1945
1946#define PT_PARISC_ARCHEXT 0x70000000
1947#define PT_PARISC_UNWIND 0x70000001
1948
1949
1950
1951#define PF_PARISC_SBP 0x08000000
1952
1953#define PF_HP_PAGE_SIZE 0x00100000
1954#define PF_HP_FAR_SHARED 0x00200000
1955#define PF_HP_NEAR_SHARED 0x00400000
1956#define PF_HP_CODE 0x01000000
1957#define PF_HP_MODIFY 0x02000000
1958#define PF_HP_LAZYSWAP 0x04000000
1959#define PF_HP_SBP 0x08000000
1960
1961
1962
1963
1964
1965
1966#define EF_ALPHA_32BIT 1
1967#define EF_ALPHA_CANRELAX 2
1968
1969
1970
1971
1972#define SHT_ALPHA_DEBUG 0x70000001
1973#define SHT_ALPHA_REGINFO 0x70000002
1974
1975
1976
1977#define SHF_ALPHA_GPREL 0x10000000
1978
1979
1980#define STO_ALPHA_NOPV 0x80
1981#define STO_ALPHA_STD_GPLOAD 0x88
1982
1983
1984
1985#define R_ALPHA_NONE 0
1986#define R_ALPHA_REFLONG 1
1987#define R_ALPHA_REFQUAD 2
1988#define R_ALPHA_GPREL32 3
1989#define R_ALPHA_LITERAL 4
1990#define R_ALPHA_LITUSE 5
1991#define R_ALPHA_GPDISP 6
1992#define R_ALPHA_BRADDR 7
1993#define R_ALPHA_HINT 8
1994#define R_ALPHA_SREL16 9
1995#define R_ALPHA_SREL32 10
1996#define R_ALPHA_SREL64 11
1997#define R_ALPHA_GPRELHIGH 17
1998#define R_ALPHA_GPRELLOW 18
1999#define R_ALPHA_GPREL16 19
2000#define R_ALPHA_COPY 24
2001#define R_ALPHA_GLOB_DAT 25
2002#define R_ALPHA_JMP_SLOT 26
2003#define R_ALPHA_RELATIVE 27
2004#define R_ALPHA_TLS_GD_HI 28
2005#define R_ALPHA_TLSGD 29
2006#define R_ALPHA_TLS_LDM 30
2007#define R_ALPHA_DTPMOD64 31
2008#define R_ALPHA_GOTDTPREL 32
2009#define R_ALPHA_DTPREL64 33
2010#define R_ALPHA_DTPRELHI 34
2011#define R_ALPHA_DTPRELLO 35
2012#define R_ALPHA_DTPREL16 36
2013#define R_ALPHA_GOTTPREL 37
2014#define R_ALPHA_TPREL64 38
2015#define R_ALPHA_TPRELHI 39
2016#define R_ALPHA_TPRELLO 40
2017#define R_ALPHA_TPREL16 41
2018
2019#define R_ALPHA_NUM 46
2020
2021
2022#define LITUSE_ALPHA_ADDR 0
2023#define LITUSE_ALPHA_BASE 1
2024#define LITUSE_ALPHA_BYTOFF 2
2025#define LITUSE_ALPHA_JSR 3
2026#define LITUSE_ALPHA_TLS_GD 4
2027#define LITUSE_ALPHA_TLS_LDM 5
2028
2029
2030#define DT_ALPHA_PLTRO (DT_LOPROC + 0)
2031#define DT_ALPHA_NUM 1
2032
2033
2034
2035
2036#define EF_PPC_EMB 0x80000000
2037
2038
2039#define EF_PPC_RELOCATABLE 0x00010000
2040#define EF_PPC_RELOCATABLE_LIB 0x00008000
2041
2042
2043
2044#define R_PPC_NONE 0
2045#define R_PPC_ADDR32 1
2046#define R_PPC_ADDR24 2
2047#define R_PPC_ADDR16 3
2048#define R_PPC_ADDR16_LO 4
2049#define R_PPC_ADDR16_HI 5
2050#define R_PPC_ADDR16_HA 6
2051#define R_PPC_ADDR14 7
2052#define R_PPC_ADDR14_BRTAKEN 8
2053#define R_PPC_ADDR14_BRNTAKEN 9
2054#define R_PPC_REL24 10
2055#define R_PPC_REL14 11
2056#define R_PPC_REL14_BRTAKEN 12
2057#define R_PPC_REL14_BRNTAKEN 13
2058#define R_PPC_GOT16 14
2059#define R_PPC_GOT16_LO 15
2060#define R_PPC_GOT16_HI 16
2061#define R_PPC_GOT16_HA 17
2062#define R_PPC_PLTREL24 18
2063#define R_PPC_COPY 19
2064#define R_PPC_GLOB_DAT 20
2065#define R_PPC_JMP_SLOT 21
2066#define R_PPC_RELATIVE 22
2067#define R_PPC_LOCAL24PC 23
2068#define R_PPC_UADDR32 24
2069#define R_PPC_UADDR16 25
2070#define R_PPC_REL32 26
2071#define R_PPC_PLT32 27
2072#define R_PPC_PLTREL32 28
2073#define R_PPC_PLT16_LO 29
2074#define R_PPC_PLT16_HI 30
2075#define R_PPC_PLT16_HA 31
2076#define R_PPC_SDAREL16 32
2077#define R_PPC_SECTOFF 33
2078#define R_PPC_SECTOFF_LO 34
2079#define R_PPC_SECTOFF_HI 35
2080#define R_PPC_SECTOFF_HA 36
2081
2082
2083#define R_PPC_TLS 67
2084#define R_PPC_DTPMOD32 68
2085#define R_PPC_TPREL16 69
2086#define R_PPC_TPREL16_LO 70
2087#define R_PPC_TPREL16_HI 71
2088#define R_PPC_TPREL16_HA 72
2089#define R_PPC_TPREL32 73
2090#define R_PPC_DTPREL16 74
2091#define R_PPC_DTPREL16_LO 75
2092#define R_PPC_DTPREL16_HI 76
2093#define R_PPC_DTPREL16_HA 77
2094#define R_PPC_DTPREL32 78
2095#define R_PPC_GOT_TLSGD16 79
2096#define R_PPC_GOT_TLSGD16_LO 80
2097#define R_PPC_GOT_TLSGD16_HI 81
2098#define R_PPC_GOT_TLSGD16_HA 82
2099#define R_PPC_GOT_TLSLD16 83
2100#define R_PPC_GOT_TLSLD16_LO 84
2101#define R_PPC_GOT_TLSLD16_HI 85
2102#define R_PPC_GOT_TLSLD16_HA 86
2103#define R_PPC_GOT_TPREL16 87
2104#define R_PPC_GOT_TPREL16_LO 88
2105#define R_PPC_GOT_TPREL16_HI 89
2106#define R_PPC_GOT_TPREL16_HA 90
2107#define R_PPC_GOT_DTPREL16 91
2108#define R_PPC_GOT_DTPREL16_LO 92
2109#define R_PPC_GOT_DTPREL16_HI 93
2110#define R_PPC_GOT_DTPREL16_HA 94
2111#define R_PPC_TLSGD 95
2112#define R_PPC_TLSLD 96
2113
2114
2115#define R_PPC_EMB_NADDR32 101
2116#define R_PPC_EMB_NADDR16 102
2117#define R_PPC_EMB_NADDR16_LO 103
2118#define R_PPC_EMB_NADDR16_HI 104
2119#define R_PPC_EMB_NADDR16_HA 105
2120#define R_PPC_EMB_SDAI16 106
2121#define R_PPC_EMB_SDA2I16 107
2122#define R_PPC_EMB_SDA2REL 108
2123#define R_PPC_EMB_SDA21 109
2124#define R_PPC_EMB_MRKREF 110
2125#define R_PPC_EMB_RELSEC16 111
2126#define R_PPC_EMB_RELST_LO 112
2127#define R_PPC_EMB_RELST_HI 113
2128#define R_PPC_EMB_RELST_HA 114
2129#define R_PPC_EMB_BIT_FLD 115
2130#define R_PPC_EMB_RELSDA 116
2131
2132
2133#define R_PPC_DIAB_SDA21_LO 180
2134#define R_PPC_DIAB_SDA21_HI 181
2135#define R_PPC_DIAB_SDA21_HA 182
2136#define R_PPC_DIAB_RELSDA_LO 183
2137#define R_PPC_DIAB_RELSDA_HI 184
2138#define R_PPC_DIAB_RELSDA_HA 185
2139
2140
2141#define R_PPC_IRELATIVE 248
2142
2143
2144#define R_PPC_REL16 249
2145#define R_PPC_REL16_LO 250
2146#define R_PPC_REL16_HI 251
2147#define R_PPC_REL16_HA 252
2148
2149
2150
2151#define R_PPC_TOC16 255
2152
2153
2154#define DT_PPC_GOT (DT_LOPROC + 0)
2155#define DT_PPC_OPT (DT_LOPROC + 1)
2156#define DT_PPC_NUM 2
2157
2158#define PPC_OPT_TLS 1
2159
2160
2161#define R_PPC64_NONE R_PPC_NONE
2162#define R_PPC64_ADDR32 R_PPC_ADDR32
2163#define R_PPC64_ADDR24 R_PPC_ADDR24
2164#define R_PPC64_ADDR16 R_PPC_ADDR16
2165#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO
2166#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI
2167#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA
2168#define R_PPC64_ADDR14 R_PPC_ADDR14
2169#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN
2170#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN
2171#define R_PPC64_REL24 R_PPC_REL24
2172#define R_PPC64_REL14 R_PPC_REL14
2173#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN
2174#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN
2175#define R_PPC64_GOT16 R_PPC_GOT16
2176#define R_PPC64_GOT16_LO R_PPC_GOT16_LO
2177#define R_PPC64_GOT16_HI R_PPC_GOT16_HI
2178#define R_PPC64_GOT16_HA R_PPC_GOT16_HA
2179
2180#define R_PPC64_COPY R_PPC_COPY
2181#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT
2182#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT
2183#define R_PPC64_RELATIVE R_PPC_RELATIVE
2184
2185#define R_PPC64_UADDR32 R_PPC_UADDR32
2186#define R_PPC64_UADDR16 R_PPC_UADDR16
2187#define R_PPC64_REL32 R_PPC_REL32
2188#define R_PPC64_PLT32 R_PPC_PLT32
2189#define R_PPC64_PLTREL32 R_PPC_PLTREL32
2190#define R_PPC64_PLT16_LO R_PPC_PLT16_LO
2191#define R_PPC64_PLT16_HI R_PPC_PLT16_HI
2192#define R_PPC64_PLT16_HA R_PPC_PLT16_HA
2193
2194#define R_PPC64_SECTOFF R_PPC_SECTOFF
2195#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO
2196#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI
2197#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA
2198#define R_PPC64_ADDR30 37
2199#define R_PPC64_ADDR64 38
2200#define R_PPC64_ADDR16_HIGHER 39
2201#define R_PPC64_ADDR16_HIGHERA 40
2202#define R_PPC64_ADDR16_HIGHEST 41
2203#define R_PPC64_ADDR16_HIGHESTA 42
2204#define R_PPC64_UADDR64 43
2205#define R_PPC64_REL64 44
2206#define R_PPC64_PLT64 45
2207#define R_PPC64_PLTREL64 46
2208#define R_PPC64_TOC16 47
2209#define R_PPC64_TOC16_LO 48
2210#define R_PPC64_TOC16_HI 49
2211#define R_PPC64_TOC16_HA 50
2212#define R_PPC64_TOC 51
2213#define R_PPC64_PLTGOT16 52
2214#define R_PPC64_PLTGOT16_LO 53
2215#define R_PPC64_PLTGOT16_HI 54
2216#define R_PPC64_PLTGOT16_HA 55
2217
2218#define R_PPC64_ADDR16_DS 56
2219#define R_PPC64_ADDR16_LO_DS 57
2220#define R_PPC64_GOT16_DS 58
2221#define R_PPC64_GOT16_LO_DS 59
2222#define R_PPC64_PLT16_LO_DS 60
2223#define R_PPC64_SECTOFF_DS 61
2224#define R_PPC64_SECTOFF_LO_DS 62
2225#define R_PPC64_TOC16_DS 63
2226#define R_PPC64_TOC16_LO_DS 64
2227#define R_PPC64_PLTGOT16_DS 65
2228#define R_PPC64_PLTGOT16_LO_DS 66
2229
2230
2231#define R_PPC64_TLS 67
2232#define R_PPC64_DTPMOD64 68
2233#define R_PPC64_TPREL16 69
2234#define R_PPC64_TPREL16_LO 70
2235#define R_PPC64_TPREL16_HI 71
2236#define R_PPC64_TPREL16_HA 72
2237#define R_PPC64_TPREL64 73
2238#define R_PPC64_DTPREL16 74
2239#define R_PPC64_DTPREL16_LO 75
2240#define R_PPC64_DTPREL16_HI 76
2241#define R_PPC64_DTPREL16_HA 77
2242#define R_PPC64_DTPREL64 78
2243#define R_PPC64_GOT_TLSGD16 79
2244#define R_PPC64_GOT_TLSGD16_LO 80
2245#define R_PPC64_GOT_TLSGD16_HI 81
2246#define R_PPC64_GOT_TLSGD16_HA 82
2247#define R_PPC64_GOT_TLSLD16 83
2248#define R_PPC64_GOT_TLSLD16_LO 84
2249#define R_PPC64_GOT_TLSLD16_HI 85
2250#define R_PPC64_GOT_TLSLD16_HA 86
2251#define R_PPC64_GOT_TPREL16_DS 87
2252#define R_PPC64_GOT_TPREL16_LO_DS 88
2253#define R_PPC64_GOT_TPREL16_HI 89
2254#define R_PPC64_GOT_TPREL16_HA 90
2255#define R_PPC64_GOT_DTPREL16_DS 91
2256#define R_PPC64_GOT_DTPREL16_LO_DS 92
2257#define R_PPC64_GOT_DTPREL16_HI 93
2258#define R_PPC64_GOT_DTPREL16_HA 94
2259#define R_PPC64_TPREL16_DS 95
2260#define R_PPC64_TPREL16_LO_DS 96
2261#define R_PPC64_TPREL16_HIGHER 97
2262#define R_PPC64_TPREL16_HIGHERA 98
2263#define R_PPC64_TPREL16_HIGHEST 99
2264#define R_PPC64_TPREL16_HIGHESTA 100
2265#define R_PPC64_DTPREL16_DS 101
2266#define R_PPC64_DTPREL16_LO_DS 102
2267#define R_PPC64_DTPREL16_HIGHER 103
2268#define R_PPC64_DTPREL16_HIGHERA 104
2269#define R_PPC64_DTPREL16_HIGHEST 105
2270#define R_PPC64_DTPREL16_HIGHESTA 106
2271#define R_PPC64_TLSGD 107
2272#define R_PPC64_TLSLD 108
2273#define R_PPC64_TOCSAVE 109
2274#define R_PPC64_ADDR16_HIGH 110
2275#define R_PPC64_ADDR16_HIGHA 111
2276#define R_PPC64_TPREL16_HIGH 112
2277#define R_PPC64_TPREL16_HIGHA 113
2278#define R_PPC64_DTPREL16_HIGH 114
2279#define R_PPC64_DTPREL16_HIGHA 115
2280
2281
2282#define R_PPC64_JMP_IREL 247
2283#define R_PPC64_IRELATIVE 248
2284#define R_PPC64_REL16 249
2285#define R_PPC64_REL16_LO 250
2286#define R_PPC64_REL16_HI 251
2287#define R_PPC64_REL16_HA 252
2288
2289#define EF_PPC64_ABI 3
2290
2291#define DT_PPC64_GLINK (DT_LOPROC + 0)
2292#define DT_PPC64_OPD (DT_LOPROC + 1)
2293#define DT_PPC64_OPDSZ (DT_LOPROC + 2)
2294#define DT_PPC64_OPT (DT_LOPROC + 3)
2295#define DT_PPC64_NUM 4
2296
2297#define PPC64_OPT_TLS 1
2298#define PPC64_OPT_MULTI_TOC 2
2299#define PPC64_OPT_LOCALENTRY 4
2300
2301#define STO_PPC64_LOCAL_BIT 5
2302#define STO_PPC64_LOCAL_MASK 0xe0
2303#define PPC64_LOCAL_ENTRY_OFFSET(x) (1 << (((x)&0xe0)>>5) & 0xfc)
2304
2305
2306#define EF_ARM_RELEXEC 0x01
2307#define EF_ARM_HASENTRY 0x02
2308#define EF_ARM_INTERWORK 0x04
2309#define EF_ARM_APCS_26 0x08
2310#define EF_ARM_APCS_FLOAT 0x10
2311#define EF_ARM_PIC 0x20
2312#define EF_ARM_ALIGN8 0x40
2313#define EF_ARM_NEW_ABI 0x80
2314#define EF_ARM_OLD_ABI 0x100
2315#define EF_ARM_SOFT_FLOAT 0x200
2316#define EF_ARM_VFP_FLOAT 0x400
2317#define EF_ARM_MAVERICK_FLOAT 0x800
2318
2319#define EF_ARM_ABI_FLOAT_SOFT 0x200
2320#define EF_ARM_ABI_FLOAT_HARD 0x400
2321
2322
2323#define EF_ARM_SYMSARESORTED 0x04
2324#define EF_ARM_DYNSYMSUSESEGIDX 0x08
2325#define EF_ARM_MAPSYMSFIRST 0x10
2326#define EF_ARM_EABIMASK 0XFF000000
2327
2328
2329#define EF_ARM_BE8 0x00800000
2330#define EF_ARM_LE8 0x00400000
2331
2332#define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK)
2333#define EF_ARM_EABI_UNKNOWN 0x00000000
2334#define EF_ARM_EABI_VER1 0x01000000
2335#define EF_ARM_EABI_VER2 0x02000000
2336#define EF_ARM_EABI_VER3 0x03000000
2337#define EF_ARM_EABI_VER4 0x04000000
2338#define EF_ARM_EABI_VER5 0x05000000
2339
2340
2341#define STT_ARM_TFUNC STT_LOPROC
2342#define STT_ARM_16BIT STT_HIPROC
2343
2344
2345#define SHF_ARM_ENTRYSECT 0x10000000
2346#define SHF_ARM_COMDEF 0x80000000
2347
2348
2349
2350#define PF_ARM_SB 0x10000000
2351
2352#define PF_ARM_PI 0x20000000
2353#define PF_ARM_ABS 0x40000000
2354
2355
2356#define PT_ARM_EXIDX (PT_LOPROC + 1)
2357
2358
2359#define SHT_ARM_EXIDX (SHT_LOPROC + 1)
2360#define SHT_ARM_PREEMPTMAP (SHT_LOPROC + 2)
2361#define SHT_ARM_ATTRIBUTES (SHT_LOPROC + 3)
2362
2363#define R_AARCH64_NONE 0
2364#define R_AARCH64_P32_ABS32 1
2365#define R_AARCH64_P32_COPY 180
2366#define R_AARCH64_P32_GLOB_DAT 181
2367#define R_AARCH64_P32_JUMP_SLOT 182
2368#define R_AARCH64_P32_RELATIVE 183
2369#define R_AARCH64_P32_TLS_DTPMOD 184
2370#define R_AARCH64_P32_TLS_DTPREL 185
2371#define R_AARCH64_P32_TLS_TPREL 186
2372#define R_AARCH64_P32_TLSDESC 187
2373#define R_AARCH64_P32_IRELATIVE 188
2374#define R_AARCH64_ABS64 257
2375#define R_AARCH64_ABS32 258
2376#define R_AARCH64_ABS16 259
2377#define R_AARCH64_PREL64 260
2378#define R_AARCH64_PREL32 261
2379#define R_AARCH64_PREL16 262
2380#define R_AARCH64_MOVW_UABS_G0 263
2381#define R_AARCH64_MOVW_UABS_G0_NC 264
2382#define R_AARCH64_MOVW_UABS_G1 265
2383#define R_AARCH64_MOVW_UABS_G1_NC 266
2384#define R_AARCH64_MOVW_UABS_G2 267
2385#define R_AARCH64_MOVW_UABS_G2_NC 268
2386#define R_AARCH64_MOVW_UABS_G3 269
2387#define R_AARCH64_MOVW_SABS_G0 270
2388#define R_AARCH64_MOVW_SABS_G1 271
2389#define R_AARCH64_MOVW_SABS_G2 272
2390#define R_AARCH64_LD_PREL_LO19 273
2391#define R_AARCH64_ADR_PREL_LO21 274
2392#define R_AARCH64_ADR_PREL_PG_HI21 275
2393#define R_AARCH64_ADR_PREL_PG_HI21_NC 276
2394#define R_AARCH64_ADD_ABS_LO12_NC 277
2395#define R_AARCH64_LDST8_ABS_LO12_NC 278
2396#define R_AARCH64_TSTBR14 279
2397#define R_AARCH64_CONDBR19 280
2398#define R_AARCH64_JUMP26 282
2399#define R_AARCH64_CALL26 283
2400#define R_AARCH64_LDST16_ABS_LO12_NC 284
2401#define R_AARCH64_LDST32_ABS_LO12_NC 285
2402#define R_AARCH64_LDST64_ABS_LO12_NC 286
2403#define R_AARCH64_MOVW_PREL_G0 287
2404#define R_AARCH64_MOVW_PREL_G0_NC 288
2405#define R_AARCH64_MOVW_PREL_G1 289
2406#define R_AARCH64_MOVW_PREL_G1_NC 290
2407#define R_AARCH64_MOVW_PREL_G2 291
2408#define R_AARCH64_MOVW_PREL_G2_NC 292
2409#define R_AARCH64_MOVW_PREL_G3 293
2410#define R_AARCH64_LDST128_ABS_LO12_NC 299
2411#define R_AARCH64_MOVW_GOTOFF_G0 300
2412#define R_AARCH64_MOVW_GOTOFF_G0_NC 301
2413#define R_AARCH64_MOVW_GOTOFF_G1 302
2414#define R_AARCH64_MOVW_GOTOFF_G1_NC 303
2415#define R_AARCH64_MOVW_GOTOFF_G2 304
2416#define R_AARCH64_MOVW_GOTOFF_G2_NC 305
2417#define R_AARCH64_MOVW_GOTOFF_G3 306
2418#define R_AARCH64_GOTREL64 307
2419#define R_AARCH64_GOTREL32 308
2420#define R_AARCH64_GOT_LD_PREL19 309
2421#define R_AARCH64_LD64_GOTOFF_LO15 310
2422#define R_AARCH64_ADR_GOT_PAGE 311
2423#define R_AARCH64_LD64_GOT_LO12_NC 312
2424#define R_AARCH64_LD64_GOTPAGE_LO15 313
2425#define R_AARCH64_TLSGD_ADR_PREL21 512
2426#define R_AARCH64_TLSGD_ADR_PAGE21 513
2427#define R_AARCH64_TLSGD_ADD_LO12_NC 514
2428#define R_AARCH64_TLSGD_MOVW_G1 515
2429#define R_AARCH64_TLSGD_MOVW_G0_NC 516
2430#define R_AARCH64_TLSLD_ADR_PREL21 517
2431#define R_AARCH64_TLSLD_ADR_PAGE21 518
2432#define R_AARCH64_TLSLD_ADD_LO12_NC 519
2433#define R_AARCH64_TLSLD_MOVW_G1 520
2434#define R_AARCH64_TLSLD_MOVW_G0_NC 521
2435#define R_AARCH64_TLSLD_LD_PREL19 522
2436#define R_AARCH64_TLSLD_MOVW_DTPREL_G2 523
2437#define R_AARCH64_TLSLD_MOVW_DTPREL_G1 524
2438#define R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC 525
2439#define R_AARCH64_TLSLD_MOVW_DTPREL_G0 526
2440#define R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC 527
2441#define R_AARCH64_TLSLD_ADD_DTPREL_HI12 528
2442#define R_AARCH64_TLSLD_ADD_DTPREL_LO12 529
2443#define R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC 530
2444#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12 531
2445#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC 532
2446#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12 533
2447#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC 534
2448#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12 535
2449#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC 536
2450#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12 537
2451#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC 538
2452#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 539
2453#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC 540
2454#define R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 541
2455#define R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC 542
2456#define R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 543
2457#define R_AARCH64_TLSLE_MOVW_TPREL_G2 544
2458#define R_AARCH64_TLSLE_MOVW_TPREL_G1 545
2459#define R_AARCH64_TLSLE_MOVW_TPREL_G1_NC 546
2460#define R_AARCH64_TLSLE_MOVW_TPREL_G0 547
2461#define R_AARCH64_TLSLE_MOVW_TPREL_G0_NC 548
2462#define R_AARCH64_TLSLE_ADD_TPREL_HI12 549
2463#define R_AARCH64_TLSLE_ADD_TPREL_LO12 550
2464#define R_AARCH64_TLSLE_ADD_TPREL_LO12_NC 551
2465#define R_AARCH64_TLSLE_LDST8_TPREL_LO12 552
2466#define R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC 553
2467#define R_AARCH64_TLSLE_LDST16_TPREL_LO12 554
2468#define R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC 555
2469#define R_AARCH64_TLSLE_LDST32_TPREL_LO12 556
2470#define R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC 557
2471#define R_AARCH64_TLSLE_LDST64_TPREL_LO12 558
2472#define R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC 559
2473#define R_AARCH64_TLSDESC_LD_PREL19 560
2474#define R_AARCH64_TLSDESC_ADR_PREL21 561
2475#define R_AARCH64_TLSDESC_ADR_PAGE21 562
2476#define R_AARCH64_TLSDESC_LD64_LO12 563
2477#define R_AARCH64_TLSDESC_ADD_LO12 564
2478#define R_AARCH64_TLSDESC_OFF_G1 565
2479#define R_AARCH64_TLSDESC_OFF_G0_NC 566
2480#define R_AARCH64_TLSDESC_LDR 567
2481#define R_AARCH64_TLSDESC_ADD 568
2482#define R_AARCH64_TLSDESC_CALL 569
2483#define R_AARCH64_TLSLE_LDST128_TPREL_LO12 570
2484#define R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC 571
2485#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12 572
2486#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC 573
2487#define R_AARCH64_COPY 1024
2488#define R_AARCH64_GLOB_DAT 1025
2489#define R_AARCH64_JUMP_SLOT 1026
2490#define R_AARCH64_RELATIVE 1027
2491#define R_AARCH64_TLS_DTPMOD 1028
2492#define R_AARCH64_TLS_DTPMOD64 1028
2493#define R_AARCH64_TLS_DTPREL 1029
2494#define R_AARCH64_TLS_DTPREL64 1029
2495#define R_AARCH64_TLS_TPREL 1030
2496#define R_AARCH64_TLS_TPREL64 1030
2497#define R_AARCH64_TLSDESC 1031
2498
2499
2500#define R_ARM_NONE 0
2501#define R_ARM_PC24 1
2502#define R_ARM_ABS32 2
2503#define R_ARM_REL32 3
2504#define R_ARM_PC13 4
2505#define R_ARM_ABS16 5
2506#define R_ARM_ABS12 6
2507#define R_ARM_THM_ABS5 7
2508#define R_ARM_ABS8 8
2509#define R_ARM_SBREL32 9
2510#define R_ARM_THM_PC22 10
2511#define R_ARM_THM_PC8 11
2512#define R_ARM_AMP_VCALL9 12
2513#define R_ARM_TLS_DESC 13
2514#define R_ARM_THM_SWI8 14
2515#define R_ARM_XPC25 15
2516#define R_ARM_THM_XPC22 16
2517#define R_ARM_TLS_DTPMOD32 17
2518#define R_ARM_TLS_DTPOFF32 18
2519#define R_ARM_TLS_TPOFF32 19
2520#define R_ARM_COPY 20
2521#define R_ARM_GLOB_DAT 21
2522#define R_ARM_JUMP_SLOT 22
2523#define R_ARM_RELATIVE 23
2524#define R_ARM_GOTOFF 24
2525#define R_ARM_GOTPC 25
2526#define R_ARM_GOT32 26
2527#define R_ARM_PLT32 27
2528#define R_ARM_CALL 28
2529#define R_ARM_JUMP24 29
2530#define R_ARM_THM_JUMP24 30
2531#define R_ARM_BASE_ABS 31
2532#define R_ARM_ALU_PCREL_7_0 32
2533#define R_ARM_ALU_PCREL_15_8 33
2534#define R_ARM_ALU_PCREL_23_15 34
2535#define R_ARM_LDR_SBREL_11_0 35
2536#define R_ARM_ALU_SBREL_19_12 36
2537#define R_ARM_ALU_SBREL_27_20 37
2538#define R_ARM_TARGET1 38
2539#define R_ARM_SBREL31 39
2540#define R_ARM_V4BX 40
2541#define R_ARM_TARGET2 41
2542#define R_ARM_PREL31 42
2543#define R_ARM_MOVW_ABS_NC 43
2544#define R_ARM_MOVT_ABS 44
2545#define R_ARM_MOVW_PREL_NC 45
2546#define R_ARM_MOVT_PREL 46
2547#define R_ARM_THM_MOVW_ABS_NC 47
2548#define R_ARM_THM_MOVT_ABS 48
2549#define R_ARM_THM_MOVW_PREL_NC 49
2550#define R_ARM_THM_MOVT_PREL 50
2551#define R_ARM_THM_JUMP19 51
2552#define R_ARM_THM_JUMP6 52
2553#define R_ARM_THM_ALU_PREL_11_0 53
2554#define R_ARM_THM_PC12 54
2555#define R_ARM_ABS32_NOI 55
2556#define R_ARM_REL32_NOI 56
2557#define R_ARM_ALU_PC_G0_NC 57
2558#define R_ARM_ALU_PC_G0 58
2559#define R_ARM_ALU_PC_G1_NC 59
2560#define R_ARM_ALU_PC_G1 60
2561#define R_ARM_ALU_PC_G2 61
2562#define R_ARM_LDR_PC_G1 62
2563#define R_ARM_LDR_PC_G2 63
2564#define R_ARM_LDRS_PC_G0 64
2565#define R_ARM_LDRS_PC_G1 65
2566#define R_ARM_LDRS_PC_G2 66
2567#define R_ARM_LDC_PC_G0 67
2568#define R_ARM_LDC_PC_G1 68
2569#define R_ARM_LDC_PC_G2 69
2570#define R_ARM_ALU_SB_G0_NC 70
2571#define R_ARM_ALU_SB_G0 71
2572#define R_ARM_ALU_SB_G1_NC 72
2573#define R_ARM_ALU_SB_G1 73
2574#define R_ARM_ALU_SB_G2 74
2575#define R_ARM_LDR_SB_G0 75
2576#define R_ARM_LDR_SB_G1 76
2577#define R_ARM_LDR_SB_G2 77
2578#define R_ARM_LDRS_SB_G0 78
2579#define R_ARM_LDRS_SB_G1 79
2580#define R_ARM_LDRS_SB_G2 80
2581#define R_ARM_LDC_SB_G0 81
2582#define R_ARM_LDC_SB_G1 82
2583#define R_ARM_LDC_SB_G2 83
2584#define R_ARM_MOVW_BREL_NC 84
2585#define R_ARM_MOVT_BREL 85
2586#define R_ARM_MOVW_BREL 86
2587#define R_ARM_THM_MOVW_BREL_NC 87
2588#define R_ARM_THM_MOVT_BREL 88
2589#define R_ARM_THM_MOVW_BREL 89
2590#define R_ARM_TLS_GOTDESC 90
2591#define R_ARM_TLS_CALL 91
2592#define R_ARM_TLS_DESCSEQ 92
2593#define R_ARM_THM_TLS_CALL 93
2594#define R_ARM_PLT32_ABS 94
2595#define R_ARM_GOT_ABS 95
2596#define R_ARM_GOT_PREL 96
2597#define R_ARM_GOT_BREL12 97
2598#define R_ARM_GOTOFF12 98
2599#define R_ARM_GOTRELAX 99
2600#define R_ARM_GNU_VTENTRY 100
2601#define R_ARM_GNU_VTINHERIT 101
2602#define R_ARM_THM_PC11 102
2603#define R_ARM_THM_PC9 103
2604#define R_ARM_TLS_GD32 104
2605
2606#define R_ARM_TLS_LDM32 105
2607
2608#define R_ARM_TLS_LDO32 106
2609
2610#define R_ARM_TLS_IE32 107
2611
2612#define R_ARM_TLS_LE32 108
2613#define R_ARM_TLS_LDO12 109
2614#define R_ARM_TLS_LE12 110
2615#define R_ARM_TLS_IE12GP 111
2616#define R_ARM_ME_TOO 128
2617#define R_ARM_THM_TLS_DESCSEQ 129
2618#define R_ARM_THM_TLS_DESCSEQ16 129
2619#define R_ARM_THM_TLS_DESCSEQ32 130
2620#define R_ARM_THM_GOT_BREL12 131
2621#define R_ARM_IRELATIVE 160
2622#define R_ARM_RXPC25 249
2623#define R_ARM_RSBREL32 250
2624#define R_ARM_THM_RPC22 251
2625#define R_ARM_RREL32 252
2626#define R_ARM_RABS22 253
2627#define R_ARM_RPC24 254
2628#define R_ARM_RBASE 255
2629
2630#define R_ARM_NUM 256
2631
2632
2633#define R_CKCORE_NONE 0
2634#define R_CKCORE_ADDR32 1
2635#define R_CKCORE_PCRELIMM8BY4 2
2636#define R_CKCORE_PCRELIMM11BY2 3
2637#define R_CKCORE_PCREL32 5
2638#define R_CKCORE_PCRELJSR_IMM11BY2 6
2639#define R_CKCORE_RELATIVE 9
2640#define R_CKCORE_COPY 10
2641#define R_CKCORE_GLOB_DAT 11
2642#define R_CKCORE_JUMP_SLOT 12
2643#define R_CKCORE_GOTOFF 13
2644#define R_CKCORE_GOTPC 14
2645#define R_CKCORE_GOT32 15
2646#define R_CKCORE_PLT32 16
2647#define R_CKCORE_ADDRGOT 17
2648#define R_CKCORE_ADDRPLT 18
2649#define R_CKCORE_PCREL_IMM26BY2 19
2650#define R_CKCORE_PCREL_IMM16BY2 20
2651#define R_CKCORE_PCREL_IMM16BY4 21
2652#define R_CKCORE_PCREL_IMM10BY2 22
2653#define R_CKCORE_PCREL_IMM10BY4 23
2654#define R_CKCORE_ADDR_HI16 24
2655#define R_CKCORE_ADDR_LO16 25
2656#define R_CKCORE_GOTPC_HI16 26
2657#define R_CKCORE_GOTPC_LO16 27
2658#define R_CKCORE_GOTOFF_HI16 28
2659#define R_CKCORE_GOTOFF_LO16 29
2660#define R_CKCORE_GOT12 30
2661#define R_CKCORE_GOT_HI16 31
2662#define R_CKCORE_GOT_LO16 32
2663#define R_CKCORE_PLT12 33
2664#define R_CKCORE_PLT_HI16 34
2665#define R_CKCORE_PLT_LO16 35
2666#define R_CKCORE_ADDRGOT_HI16 36
2667#define R_CKCORE_ADDRGOT_LO16 37
2668#define R_CKCORE_ADDRPLT_HI16 38
2669#define R_CKCORE_ADDRPLT_LO16 39
2670#define R_CKCORE_PCREL_JSR_IMM26BY2 40
2671#define R_CKCORE_TOFFSET_LO16 41
2672#define R_CKCORE_DOFFSET_LO16 42
2673#define R_CKCORE_PCREL_IMM18BY2 43
2674#define R_CKCORE_DOFFSET_IMM18 44
2675#define R_CKCORE_DOFFSET_IMM18BY2 45
2676#define R_CKCORE_DOFFSET_IMM18BY4 46
2677#define R_CKCORE_GOT_IMM18BY4 48
2678#define R_CKCORE_PLT_IMM18BY4 49
2679#define R_CKCORE_PCREL_IMM7BY4 50
2680#define R_CKCORE_TLS_LE32 51
2681#define R_CKCORE_TLS_IE32 52
2682#define R_CKCORE_TLS_GD32 53
2683#define R_CKCORE_TLS_LDM32 54
2684#define R_CKCORE_TLS_LDO32 55
2685#define R_CKCORE_TLS_DTPMOD32 56
2686#define R_CKCORE_TLS_DTPOFF32 57
2687#define R_CKCORE_TLS_TPOFF32 58
2688
2689
2690#define EF_IA_64_MASKOS 0x0000000f
2691#define EF_IA_64_ABI64 0x00000010
2692#define EF_IA_64_ARCH 0xff000000
2693
2694
2695#define PT_IA_64_ARCHEXT (PT_LOPROC + 0)
2696#define PT_IA_64_UNWIND (PT_LOPROC + 1)
2697#define PT_IA_64_HP_OPT_ANOT (PT_LOOS + 0x12)
2698#define PT_IA_64_HP_HSL_ANOT (PT_LOOS + 0x13)
2699#define PT_IA_64_HP_STACK (PT_LOOS + 0x14)
2700
2701
2702#define PF_IA_64_NORECOV 0x80000000
2703
2704
2705#define SHT_IA_64_EXT (SHT_LOPROC + 0)
2706#define SHT_IA_64_UNWIND (SHT_LOPROC + 1)
2707
2708
2709#define SHF_IA_64_SHORT 0x10000000
2710#define SHF_IA_64_NORECOV 0x20000000
2711
2712
2713#define DT_IA_64_PLT_RESERVE (DT_LOPROC + 0)
2714#define DT_IA_64_NUM 1
2715
2716
2717#define R_IA64_NONE 0x00
2718#define R_IA64_IMM14 0x21
2719#define R_IA64_IMM22 0x22
2720#define R_IA64_IMM64 0x23
2721#define R_IA64_DIR32MSB 0x24
2722#define R_IA64_DIR32LSB 0x25
2723#define R_IA64_DIR64MSB 0x26
2724#define R_IA64_DIR64LSB 0x27
2725#define R_IA64_GPREL22 0x2a
2726#define R_IA64_GPREL64I 0x2b
2727#define R_IA64_GPREL32MSB 0x2c
2728#define R_IA64_GPREL32LSB 0x2d
2729#define R_IA64_GPREL64MSB 0x2e
2730#define R_IA64_GPREL64LSB 0x2f
2731#define R_IA64_LTOFF22 0x32
2732#define R_IA64_LTOFF64I 0x33
2733#define R_IA64_PLTOFF22 0x3a
2734#define R_IA64_PLTOFF64I 0x3b
2735#define R_IA64_PLTOFF64MSB 0x3e
2736#define R_IA64_PLTOFF64LSB 0x3f
2737#define R_IA64_FPTR64I 0x43
2738#define R_IA64_FPTR32MSB 0x44
2739#define R_IA64_FPTR32LSB 0x45
2740#define R_IA64_FPTR64MSB 0x46
2741#define R_IA64_FPTR64LSB 0x47
2742#define R_IA64_PCREL60B 0x48
2743#define R_IA64_PCREL21B 0x49
2744#define R_IA64_PCREL21M 0x4a
2745#define R_IA64_PCREL21F 0x4b
2746#define R_IA64_PCREL32MSB 0x4c
2747#define R_IA64_PCREL32LSB 0x4d
2748#define R_IA64_PCREL64MSB 0x4e
2749#define R_IA64_PCREL64LSB 0x4f
2750#define R_IA64_LTOFF_FPTR22 0x52
2751#define R_IA64_LTOFF_FPTR64I 0x53
2752#define R_IA64_LTOFF_FPTR32MSB 0x54
2753#define R_IA64_LTOFF_FPTR32LSB 0x55
2754#define R_IA64_LTOFF_FPTR64MSB 0x56
2755#define R_IA64_LTOFF_FPTR64LSB 0x57
2756#define R_IA64_SEGREL32MSB 0x5c
2757#define R_IA64_SEGREL32LSB 0x5d
2758#define R_IA64_SEGREL64MSB 0x5e
2759#define R_IA64_SEGREL64LSB 0x5f
2760#define R_IA64_SECREL32MSB 0x64
2761#define R_IA64_SECREL32LSB 0x65
2762#define R_IA64_SECREL64MSB 0x66
2763#define R_IA64_SECREL64LSB 0x67
2764#define R_IA64_REL32MSB 0x6c
2765#define R_IA64_REL32LSB 0x6d
2766#define R_IA64_REL64MSB 0x6e
2767#define R_IA64_REL64LSB 0x6f
2768#define R_IA64_LTV32MSB 0x74
2769#define R_IA64_LTV32LSB 0x75
2770#define R_IA64_LTV64MSB 0x76
2771#define R_IA64_LTV64LSB 0x77
2772#define R_IA64_PCREL21BI 0x79
2773#define R_IA64_PCREL22 0x7a
2774#define R_IA64_PCREL64I 0x7b
2775#define R_IA64_IPLTMSB 0x80
2776#define R_IA64_IPLTLSB 0x81
2777#define R_IA64_COPY 0x84
2778#define R_IA64_SUB 0x85
2779#define R_IA64_LTOFF22X 0x86
2780#define R_IA64_LDXMOV 0x87
2781#define R_IA64_TPREL14 0x91
2782#define R_IA64_TPREL22 0x92
2783#define R_IA64_TPREL64I 0x93
2784#define R_IA64_TPREL64MSB 0x96
2785#define R_IA64_TPREL64LSB 0x97
2786#define R_IA64_LTOFF_TPREL22 0x9a
2787#define R_IA64_DTPMOD64MSB 0xa6
2788#define R_IA64_DTPMOD64LSB 0xa7
2789#define R_IA64_LTOFF_DTPMOD22 0xaa
2790#define R_IA64_DTPREL14 0xb1
2791#define R_IA64_DTPREL22 0xb2
2792#define R_IA64_DTPREL64I 0xb3
2793#define R_IA64_DTPREL32MSB 0xb4
2794#define R_IA64_DTPREL32LSB 0xb5
2795#define R_IA64_DTPREL64MSB 0xb6
2796#define R_IA64_DTPREL64LSB 0xb7
2797#define R_IA64_LTOFF_DTPREL22 0xba
2798
2799
2800#define EF_SH_MACH_MASK 0x1f
2801#define EF_SH_UNKNOWN 0x0
2802#define EF_SH1 0x1
2803#define EF_SH2 0x2
2804#define EF_SH3 0x3
2805#define EF_SH_DSP 0x4
2806#define EF_SH3_DSP 0x5
2807#define EF_SH4AL_DSP 0x6
2808#define EF_SH3E 0x8
2809#define EF_SH4 0x9
2810#define EF_SH2E 0xb
2811#define EF_SH4A 0xc
2812#define EF_SH2A 0xd
2813#define EF_SH4_NOFPU 0x10
2814#define EF_SH4A_NOFPU 0x11
2815#define EF_SH4_NOMMU_NOFPU 0x12
2816#define EF_SH2A_NOFPU 0x13
2817#define EF_SH3_NOMMU 0x14
2818#define EF_SH2A_SH4_NOFPU 0x15
2819#define EF_SH2A_SH3_NOFPU 0x16
2820#define EF_SH2A_SH4 0x17
2821#define EF_SH2A_SH3E 0x18
2822
2823#define R_SH_NONE 0
2824#define R_SH_DIR32 1
2825#define R_SH_REL32 2
2826#define R_SH_DIR8WPN 3
2827#define R_SH_IND12W 4
2828#define R_SH_DIR8WPL 5
2829#define R_SH_DIR8WPZ 6
2830#define R_SH_DIR8BP 7
2831#define R_SH_DIR8W 8
2832#define R_SH_DIR8L 9
2833#define R_SH_SWITCH16 25
2834#define R_SH_SWITCH32 26
2835#define R_SH_USES 27
2836#define R_SH_COUNT 28
2837#define R_SH_ALIGN 29
2838#define R_SH_CODE 30
2839#define R_SH_DATA 31
2840#define R_SH_LABEL 32
2841#define R_SH_SWITCH8 33
2842#define R_SH_GNU_VTINHERIT 34
2843#define R_SH_GNU_VTENTRY 35
2844#define R_SH_TLS_GD_32 144
2845#define R_SH_TLS_LD_32 145
2846#define R_SH_TLS_LDO_32 146
2847#define R_SH_TLS_IE_32 147
2848#define R_SH_TLS_LE_32 148
2849#define R_SH_TLS_DTPMOD32 149
2850#define R_SH_TLS_DTPOFF32 150
2851#define R_SH_TLS_TPOFF32 151
2852#define R_SH_GOT32 160
2853#define R_SH_PLT32 161
2854#define R_SH_COPY 162
2855#define R_SH_GLOB_DAT 163
2856#define R_SH_JMP_SLOT 164
2857#define R_SH_RELATIVE 165
2858#define R_SH_GOTOFF 166
2859#define R_SH_GOTPC 167
2860#define R_SH_GOT20 201
2861#define R_SH_GOTOFF20 202
2862#define R_SH_GOTFUNCDESC 203
2863#define R_SH_GOTFUNCDEST20 204
2864#define R_SH_GOTOFFFUNCDESC 205
2865#define R_SH_GOTOFFFUNCDEST20 206
2866#define R_SH_FUNCDESC 207
2867#define R_SH_FUNCDESC_VALUE 208
2868
2869#define R_SH_NUM 256
2870
2871
2872
2873#define R_390_NONE 0
2874#define R_390_8 1
2875#define R_390_12 2
2876#define R_390_16 3
2877#define R_390_32 4
2878#define R_390_PC32 5
2879#define R_390_GOT12 6
2880#define R_390_GOT32 7
2881#define R_390_PLT32 8
2882#define R_390_COPY 9
2883#define R_390_GLOB_DAT 10
2884#define R_390_JMP_SLOT 11
2885#define R_390_RELATIVE 12
2886#define R_390_GOTOFF32 13
2887#define R_390_GOTPC 14
2888#define R_390_GOT16 15
2889#define R_390_PC16 16
2890#define R_390_PC16DBL 17
2891#define R_390_PLT16DBL 18
2892#define R_390_PC32DBL 19
2893#define R_390_PLT32DBL 20
2894#define R_390_GOTPCDBL 21
2895#define R_390_64 22
2896#define R_390_PC64 23
2897#define R_390_GOT64 24
2898#define R_390_PLT64 25
2899#define R_390_GOTENT 26
2900#define R_390_GOTOFF16 27
2901#define R_390_GOTOFF64 28
2902#define R_390_GOTPLT12 29
2903#define R_390_GOTPLT16 30
2904#define R_390_GOTPLT32 31
2905#define R_390_GOTPLT64 32
2906#define R_390_GOTPLTENT 33
2907#define R_390_PLTOFF16 34
2908#define R_390_PLTOFF32 35
2909#define R_390_PLTOFF64 36
2910#define R_390_TLS_LOAD 37
2911#define R_390_TLS_GDCALL 38
2912
2913#define R_390_TLS_LDCALL 39
2914
2915#define R_390_TLS_GD32 40
2916
2917#define R_390_TLS_GD64 41
2918
2919#define R_390_TLS_GOTIE12 42
2920
2921#define R_390_TLS_GOTIE32 43
2922
2923#define R_390_TLS_GOTIE64 44
2924
2925#define R_390_TLS_LDM32 45
2926
2927#define R_390_TLS_LDM64 46
2928
2929#define R_390_TLS_IE32 47
2930
2931#define R_390_TLS_IE64 48
2932
2933#define R_390_TLS_IEENT 49
2934
2935#define R_390_TLS_LE32 50
2936
2937#define R_390_TLS_LE64 51
2938
2939#define R_390_TLS_LDO32 52
2940
2941#define R_390_TLS_LDO64 53
2942
2943#define R_390_TLS_DTPMOD 54
2944#define R_390_TLS_DTPOFF 55
2945#define R_390_TLS_TPOFF 56
2946
2947#define R_390_20 57
2948#define R_390_GOT20 58
2949#define R_390_GOTPLT20 59
2950#define R_390_TLS_GOTIE20 60
2951
2952
2953#define R_390_NUM 61
2954
2955
2956
2957#define R_CRIS_NONE 0
2958#define R_CRIS_8 1
2959#define R_CRIS_16 2
2960#define R_CRIS_32 3
2961#define R_CRIS_8_PCREL 4
2962#define R_CRIS_16_PCREL 5
2963#define R_CRIS_32_PCREL 6
2964#define R_CRIS_GNU_VTINHERIT 7
2965#define R_CRIS_GNU_VTENTRY 8
2966#define R_CRIS_COPY 9
2967#define R_CRIS_GLOB_DAT 10
2968#define R_CRIS_JUMP_SLOT 11
2969#define R_CRIS_RELATIVE 12
2970#define R_CRIS_16_GOT 13
2971#define R_CRIS_32_GOT 14
2972#define R_CRIS_16_GOTPLT 15
2973#define R_CRIS_32_GOTPLT 16
2974#define R_CRIS_32_GOTREL 17
2975#define R_CRIS_32_PLT_GOTREL 18
2976#define R_CRIS_32_PLT_PCREL 19
2977
2978#define R_CRIS_NUM 20
2979
2980
2981
2982#define R_X86_64_NONE 0
2983#define R_X86_64_64 1
2984#define R_X86_64_PC32 2
2985#define R_X86_64_GOT32 3
2986#define R_X86_64_PLT32 4
2987#define R_X86_64_COPY 5
2988#define R_X86_64_GLOB_DAT 6
2989#define R_X86_64_JUMP_SLOT 7
2990#define R_X86_64_RELATIVE 8
2991#define R_X86_64_GOTPCREL 9
2992
2993#define R_X86_64_32 10
2994#define R_X86_64_32S 11
2995#define R_X86_64_16 12
2996#define R_X86_64_PC16 13
2997#define R_X86_64_8 14
2998#define R_X86_64_PC8 15
2999#define R_X86_64_DTPMOD64 16
3000#define R_X86_64_DTPOFF64 17
3001#define R_X86_64_TPOFF64 18
3002#define R_X86_64_TLSGD 19
3003
3004#define R_X86_64_TLSLD 20
3005
3006#define R_X86_64_DTPOFF32 21
3007#define R_X86_64_GOTTPOFF 22
3008
3009#define R_X86_64_TPOFF32 23
3010#define R_X86_64_PC64 24
3011#define R_X86_64_GOTOFF64 25
3012#define R_X86_64_GOTPC32 26
3013#define R_X86_64_GOT64 27
3014#define R_X86_64_GOTPCREL64 28
3015#define R_X86_64_GOTPC64 29
3016#define R_X86_64_GOTPLT64 30
3017#define R_X86_64_PLTOFF64 31
3018#define R_X86_64_SIZE32 32
3019#define R_X86_64_SIZE64 33
3020
3021#define R_X86_64_GOTPC32_TLSDESC 34
3022#define R_X86_64_TLSDESC_CALL 35
3023
3024#define R_X86_64_TLSDESC 36
3025#define R_X86_64_IRELATIVE 37
3026#define R_X86_64_RELATIVE64 38
3027#define R_X86_64_GOTPCRELX 41
3028#define R_X86_64_REX_GOTPCRELX 42
3029#define R_X86_64_NUM 43
3030
3031
3032
3033#define R_MN10300_NONE 0
3034#define R_MN10300_32 1
3035#define R_MN10300_16 2
3036#define R_MN10300_8 3
3037#define R_MN10300_PCREL32 4
3038#define R_MN10300_PCREL16 5
3039#define R_MN10300_PCREL8 6
3040#define R_MN10300_GNU_VTINHERIT 7
3041#define R_MN10300_GNU_VTENTRY 8
3042#define R_MN10300_24 9
3043#define R_MN10300_GOTPC32 10
3044#define R_MN10300_GOTPC16 11
3045#define R_MN10300_GOTOFF32 12
3046#define R_MN10300_GOTOFF24 13
3047#define R_MN10300_GOTOFF16 14
3048#define R_MN10300_PLT32 15
3049#define R_MN10300_PLT16 16
3050#define R_MN10300_GOT32 17
3051#define R_MN10300_GOT24 18
3052#define R_MN10300_GOT16 19
3053#define R_MN10300_COPY 20
3054#define R_MN10300_GLOB_DAT 21
3055#define R_MN10300_JMP_SLOT 22
3056#define R_MN10300_RELATIVE 23
3057
3058#define R_MN10300_NUM 24
3059
3060
3061
3062#define R_M32R_NONE 0
3063#define R_M32R_16 1
3064#define R_M32R_32 2
3065#define R_M32R_24 3
3066#define R_M32R_10_PCREL 4
3067#define R_M32R_18_PCREL 5
3068#define R_M32R_26_PCREL 6
3069#define R_M32R_HI16_ULO 7
3070#define R_M32R_HI16_SLO 8
3071#define R_M32R_LO16 9
3072#define R_M32R_SDA16 10
3073#define R_M32R_GNU_VTINHERIT 11
3074#define R_M32R_GNU_VTENTRY 12
3075
3076#define R_M32R_16_RELA 33
3077#define R_M32R_32_RELA 34
3078#define R_M32R_24_RELA 35
3079#define R_M32R_10_PCREL_RELA 36
3080#define R_M32R_18_PCREL_RELA 37
3081#define R_M32R_26_PCREL_RELA 38
3082#define R_M32R_HI16_ULO_RELA 39
3083#define R_M32R_HI16_SLO_RELA 40
3084#define R_M32R_LO16_RELA 41
3085#define R_M32R_SDA16_RELA 42
3086#define R_M32R_RELA_GNU_VTINHERIT 43
3087#define R_M32R_RELA_GNU_VTENTRY 44
3088#define R_M32R_REL32 45
3089
3090#define R_M32R_GOT24 48
3091#define R_M32R_26_PLTREL 49
3092#define R_M32R_COPY 50
3093#define R_M32R_GLOB_DAT 51
3094#define R_M32R_JMP_SLOT 52
3095#define R_M32R_RELATIVE 53
3096#define R_M32R_GOTOFF 54
3097#define R_M32R_GOTPC24 55
3098#define R_M32R_GOT16_HI_ULO 56
3099
3100#define R_M32R_GOT16_HI_SLO 57
3101
3102#define R_M32R_GOT16_LO 58
3103#define R_M32R_GOTPC_HI_ULO 59
3104
3105#define R_M32R_GOTPC_HI_SLO 60
3106
3107#define R_M32R_GOTPC_LO 61
3108
3109#define R_M32R_GOTOFF_HI_ULO 62
3110
3111#define R_M32R_GOTOFF_HI_SLO 63
3112
3113#define R_M32R_GOTOFF_LO 64
3114#define R_M32R_NUM 256
3115
3116#define R_MICROBLAZE_NONE 0
3117#define R_MICROBLAZE_32 1
3118#define R_MICROBLAZE_32_PCREL 2
3119#define R_MICROBLAZE_64_PCREL 3
3120#define R_MICROBLAZE_32_PCREL_LO 4
3121#define R_MICROBLAZE_64 5
3122#define R_MICROBLAZE_32_LO 6
3123#define R_MICROBLAZE_SRO32 7
3124#define R_MICROBLAZE_SRW32 8
3125#define R_MICROBLAZE_64_NONE 9
3126#define R_MICROBLAZE_32_SYM_OP_SYM 10
3127#define R_MICROBLAZE_GNU_VTINHERIT 11
3128#define R_MICROBLAZE_GNU_VTENTRY 12
3129#define R_MICROBLAZE_GOTPC_64 13
3130#define R_MICROBLAZE_GOT_64 14
3131#define R_MICROBLAZE_PLT_64 15
3132#define R_MICROBLAZE_REL 16
3133#define R_MICROBLAZE_JUMP_SLOT 17
3134#define R_MICROBLAZE_GLOB_DAT 18
3135#define R_MICROBLAZE_GOTOFF_64 19
3136#define R_MICROBLAZE_GOTOFF_32 20
3137#define R_MICROBLAZE_COPY 21
3138#define R_MICROBLAZE_TLS 22
3139#define R_MICROBLAZE_TLSGD 23
3140#define R_MICROBLAZE_TLSLD 24
3141#define R_MICROBLAZE_TLSDTPMOD32 25
3142#define R_MICROBLAZE_TLSDTPREL32 26
3143#define R_MICROBLAZE_TLSDTPREL64 27
3144#define R_MICROBLAZE_TLSGOTTPREL32 28
3145#define R_MICROBLAZE_TLSTPREL32 29
3146
3147#define DT_NIOS2_GP 0x70000002
3148
3149#define R_NIOS2_NONE 0
3150#define R_NIOS2_S16 1
3151#define R_NIOS2_U16 2
3152#define R_NIOS2_PCREL16 3
3153#define R_NIOS2_CALL26 4
3154#define R_NIOS2_IMM5 5
3155#define R_NIOS2_CACHE_OPX 6
3156#define R_NIOS2_IMM6 7
3157#define R_NIOS2_IMM8 8
3158#define R_NIOS2_HI16 9
3159#define R_NIOS2_LO16 10
3160#define R_NIOS2_HIADJ16 11
3161#define R_NIOS2_BFD_RELOC_32 12
3162#define R_NIOS2_BFD_RELOC_16 13
3163#define R_NIOS2_BFD_RELOC_8 14
3164#define R_NIOS2_GPREL 15
3165#define R_NIOS2_GNU_VTINHERIT 16
3166#define R_NIOS2_GNU_VTENTRY 17
3167#define R_NIOS2_UJMP 18
3168#define R_NIOS2_CJMP 19
3169#define R_NIOS2_CALLR 20
3170#define R_NIOS2_ALIGN 21
3171#define R_NIOS2_GOT16 22
3172#define R_NIOS2_CALL16 23
3173#define R_NIOS2_GOTOFF_LO 24
3174#define R_NIOS2_GOTOFF_HA 25
3175#define R_NIOS2_PCREL_LO 26
3176#define R_NIOS2_PCREL_HA 27
3177#define R_NIOS2_TLS_GD16 28
3178#define R_NIOS2_TLS_LDM16 29
3179#define R_NIOS2_TLS_LDO16 30
3180#define R_NIOS2_TLS_IE16 31
3181#define R_NIOS2_TLS_LE16 32
3182#define R_NIOS2_TLS_DTPMOD 33
3183#define R_NIOS2_TLS_DTPREL 34
3184#define R_NIOS2_TLS_TPREL 35
3185#define R_NIOS2_COPY 36
3186#define R_NIOS2_GLOB_DAT 37
3187#define R_NIOS2_JUMP_SLOT 38
3188#define R_NIOS2_RELATIVE 39
3189#define R_NIOS2_GOTOFF 40
3190#define R_NIOS2_CALL26_NOAT 41
3191#define R_NIOS2_GOT_LO 42
3192#define R_NIOS2_GOT_HA 43
3193#define R_NIOS2_CALL_LO 44
3194#define R_NIOS2_CALL_HA 45
3195
3196#define R_OR1K_NONE 0
3197#define R_OR1K_32 1
3198#define R_OR1K_16 2
3199#define R_OR1K_8 3
3200#define R_OR1K_LO_16_IN_INSN 4
3201#define R_OR1K_HI_16_IN_INSN 5
3202#define R_OR1K_INSN_REL_26 6
3203#define R_OR1K_GNU_VTENTRY 7
3204#define R_OR1K_GNU_VTINHERIT 8
3205#define R_OR1K_32_PCREL 9
3206#define R_OR1K_16_PCREL 10
3207#define R_OR1K_8_PCREL 11
3208#define R_OR1K_GOTPC_HI16 12
3209#define R_OR1K_GOTPC_LO16 13
3210#define R_OR1K_GOT16 14
3211#define R_OR1K_PLT26 15
3212#define R_OR1K_GOTOFF_HI16 16
3213#define R_OR1K_GOTOFF_LO16 17
3214#define R_OR1K_COPY 18
3215#define R_OR1K_GLOB_DAT 19
3216#define R_OR1K_JMP_SLOT 20
3217#define R_OR1K_RELATIVE 21
3218#define R_OR1K_TLS_GD_HI16 22
3219#define R_OR1K_TLS_GD_LO16 23
3220#define R_OR1K_TLS_LDM_HI16 24
3221#define R_OR1K_TLS_LDM_LO16 25
3222#define R_OR1K_TLS_LDO_HI16 26
3223#define R_OR1K_TLS_LDO_LO16 27
3224#define R_OR1K_TLS_IE_HI16 28
3225#define R_OR1K_TLS_IE_LO16 29
3226#define R_OR1K_TLS_LE_HI16 30
3227#define R_OR1K_TLS_LE_LO16 31
3228#define R_OR1K_TLS_TPOFF 32
3229#define R_OR1K_TLS_DTPOFF 33
3230#define R_OR1K_TLS_DTPMOD 34
3231
3232#define R_BPF_NONE 0
3233#define R_BPF_MAP_FD 1
3234
3235#define R_RISCV_NONE 0
3236#define R_RISCV_32 1
3237#define R_RISCV_64 2
3238#define R_RISCV_RELATIVE 3
3239#define R_RISCV_COPY 4
3240#define R_RISCV_JUMP_SLOT 5
3241#define R_RISCV_TLS_DTPMOD32 6
3242#define R_RISCV_TLS_DTPMOD64 7
3243#define R_RISCV_TLS_DTPREL32 8
3244#define R_RISCV_TLS_DTPREL64 9
3245#define R_RISCV_TLS_TPREL32 10
3246#define R_RISCV_TLS_TPREL64 11
3247
3248#define R_RISCV_BRANCH 16
3249#define R_RISCV_JAL 17
3250#define R_RISCV_CALL 18
3251#define R_RISCV_CALL_PLT 19
3252#define R_RISCV_GOT_HI20 20
3253#define R_RISCV_TLS_GOT_HI20 21
3254#define R_RISCV_TLS_GD_HI20 22
3255#define R_RISCV_PCREL_HI20 23
3256#define R_RISCV_PCREL_LO12_I 24
3257#define R_RISCV_PCREL_LO12_S 25
3258#define R_RISCV_HI20 26
3259#define R_RISCV_LO12_I 27
3260#define R_RISCV_LO12_S 28
3261#define R_RISCV_TPREL_HI20 29
3262#define R_RISCV_TPREL_LO12_I 30
3263#define R_RISCV_TPREL_LO12_S 31
3264#define R_RISCV_TPREL_ADD 32
3265#define R_RISCV_ADD8 33
3266#define R_RISCV_ADD16 34
3267#define R_RISCV_ADD32 35
3268#define R_RISCV_ADD64 36
3269#define R_RISCV_SUB8 37
3270#define R_RISCV_SUB16 38
3271#define R_RISCV_SUB32 39
3272#define R_RISCV_SUB64 40
3273#define R_RISCV_GNU_VTINHERIT 41
3274#define R_RISCV_GNU_VTENTRY 42
3275#define R_RISCV_ALIGN 43
3276#define R_RISCV_RVC_BRANCH 44
3277#define R_RISCV_RVC_JUMP 45
3278#define R_RISCV_RVC_LUI 46
3279#define R_RISCV_GPREL_I 47
3280#define R_RISCV_GPREL_S 48
3281#define R_RISCV_TPREL_I 49
3282#define R_RISCV_TPREL_S 50
3283#define R_RISCV_RELAX 51
3284#define R_RISCV_SUB6 52
3285#define R_RISCV_SET6 53
3286#define R_RISCV_SET8 54
3287#define R_RISCV_SET16 55
3288#define R_RISCV_SET32 56
3289#define R_RISCV_32_PCREL 57
3290
3291#ifdef __cplusplus
3292}
3293#endif
3294
3295
3296#endif
lib/libc/wasi/libc-top-half/musl/include/grp.h deleted-53
......@@ -1,53 +0,0 @@
1#ifndef _GRP_H
2#define _GRP_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <features.h>
9
10#define __NEED_size_t
11#define __NEED_gid_t
12
13#ifdef _GNU_SOURCE
14#define __NEED_FILE
15#endif
16
17#include <bits/alltypes.h>
18
19struct group {
20 char *gr_name;
21 char *gr_passwd;
22 gid_t gr_gid;
23 char **gr_mem;
24};
25
26struct group *getgrgid(gid_t);
27struct group *getgrnam(const char *);
28
29int getgrgid_r(gid_t, struct group *, char *, size_t, struct group **);
30int getgrnam_r(const char *, struct group *, char *, size_t, struct group **);
31
32#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
33struct group *getgrent(void);
34void endgrent(void);
35void setgrent(void);
36#endif
37
38#ifdef _GNU_SOURCE
39struct group *fgetgrent(FILE *);
40int putgrent(const struct group *, FILE *);
41#endif
42
43#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
44int getgrouplist(const char *, gid_t, gid_t *, int *);
45int setgroups(size_t, const gid_t *);
46int initgroups(const char *, gid_t);
47#endif
48
49#ifdef __cplusplus
50}
51#endif
52
53#endif
lib/libc/wasi/libc-top-half/musl/include/lastlog.h deleted-1
......@@ -1 +0,0 @@
1#include <utmp.h>
lib/libc/wasi/libc-top-half/musl/include/libintl.h deleted-33
......@@ -1,33 +0,0 @@
1#ifndef _LIBINTL_H
2#define _LIBINTL_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#define __USE_GNU_GETTEXT 1
9#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 1 : -1)
10
11#if __GNUC__ >= 3
12#define __fa(n) __attribute__ ((__format_arg__ (n)))
13#else
14#define __fa(n)
15#endif
16
17char *gettext(const char *) __fa(1);
18char *dgettext(const char *, const char *) __fa(2);
19char *dcgettext(const char *, const char *, int) __fa(2);
20char *ngettext(const char *, const char *, unsigned long) __fa(1) __fa(2);
21char *dngettext(const char *, const char *, const char *, unsigned long) __fa(2) __fa(3);
22char *dcngettext(const char *, const char *, const char *, unsigned long, int) __fa(2) __fa(3);
23char *textdomain(const char *);
24char *bindtextdomain (const char *, const char *);
25char *bind_textdomain_codeset(const char *, const char *);
26
27#undef __fa
28
29#ifdef __cplusplus
30}
31#endif
32
33#endif
lib/libc/wasi/libc-top-half/musl/include/link.h deleted-53
......@@ -1,53 +0,0 @@
1#ifndef _LINK_H
2#define _LINK_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <elf.h>
9#define __NEED_size_t
10#define __NEED_uint32_t
11#include <bits/alltypes.h>
12
13#if UINTPTR_MAX > 0xffffffff
14#define ElfW(type) Elf64_ ## type
15#else
16#define ElfW(type) Elf32_ ## type
17#endif
18
19#include <bits/link.h>
20
21struct dl_phdr_info {
22 ElfW(Addr) dlpi_addr;
23 const char *dlpi_name;
24 const ElfW(Phdr) *dlpi_phdr;
25 ElfW(Half) dlpi_phnum;
26 unsigned long long int dlpi_adds;
27 unsigned long long int dlpi_subs;
28 size_t dlpi_tls_modid;
29 void *dlpi_tls_data;
30};
31
32struct link_map {
33 ElfW(Addr) l_addr;
34 char *l_name;
35 ElfW(Dyn) *l_ld;
36 struct link_map *l_next, *l_prev;
37};
38
39struct r_debug {
40 int r_version;
41 struct link_map *r_map;
42 ElfW(Addr) r_brk;
43 enum { RT_CONSISTENT, RT_ADD, RT_DELETE } r_state;
44 ElfW(Addr) r_ldbase;
45};
46
47int dl_iterate_phdr(int (*)(struct dl_phdr_info *, size_t, void *), void *);
48
49#ifdef __cplusplus
50}
51#endif
52
53#endif
lib/libc/wasi/libc-top-half/musl/include/mntent.h deleted-43
......@@ -1,43 +0,0 @@
1#ifndef _MNTENT_H
2#define _MNTENT_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#define __NEED_FILE
9#include <bits/alltypes.h>
10
11#define MOUNTED "/etc/mtab"
12
13#define MNTTYPE_IGNORE "ignore"
14#define MNTTYPE_NFS "nfs"
15#define MNTTYPE_SWAP "swap"
16#define MNTOPT_DEFAULTS "defaults"
17#define MNTOPT_RO "ro"
18#define MNTOPT_RW "rw"
19#define MNTOPT_SUID "suid"
20#define MNTOPT_NOSUID "nosuid"
21#define MNTOPT_NOAUTO "noauto"
22
23struct mntent {
24 char *mnt_fsname;
25 char *mnt_dir;
26 char *mnt_type;
27 char *mnt_opts;
28 int mnt_freq;
29 int mnt_passno;
30};
31
32FILE *setmntent(const char *, const char *);
33int endmntent(FILE *);
34struct mntent *getmntent(FILE *);
35struct mntent *getmntent_r(FILE *, struct mntent *, char *, int);
36int addmntent(FILE *, const struct mntent *);
37char *hasmntopt(const struct mntent *, const char *);
38
39#ifdef __cplusplus
40}
41#endif
42
43#endif
lib/libc/wasi/libc-top-half/musl/include/net/ethernet.h deleted-55
......@@ -1,55 +0,0 @@
1#ifndef _NET_ETHERNET_H
2#define _NET_ETHERNET_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <stdint.h>
9#include <sys/types.h>
10#include <netinet/if_ether.h>
11
12struct ether_addr {
13 uint8_t ether_addr_octet[ETH_ALEN];
14};
15
16struct ether_header {
17 uint8_t ether_dhost[ETH_ALEN];
18 uint8_t ether_shost[ETH_ALEN];
19 uint16_t ether_type;
20};
21
22#define ETHERTYPE_PUP 0x0200
23#define ETHERTYPE_SPRITE 0x0500
24#define ETHERTYPE_IP 0x0800
25#define ETHERTYPE_ARP 0x0806
26#define ETHERTYPE_REVARP 0x8035
27#define ETHERTYPE_AT 0x809B
28#define ETHERTYPE_AARP 0x80F3
29#define ETHERTYPE_VLAN 0x8100
30#define ETHERTYPE_IPX 0x8137
31#define ETHERTYPE_IPV6 0x86dd
32#define ETHERTYPE_LOOPBACK 0x9000
33
34
35#define ETHER_ADDR_LEN ETH_ALEN
36#define ETHER_TYPE_LEN 2
37#define ETHER_CRC_LEN 4
38#define ETHER_HDR_LEN ETH_HLEN
39#define ETHER_MIN_LEN (ETH_ZLEN + ETHER_CRC_LEN)
40#define ETHER_MAX_LEN (ETH_FRAME_LEN + ETHER_CRC_LEN)
41
42#define ETHER_IS_VALID_LEN(foo) \
43 ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN)
44
45#define ETHERTYPE_TRAIL 0x1000
46#define ETHERTYPE_NTRAILER 16
47
48#define ETHERMTU ETH_DATA_LEN
49#define ETHERMIN (ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
50
51#ifdef __cplusplus
52}
53#endif
54
55#endif
lib/libc/wasi/libc-top-half/musl/include/net/if.h deleted-141
......@@ -1,141 +0,0 @@
1#ifndef _NET_IF_H
2#define _NET_IF_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <features.h>
9
10#define IF_NAMESIZE 16
11
12struct if_nameindex {
13 unsigned int if_index;
14 char *if_name;
15};
16
17unsigned int if_nametoindex (const char *);
18char *if_indextoname (unsigned int, char *);
19struct if_nameindex *if_nameindex (void);
20void if_freenameindex (struct if_nameindex *);
21
22
23
24
25#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
26
27#include <sys/socket.h>
28
29#define IFF_UP 0x1
30#define IFF_BROADCAST 0x2
31#define IFF_DEBUG 0x4
32#define IFF_LOOPBACK 0x8
33#define IFF_POINTOPOINT 0x10
34#define IFF_NOTRAILERS 0x20
35#define IFF_RUNNING 0x40
36#define IFF_NOARP 0x80
37#define IFF_PROMISC 0x100
38#define IFF_ALLMULTI 0x200
39#define IFF_MASTER 0x400
40#define IFF_SLAVE 0x800
41#define IFF_MULTICAST 0x1000
42#define IFF_PORTSEL 0x2000
43#define IFF_AUTOMEDIA 0x4000
44#define IFF_DYNAMIC 0x8000
45#define IFF_LOWER_UP 0x10000
46#define IFF_DORMANT 0x20000
47#define IFF_ECHO 0x40000
48#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST| \
49 IFF_ECHO|IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
50
51struct ifaddr {
52 struct sockaddr ifa_addr;
53 union {
54 struct sockaddr ifu_broadaddr;
55 struct sockaddr ifu_dstaddr;
56 } ifa_ifu;
57 struct iface *ifa_ifp;
58 struct ifaddr *ifa_next;
59};
60
61#define ifa_broadaddr ifa_ifu.ifu_broadaddr
62#define ifa_dstaddr ifa_ifu.ifu_dstaddr
63
64struct ifmap {
65 unsigned long int mem_start;
66 unsigned long int mem_end;
67 unsigned short int base_addr;
68 unsigned char irq;
69 unsigned char dma;
70 unsigned char port;
71};
72
73#define IFHWADDRLEN 6
74#define IFNAMSIZ IF_NAMESIZE
75
76struct ifreq {
77 union {
78 char ifrn_name[IFNAMSIZ];
79 } ifr_ifrn;
80 union {
81 struct sockaddr ifru_addr;
82 struct sockaddr ifru_dstaddr;
83 struct sockaddr ifru_broadaddr;
84 struct sockaddr ifru_netmask;
85 struct sockaddr ifru_hwaddr;
86 short int ifru_flags;
87 int ifru_ivalue;
88 int ifru_mtu;
89 struct ifmap ifru_map;
90 char ifru_slave[IFNAMSIZ];
91 char ifru_newname[IFNAMSIZ];
92 char *ifru_data;
93 } ifr_ifru;
94};
95
96#define ifr_name ifr_ifrn.ifrn_name
97#define ifr_hwaddr ifr_ifru.ifru_hwaddr
98#define ifr_addr ifr_ifru.ifru_addr
99#define ifr_dstaddr ifr_ifru.ifru_dstaddr
100#define ifr_broadaddr ifr_ifru.ifru_broadaddr
101#define ifr_netmask ifr_ifru.ifru_netmask
102#define ifr_flags ifr_ifru.ifru_flags
103#define ifr_metric ifr_ifru.ifru_ivalue
104#define ifr_mtu ifr_ifru.ifru_mtu
105#define ifr_map ifr_ifru.ifru_map
106#define ifr_slave ifr_ifru.ifru_slave
107#define ifr_data ifr_ifru.ifru_data
108#define ifr_ifindex ifr_ifru.ifru_ivalue
109#define ifr_bandwidth ifr_ifru.ifru_ivalue
110#define ifr_qlen ifr_ifru.ifru_ivalue
111#define ifr_newname ifr_ifru.ifru_newname
112#define _IOT_ifreq _IOT(_IOTS(char),IFNAMSIZ,_IOTS(char),16,0,0)
113#define _IOT_ifreq_short _IOT(_IOTS(char),IFNAMSIZ,_IOTS(short),1,0,0)
114#define _IOT_ifreq_int _IOT(_IOTS(char),IFNAMSIZ,_IOTS(int),1,0,0)
115
116struct ifconf {
117 int ifc_len;
118 union {
119 char *ifcu_buf;
120 struct ifreq *ifcu_req;
121 } ifc_ifcu;
122};
123
124#define ifc_buf ifc_ifcu.ifcu_buf
125#define ifc_req ifc_ifcu.ifcu_req
126#define _IOT_ifconf _IOT(_IOTS(struct ifconf),1,0,0,0,0)
127
128#define __UAPI_DEF_IF_IFCONF 0
129#define __UAPI_DEF_IF_IFMAP 0
130#define __UAPI_DEF_IF_IFNAMSIZ 0
131#define __UAPI_DEF_IF_IFREQ 0
132#define __UAPI_DEF_IF_NET_DEVICE_FLAGS 0
133#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 0
134
135#endif
136
137#ifdef __cplusplus
138}
139#endif
140
141#endif
lib/libc/wasi/libc-top-half/musl/include/net/if_arp.h deleted-142
......@@ -1,142 +0,0 @@
1/* Nonstandard header */
2#ifndef _NET_IF_ARP_H
3#define _NET_IF_ARP_H
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <inttypes.h>
9#include <sys/types.h>
10#include <sys/socket.h>
11
12#define MAX_ADDR_LEN 7
13
14#define ARPOP_REQUEST 1
15#define ARPOP_REPLY 2
16#define ARPOP_RREQUEST 3
17#define ARPOP_RREPLY 4
18#define ARPOP_InREQUEST 8
19#define ARPOP_InREPLY 9
20#define ARPOP_NAK 10
21
22struct arphdr {
23 uint16_t ar_hrd;
24 uint16_t ar_pro;
25 uint8_t ar_hln;
26 uint8_t ar_pln;
27 uint16_t ar_op;
28};
29
30
31#define ARPHRD_NETROM 0
32#define ARPHRD_ETHER 1
33#define ARPHRD_EETHER 2
34#define ARPHRD_AX25 3
35#define ARPHRD_PRONET 4
36#define ARPHRD_CHAOS 5
37#define ARPHRD_IEEE802 6
38#define ARPHRD_ARCNET 7
39#define ARPHRD_APPLETLK 8
40#define ARPHRD_DLCI 15
41#define ARPHRD_ATM 19
42#define ARPHRD_METRICOM 23
43#define ARPHRD_IEEE1394 24
44#define ARPHRD_EUI64 27
45#define ARPHRD_INFINIBAND 32
46#define ARPHRD_SLIP 256
47#define ARPHRD_CSLIP 257
48#define ARPHRD_SLIP6 258
49#define ARPHRD_CSLIP6 259
50#define ARPHRD_RSRVD 260
51#define ARPHRD_ADAPT 264
52#define ARPHRD_ROSE 270
53#define ARPHRD_X25 271
54#define ARPHRD_HWX25 272
55#define ARPHRD_CAN 280
56#define ARPHRD_PPP 512
57#define ARPHRD_CISCO 513
58#define ARPHRD_HDLC ARPHRD_CISCO
59#define ARPHRD_LAPB 516
60#define ARPHRD_DDCMP 517
61#define ARPHRD_RAWHDLC 518
62#define ARPHRD_RAWIP 519
63
64#define ARPHRD_TUNNEL 768
65#define ARPHRD_TUNNEL6 769
66#define ARPHRD_FRAD 770
67#define ARPHRD_SKIP 771
68#define ARPHRD_LOOPBACK 772
69#define ARPHRD_LOCALTLK 773
70#define ARPHRD_FDDI 774
71#define ARPHRD_BIF 775
72#define ARPHRD_SIT 776
73#define ARPHRD_IPDDP 777
74#define ARPHRD_IPGRE 778
75#define ARPHRD_PIMREG 779
76#define ARPHRD_HIPPI 780
77#define ARPHRD_ASH 781
78#define ARPHRD_ECONET 782
79#define ARPHRD_IRDA 783
80#define ARPHRD_FCPP 784
81#define ARPHRD_FCAL 785
82#define ARPHRD_FCPL 786
83#define ARPHRD_FCFABRIC 787
84#define ARPHRD_IEEE802_TR 800
85#define ARPHRD_IEEE80211 801
86#define ARPHRD_IEEE80211_PRISM 802
87#define ARPHRD_IEEE80211_RADIOTAP 803
88#define ARPHRD_IEEE802154 804
89#define ARPHRD_IEEE802154_MONITOR 805
90#define ARPHRD_PHONET 820
91#define ARPHRD_PHONET_PIPE 821
92#define ARPHRD_CAIF 822
93#define ARPHRD_IP6GRE 823
94#define ARPHRD_NETLINK 824
95#define ARPHRD_6LOWPAN 825
96#define ARPHRD_VSOCKMON 826
97
98#define ARPHRD_VOID 0xFFFF
99#define ARPHRD_NONE 0xFFFE
100
101struct arpreq {
102 struct sockaddr arp_pa;
103 struct sockaddr arp_ha;
104 int arp_flags;
105 struct sockaddr arp_netmask;
106 char arp_dev[16];
107};
108
109struct arpreq_old {
110 struct sockaddr arp_pa;
111 struct sockaddr arp_ha;
112 int arp_flags;
113 struct sockaddr arp_netmask;
114};
115
116#define ATF_COM 0x02
117#define ATF_PERM 0x04
118#define ATF_PUBL 0x08
119#define ATF_USETRAILERS 0x10
120#define ATF_NETMASK 0x20
121#define ATF_DONTPUB 0x40
122#define ATF_MAGIC 0x80
123
124#define ARPD_UPDATE 0x01
125#define ARPD_LOOKUP 0x02
126#define ARPD_FLUSH 0x03
127
128struct arpd_request {
129 unsigned short req;
130 uint32_t ip;
131 unsigned long dev;
132 unsigned long stamp;
133 unsigned long updated;
134 unsigned char ha[MAX_ADDR_LEN];
135};
136
137
138
139#ifdef __cplusplus
140}
141#endif
142#endif
lib/libc/wasi/libc-top-half/musl/include/net/route.h deleted-124
......@@ -1,124 +0,0 @@
1#ifndef _NET_ROUTE_H
2#define _NET_ROUTE_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <stdint.h>
9#include <sys/socket.h>
10#include <sys/types.h>
11#include <netinet/in.h>
12
13
14struct rtentry {
15 unsigned long int rt_pad1;
16 struct sockaddr rt_dst;
17 struct sockaddr rt_gateway;
18 struct sockaddr rt_genmask;
19 unsigned short int rt_flags;
20 short int rt_pad2;
21 unsigned long int rt_pad3;
22 unsigned char rt_tos;
23 unsigned char rt_class;
24 short int rt_pad4[sizeof(long)/2-1];
25 short int rt_metric;
26 char *rt_dev;
27 unsigned long int rt_mtu;
28 unsigned long int rt_window;
29 unsigned short int rt_irtt;
30};
31
32#define rt_mss rt_mtu
33
34
35struct in6_rtmsg {
36 struct in6_addr rtmsg_dst;
37 struct in6_addr rtmsg_src;
38 struct in6_addr rtmsg_gateway;
39 uint32_t rtmsg_type;
40 uint16_t rtmsg_dst_len;
41 uint16_t rtmsg_src_len;
42 uint32_t rtmsg_metric;
43 unsigned long int rtmsg_info;
44 uint32_t rtmsg_flags;
45 int rtmsg_ifindex;
46};
47
48
49#define RTF_UP 0x0001
50#define RTF_GATEWAY 0x0002
51
52#define RTF_HOST 0x0004
53#define RTF_REINSTATE 0x0008
54#define RTF_DYNAMIC 0x0010
55#define RTF_MODIFIED 0x0020
56#define RTF_MTU 0x0040
57#define RTF_MSS RTF_MTU
58#define RTF_WINDOW 0x0080
59#define RTF_IRTT 0x0100
60#define RTF_REJECT 0x0200
61#define RTF_STATIC 0x0400
62#define RTF_XRESOLVE 0x0800
63#define RTF_NOFORWARD 0x1000
64#define RTF_THROW 0x2000
65#define RTF_NOPMTUDISC 0x4000
66
67#define RTF_DEFAULT 0x00010000
68#define RTF_ALLONLINK 0x00020000
69#define RTF_ADDRCONF 0x00040000
70
71#define RTF_LINKRT 0x00100000
72#define RTF_NONEXTHOP 0x00200000
73
74#define RTF_CACHE 0x01000000
75#define RTF_FLOW 0x02000000
76#define RTF_POLICY 0x04000000
77
78#define RTCF_VALVE 0x00200000
79#define RTCF_MASQ 0x00400000
80#define RTCF_NAT 0x00800000
81#define RTCF_DOREDIRECT 0x01000000
82#define RTCF_LOG 0x02000000
83#define RTCF_DIRECTSRC 0x04000000
84
85#define RTF_LOCAL 0x80000000
86#define RTF_INTERFACE 0x40000000
87#define RTF_MULTICAST 0x20000000
88#define RTF_BROADCAST 0x10000000
89#define RTF_NAT 0x08000000
90
91#define RTF_ADDRCLASSMASK 0xF8000000
92#define RT_ADDRCLASS(flags) ((uint32_t) flags >> 23)
93
94#define RT_TOS(tos) ((tos) & IPTOS_TOS_MASK)
95
96#define RT_LOCALADDR(flags) ((flags & RTF_ADDRCLASSMASK) \
97 == (RTF_LOCAL|RTF_INTERFACE))
98
99#define RT_CLASS_UNSPEC 0
100#define RT_CLASS_DEFAULT 253
101
102#define RT_CLASS_MAIN 254
103#define RT_CLASS_LOCAL 255
104#define RT_CLASS_MAX 255
105
106
107#define RTMSG_ACK NLMSG_ACK
108#define RTMSG_OVERRUN NLMSG_OVERRUN
109
110#define RTMSG_NEWDEVICE 0x11
111#define RTMSG_DELDEVICE 0x12
112#define RTMSG_NEWROUTE 0x21
113#define RTMSG_DELROUTE 0x22
114#define RTMSG_NEWRULE 0x31
115#define RTMSG_DELRULE 0x32
116#define RTMSG_CONTROL 0x40
117
118#define RTMSG_AR_FAILED 0x51
119
120#ifdef __cplusplus
121}
122#endif
123
124#endif
lib/libc/wasi/libc-top-half/musl/include/netdb.h deleted-156
......@@ -1,156 +0,0 @@
1#ifndef _NETDB_H
2#define _NETDB_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <features.h>
9#include <netinet/in.h>
10
11#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
12#define __NEED_size_t
13#include <bits/alltypes.h>
14#endif
15
16struct addrinfo {
17 int ai_flags;
18 int ai_family;
19 int ai_socktype;
20 int ai_protocol;
21 socklen_t ai_addrlen;
22 struct sockaddr *ai_addr;
23 char *ai_canonname;
24 struct addrinfo *ai_next;
25};
26
27#define AI_PASSIVE 0x01
28#define AI_CANONNAME 0x02
29#define AI_NUMERICHOST 0x04
30#define AI_V4MAPPED 0x08
31#define AI_ALL 0x10
32#define AI_ADDRCONFIG 0x20
33#define AI_NUMERICSERV 0x400
34
35
36#define NI_NUMERICHOST 0x01
37#define NI_NUMERICSERV 0x02
38#define NI_NOFQDN 0x04
39#define NI_NAMEREQD 0x08
40#define NI_DGRAM 0x10
41#define NI_NUMERICSCOPE 0x100
42
43#define EAI_BADFLAGS -1
44#define EAI_NONAME -2
45#define EAI_AGAIN -3
46#define EAI_FAIL -4
47#define EAI_FAMILY -6
48#define EAI_SOCKTYPE -7
49#define EAI_SERVICE -8
50#define EAI_MEMORY -10
51#define EAI_SYSTEM -11
52#define EAI_OVERFLOW -12
53
54int getaddrinfo (const char *__restrict, const char *__restrict, const struct addrinfo *__restrict, struct addrinfo **__restrict);
55void freeaddrinfo (struct addrinfo *);
56int getnameinfo (const struct sockaddr *__restrict, socklen_t, char *__restrict, socklen_t, char *__restrict, socklen_t, int);
57const char *gai_strerror(int);
58
59
60/* Legacy functions follow (marked OBsolete in SUS) */
61
62struct netent {
63 char *n_name;
64 char **n_aliases;
65 int n_addrtype;
66 uint32_t n_net;
67};
68
69struct hostent {
70 char *h_name;
71 char **h_aliases;
72 int h_addrtype;
73 int h_length;
74 char **h_addr_list;
75};
76#define h_addr h_addr_list[0]
77
78struct servent {
79 char *s_name;
80 char **s_aliases;
81 int s_port;
82 char *s_proto;
83};
84
85struct protoent {
86 char *p_name;
87 char **p_aliases;
88 int p_proto;
89};
90
91void sethostent (int);
92void endhostent (void);
93struct hostent *gethostent (void);
94
95void setnetent (int);
96void endnetent (void);
97struct netent *getnetent (void);
98struct netent *getnetbyaddr (uint32_t, int);
99struct netent *getnetbyname (const char *);
100
101void setservent (int);
102void endservent (void);
103struct servent *getservent (void);
104struct servent *getservbyname (const char *, const char *);
105struct servent *getservbyport (int, const char *);
106
107void setprotoent (int);
108void endprotoent (void);
109struct protoent *getprotoent (void);
110struct protoent *getprotobyname (const char *);
111struct protoent *getprotobynumber (int);
112
113#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_POSIX_SOURCE) \
114 || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE+0 < 200809L) \
115 || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700)
116struct hostent *gethostbyname (const char *);
117struct hostent *gethostbyaddr (const void *, socklen_t, int);
118#ifdef __GNUC__
119__attribute__((const))
120#endif
121int *__h_errno_location(void);
122#define h_errno (*__h_errno_location())
123#define HOST_NOT_FOUND 1
124#define TRY_AGAIN 2
125#define NO_RECOVERY 3
126#define NO_DATA 4
127#define NO_ADDRESS NO_DATA
128#endif
129
130#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
131void herror(const char *);
132const char *hstrerror(int);
133int gethostbyname_r(const char *, struct hostent *, char *, size_t, struct hostent **, int *);
134int gethostbyname2_r(const char *, int, struct hostent *, char *, size_t, struct hostent **, int *);
135struct hostent *gethostbyname2(const char *, int);
136int gethostbyaddr_r(const void *, socklen_t, int, struct hostent *, char *, size_t, struct hostent **, int *);
137int getservbyport_r(int, const char *, struct servent *, char *, size_t, struct servent **);
138int getservbyname_r(const char *, const char *, struct servent *, char *, size_t, struct servent **);
139#define EAI_NODATA -5
140#define EAI_ADDRFAMILY -9
141#define EAI_INPROGRESS -100
142#define EAI_CANCELED -101
143#define EAI_NOTCANCELED -102
144#define EAI_ALLDONE -103
145#define EAI_INTR -104
146#define EAI_IDN_ENCODE -105
147#define NI_MAXHOST 255
148#define NI_MAXSERV 32
149#endif
150
151
152#ifdef __cplusplus
153}
154#endif
155
156#endif
lib/libc/wasi/libc-top-half/musl/include/netinet/ether.h deleted-22
......@@ -1,22 +0,0 @@
1#ifndef _NETINET_ETHER_H
2#define _NETINET_ETHER_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <netinet/if_ether.h>
9
10char *ether_ntoa (const struct ether_addr *);
11struct ether_addr *ether_aton (const char *);
12char *ether_ntoa_r (const struct ether_addr *, char *);
13struct ether_addr *ether_aton_r (const char *, struct ether_addr *);
14int ether_line(const char *, struct ether_addr *, char *);
15int ether_ntohost(char *, const struct ether_addr *);
16int ether_hostton(const char *, struct ether_addr *);
17
18#ifdef __cplusplus
19}
20#endif
21
22#endif
lib/libc/wasi/libc-top-half/musl/include/netinet/if_ether.h deleted-149
......@@ -1,149 +0,0 @@
1#ifndef _NETINET_IF_ETHER_H
2#define _NETINET_IF_ETHER_H
3
4#include <stdint.h>
5#include <sys/types.h>
6
7#define ETH_ALEN 6
8#define ETH_TLEN 2
9#define ETH_HLEN 14
10#define ETH_ZLEN 60
11#define ETH_DATA_LEN 1500
12#define ETH_FRAME_LEN 1514
13#define ETH_FCS_LEN 4
14#define ETH_MIN_MTU 68
15#define ETH_MAX_MTU 0xFFFFU
16
17#define ETH_P_LOOP 0x0060
18#define ETH_P_PUP 0x0200
19#define ETH_P_PUPAT 0x0201
20#define ETH_P_TSN 0x22F0
21#define ETH_P_ERSPAN2 0x22EB
22#define ETH_P_IP 0x0800
23#define ETH_P_X25 0x0805
24#define ETH_P_ARP 0x0806
25#define ETH_P_BPQ 0x08FF
26#define ETH_P_IEEEPUP 0x0a00
27#define ETH_P_IEEEPUPAT 0x0a01
28#define ETH_P_BATMAN 0x4305
29#define ETH_P_DEC 0x6000
30#define ETH_P_DNA_DL 0x6001
31#define ETH_P_DNA_RC 0x6002
32#define ETH_P_DNA_RT 0x6003
33#define ETH_P_LAT 0x6004
34#define ETH_P_DIAG 0x6005
35#define ETH_P_CUST 0x6006
36#define ETH_P_SCA 0x6007
37#define ETH_P_TEB 0x6558
38#define ETH_P_RARP 0x8035
39#define ETH_P_ATALK 0x809B
40#define ETH_P_AARP 0x80F3
41#define ETH_P_8021Q 0x8100
42#define ETH_P_IPX 0x8137
43#define ETH_P_IPV6 0x86DD
44#define ETH_P_PAUSE 0x8808
45#define ETH_P_SLOW 0x8809
46#define ETH_P_WCCP 0x883E
47#define ETH_P_MPLS_UC 0x8847
48#define ETH_P_MPLS_MC 0x8848
49#define ETH_P_ATMMPOA 0x884c
50#define ETH_P_PPP_DISC 0x8863
51#define ETH_P_PPP_SES 0x8864
52#define ETH_P_LINK_CTL 0x886c
53#define ETH_P_ATMFATE 0x8884
54#define ETH_P_PAE 0x888E
55#define ETH_P_AOE 0x88A2
56#define ETH_P_8021AD 0x88A8
57#define ETH_P_802_EX1 0x88B5
58#define ETH_P_ERSPAN 0x88BE
59#define ETH_P_PREAUTH 0x88C7
60#define ETH_P_TIPC 0x88CA
61#define ETH_P_LLDP 0x88CC
62#define ETH_P_MRP 0x88E3
63#define ETH_P_MACSEC 0x88E5
64#define ETH_P_8021AH 0x88E7
65#define ETH_P_MVRP 0x88F5
66#define ETH_P_1588 0x88F7
67#define ETH_P_NCSI 0x88F8
68#define ETH_P_PRP 0x88FB
69#define ETH_P_CFM 0x8902
70#define ETH_P_FCOE 0x8906
71#define ETH_P_TDLS 0x890D
72#define ETH_P_FIP 0x8914
73#define ETH_P_IBOE 0x8915
74#define ETH_P_80221 0x8917
75#define ETH_P_HSR 0x892F
76#define ETH_P_NSH 0x894F
77#define ETH_P_LOOPBACK 0x9000
78#define ETH_P_QINQ1 0x9100
79#define ETH_P_QINQ2 0x9200
80#define ETH_P_QINQ3 0x9300
81#define ETH_P_EDSA 0xDADA
82#define ETH_P_DSA_8021Q 0xDADB
83#define ETH_P_IFE 0xED3E
84#define ETH_P_AF_IUCV 0xFBFB
85
86#define ETH_P_802_3_MIN 0x0600
87
88#define ETH_P_802_3 0x0001
89#define ETH_P_AX25 0x0002
90#define ETH_P_ALL 0x0003
91#define ETH_P_802_2 0x0004
92#define ETH_P_SNAP 0x0005
93#define ETH_P_DDCMP 0x0006
94#define ETH_P_WAN_PPP 0x0007
95#define ETH_P_PPP_MP 0x0008
96#define ETH_P_LOCALTALK 0x0009
97#define ETH_P_CAN 0x000C
98#define ETH_P_CANFD 0x000D
99#define ETH_P_PPPTALK 0x0010
100#define ETH_P_TR_802_2 0x0011
101#define ETH_P_MOBITEX 0x0015
102#define ETH_P_CONTROL 0x0016
103#define ETH_P_IRDA 0x0017
104#define ETH_P_ECONET 0x0018
105#define ETH_P_HDLC 0x0019
106#define ETH_P_ARCNET 0x001A
107#define ETH_P_DSA 0x001B
108#define ETH_P_TRAILER 0x001C
109#define ETH_P_PHONET 0x00F5
110#define ETH_P_IEEE802154 0x00F6
111#define ETH_P_CAIF 0x00F7
112#define ETH_P_XDSA 0x00F8
113#define ETH_P_MAP 0x00F9
114
115struct ethhdr {
116 uint8_t h_dest[ETH_ALEN];
117 uint8_t h_source[ETH_ALEN];
118 uint16_t h_proto;
119};
120
121#include <net/ethernet.h>
122#include <net/if_arp.h>
123
124struct ether_arp {
125 struct arphdr ea_hdr;
126 uint8_t arp_sha[ETH_ALEN];
127 uint8_t arp_spa[4];
128 uint8_t arp_tha[ETH_ALEN];
129 uint8_t arp_tpa[4];
130};
131#define arp_hrd ea_hdr.ar_hrd
132#define arp_pro ea_hdr.ar_pro
133#define arp_hln ea_hdr.ar_hln
134#define arp_pln ea_hdr.ar_pln
135#define arp_op ea_hdr.ar_op
136
137#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \
138do { \
139 (enaddr)[0] = 0x01; \
140 (enaddr)[1] = 0x00; \
141 (enaddr)[2] = 0x5e; \
142 (enaddr)[3] = ((uint8_t *)ipaddr)[1] & 0x7f; \
143 (enaddr)[4] = ((uint8_t *)ipaddr)[2]; \
144 (enaddr)[5] = ((uint8_t *)ipaddr)[3]; \
145} while(0)
146
147#define __UAPI_DEF_ETHHDR 0
148
149#endif
lib/libc/wasi/libc-top-half/musl/include/paths.h deleted-31
......@@ -1,31 +0,0 @@
1#ifndef _PATHS_H
2#define _PATHS_H
3
4#define _PATH_DEFPATH "/usr/local/bin:/bin:/usr/bin"
5#define _PATH_STDPATH "/bin:/usr/bin:/sbin:/usr/sbin"
6
7#define _PATH_BSHELL "/bin/sh"
8#define _PATH_CONSOLE "/dev/console"
9#define _PATH_DEVNULL "/dev/null"
10#define _PATH_KLOG "/proc/kmsg"
11#define _PATH_LASTLOG "/var/log/lastlog"
12#define _PATH_MAILDIR "/var/mail"
13#define _PATH_MAN "/usr/share/man"
14#define _PATH_MNTTAB "/etc/fstab"
15#define _PATH_MOUNTED "/etc/mtab"
16#define _PATH_NOLOGIN "/etc/nologin"
17#define _PATH_SENDMAIL "/usr/sbin/sendmail"
18#define _PATH_SHADOW "/etc/shadow"
19#define _PATH_SHELLS "/etc/shells"
20#define _PATH_TTY "/dev/tty"
21#define _PATH_UTMP "/dev/null/utmp"
22#define _PATH_VI "/usr/bin/vi"
23#define _PATH_WTMP "/dev/null/wtmp"
24
25#define _PATH_DEV "/dev/"
26#define _PATH_TMP "/tmp/"
27#define _PATH_VARDB "/var/lib/misc/"
28#define _PATH_VARRUN "/var/run/"
29#define _PATH_VARTMP "/var/tmp/"
30
31#endif
lib/libc/wasi/libc-top-half/musl/include/pthread.h deleted-250
......@@ -1,250 +0,0 @@
1#ifndef _PTHREAD_H
2#define _PTHREAD_H
3#ifdef __cplusplus
4extern "C" {
5#endif
6
7#include <features.h>
8
9#define __NEED_time_t
10#define __NEED_clockid_t
11#define __NEED_struct_timespec
12#define __NEED_sigset_t
13#define __NEED_pthread_t
14#define __NEED_pthread_attr_t
15#define __NEED_pthread_mutexattr_t
16#define __NEED_pthread_condattr_t
17#define __NEED_pthread_rwlockattr_t
18#define __NEED_pthread_barrierattr_t
19#define __NEED_pthread_mutex_t
20#define __NEED_pthread_cond_t
21#define __NEED_pthread_rwlock_t
22#define __NEED_pthread_barrier_t
23#define __NEED_pthread_spinlock_t
24#define __NEED_pthread_key_t
25#define __NEED_pthread_once_t
26#define __NEED_size_t
27
28#include <bits/alltypes.h>
29
30#include <sched.h>
31#include <time.h>
32
33#define PTHREAD_CREATE_JOINABLE 0
34#define PTHREAD_CREATE_DETACHED 1
35
36#define PTHREAD_MUTEX_NORMAL 0
37#define PTHREAD_MUTEX_DEFAULT 0
38#define PTHREAD_MUTEX_RECURSIVE 1
39#define PTHREAD_MUTEX_ERRORCHECK 2
40
41#define PTHREAD_MUTEX_STALLED 0
42#define PTHREAD_MUTEX_ROBUST 1
43
44#define PTHREAD_PRIO_NONE 0
45#define PTHREAD_PRIO_INHERIT 1
46#define PTHREAD_PRIO_PROTECT 2
47
48#define PTHREAD_INHERIT_SCHED 0
49#define PTHREAD_EXPLICIT_SCHED 1
50
51#define PTHREAD_SCOPE_SYSTEM 0
52#define PTHREAD_SCOPE_PROCESS 1
53
54#define PTHREAD_PROCESS_PRIVATE 0
55#define PTHREAD_PROCESS_SHARED 1
56
57
58#define PTHREAD_MUTEX_INITIALIZER {{{0}}}
59#define PTHREAD_RWLOCK_INITIALIZER {{{0}}}
60#define PTHREAD_COND_INITIALIZER {{{0}}}
61#define PTHREAD_ONCE_INIT 0
62
63
64#define PTHREAD_CANCEL_ENABLE 0
65#define PTHREAD_CANCEL_DISABLE 1
66#define PTHREAD_CANCEL_MASKED 2
67
68#define PTHREAD_CANCEL_DEFERRED 0
69#define PTHREAD_CANCEL_ASYNCHRONOUS 1
70
71#define PTHREAD_CANCELED ((void *)-1)
72
73
74#define PTHREAD_BARRIER_SERIAL_THREAD (-1)
75
76
77#define PTHREAD_NULL ((pthread_t)0)
78
79
80int pthread_create(pthread_t *__restrict, const pthread_attr_t *__restrict, void *(*)(void *), void *__restrict);
81int pthread_detach(pthread_t);
82#ifdef __wasilibc_unmodified_upstream
83_Noreturn void pthread_exit(void *);
84#endif
85int pthread_join(pthread_t, void **);
86
87#ifdef __GNUC__
88__attribute__((const))
89#endif
90pthread_t pthread_self(void);
91
92int pthread_equal(pthread_t, pthread_t);
93#ifndef __cplusplus
94#define pthread_equal(x,y) ((x)==(y))
95#endif
96
97int pthread_setcancelstate(int, int *);
98int pthread_setcanceltype(int, int *);
99void pthread_testcancel(void);
100int pthread_cancel(pthread_t);
101
102#ifdef __wasilibc_unmodified_upstream /* WASI has no CPU scheduling support. */
103int pthread_getschedparam(pthread_t, int *__restrict, struct sched_param *__restrict);
104int pthread_setschedparam(pthread_t, int, const struct sched_param *);
105#endif
106int pthread_setschedprio(pthread_t, int);
107
108int pthread_once(pthread_once_t *, void (*)(void));
109
110int pthread_mutex_init(pthread_mutex_t *__restrict, const pthread_mutexattr_t *__restrict);
111int pthread_mutex_lock(pthread_mutex_t *);
112int pthread_mutex_unlock(pthread_mutex_t *);
113int pthread_mutex_trylock(pthread_mutex_t *);
114int pthread_mutex_timedlock(pthread_mutex_t *__restrict, const struct timespec *__restrict);
115int pthread_mutex_destroy(pthread_mutex_t *);
116int pthread_mutex_consistent(pthread_mutex_t *);
117
118int pthread_mutex_getprioceiling(const pthread_mutex_t *__restrict, int *__restrict);
119int pthread_mutex_setprioceiling(pthread_mutex_t *__restrict, int, int *__restrict);
120
121int pthread_cond_init(pthread_cond_t *__restrict, const pthread_condattr_t *__restrict);
122int pthread_cond_destroy(pthread_cond_t *);
123int pthread_cond_wait(pthread_cond_t *__restrict, pthread_mutex_t *__restrict);
124int pthread_cond_timedwait(pthread_cond_t *__restrict, pthread_mutex_t *__restrict, const struct timespec *__restrict);
125int pthread_cond_broadcast(pthread_cond_t *);
126int pthread_cond_signal(pthread_cond_t *);
127
128int pthread_rwlock_init(pthread_rwlock_t *__restrict, const pthread_rwlockattr_t *__restrict);
129int pthread_rwlock_destroy(pthread_rwlock_t *);
130int pthread_rwlock_rdlock(pthread_rwlock_t *);
131int pthread_rwlock_tryrdlock(pthread_rwlock_t *);
132int pthread_rwlock_timedrdlock(pthread_rwlock_t *__restrict, const struct timespec *__restrict);
133int pthread_rwlock_wrlock(pthread_rwlock_t *);
134int pthread_rwlock_trywrlock(pthread_rwlock_t *);
135int pthread_rwlock_timedwrlock(pthread_rwlock_t *__restrict, const struct timespec *__restrict);
136int pthread_rwlock_unlock(pthread_rwlock_t *);
137
138int pthread_spin_init(pthread_spinlock_t *, int);
139int pthread_spin_destroy(pthread_spinlock_t *);
140int pthread_spin_lock(pthread_spinlock_t *);
141int pthread_spin_trylock(pthread_spinlock_t *);
142int pthread_spin_unlock(pthread_spinlock_t *);
143
144int pthread_barrier_init(pthread_barrier_t *__restrict, const pthread_barrierattr_t *__restrict, unsigned);
145int pthread_barrier_destroy(pthread_barrier_t *);
146int pthread_barrier_wait(pthread_barrier_t *);
147
148int pthread_key_create(pthread_key_t *, void (*)(void *));
149int pthread_key_delete(pthread_key_t);
150void *pthread_getspecific(pthread_key_t);
151int pthread_setspecific(pthread_key_t, const void *);
152
153int pthread_attr_init(pthread_attr_t *);
154int pthread_attr_destroy(pthread_attr_t *);
155
156int pthread_attr_getguardsize(const pthread_attr_t *__restrict, size_t *__restrict);
157int pthread_attr_setguardsize(pthread_attr_t *, size_t);
158int pthread_attr_getstacksize(const pthread_attr_t *__restrict, size_t *__restrict);
159int pthread_attr_setstacksize(pthread_attr_t *, size_t);
160int pthread_attr_getdetachstate(const pthread_attr_t *, int *);
161int pthread_attr_setdetachstate(pthread_attr_t *, int);
162int pthread_attr_getstack(const pthread_attr_t *__restrict, void **__restrict, size_t *__restrict);
163int pthread_attr_setstack(pthread_attr_t *, void *, size_t);
164int pthread_attr_getscope(const pthread_attr_t *__restrict, int *__restrict);
165int pthread_attr_setscope(pthread_attr_t *, int);
166int pthread_attr_getschedpolicy(const pthread_attr_t *__restrict, int *__restrict);
167int pthread_attr_setschedpolicy(pthread_attr_t *, int);
168#ifdef __wasilibc_unmodified_upstream /* WASI has no CPU scheduling support. */
169int pthread_attr_getschedparam(const pthread_attr_t *__restrict, struct sched_param *__restrict);
170int pthread_attr_setschedparam(pthread_attr_t *__restrict, const struct sched_param *__restrict);
171#endif
172int pthread_attr_getinheritsched(const pthread_attr_t *__restrict, int *__restrict);
173int pthread_attr_setinheritsched(pthread_attr_t *, int);
174
175int pthread_mutexattr_destroy(pthread_mutexattr_t *);
176int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *__restrict, int *__restrict);
177int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *__restrict, int *__restrict);
178int pthread_mutexattr_getpshared(const pthread_mutexattr_t *__restrict, int *__restrict);
179int pthread_mutexattr_getrobust(const pthread_mutexattr_t *__restrict, int *__restrict);
180int pthread_mutexattr_gettype(const pthread_mutexattr_t *__restrict, int *__restrict);
181int pthread_mutexattr_init(pthread_mutexattr_t *);
182int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int);
183int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int);
184int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int);
185int pthread_mutexattr_setrobust(pthread_mutexattr_t *, int);
186int pthread_mutexattr_settype(pthread_mutexattr_t *, int);
187
188int pthread_condattr_init(pthread_condattr_t *);
189int pthread_condattr_destroy(pthread_condattr_t *);
190int pthread_condattr_setclock(pthread_condattr_t *, clockid_t);
191int pthread_condattr_setpshared(pthread_condattr_t *, int);
192int pthread_condattr_getclock(const pthread_condattr_t *__restrict, clockid_t *__restrict);
193int pthread_condattr_getpshared(const pthread_condattr_t *__restrict, int *__restrict);
194
195int pthread_rwlockattr_init(pthread_rwlockattr_t *);
196int pthread_rwlockattr_destroy(pthread_rwlockattr_t *);
197int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int);
198int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *__restrict, int *__restrict);
199
200int pthread_barrierattr_destroy(pthread_barrierattr_t *);
201int pthread_barrierattr_getpshared(const pthread_barrierattr_t *__restrict, int *__restrict);
202int pthread_barrierattr_init(pthread_barrierattr_t *);
203int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int);
204
205int pthread_atfork(void (*)(void), void (*)(void), void (*)(void));
206
207int pthread_getconcurrency(void);
208int pthread_setconcurrency(int);
209
210int pthread_getcpuclockid(pthread_t, clockid_t *);
211
212struct __ptcb {
213 void (*__f)(void *);
214 void *__x;
215 struct __ptcb *__next;
216};
217
218void _pthread_cleanup_push(struct __ptcb *, void (*)(void *), void *);
219void _pthread_cleanup_pop(struct __ptcb *, int);
220
221#define pthread_cleanup_push(f, x) do { struct __ptcb __cb; _pthread_cleanup_push(&__cb, f, x);
222#define pthread_cleanup_pop(r) _pthread_cleanup_pop(&__cb, (r)); } while(0)
223
224#ifdef _GNU_SOURCE
225struct cpu_set_t;
226int pthread_getaffinity_np(pthread_t, size_t, struct cpu_set_t *);
227int pthread_setaffinity_np(pthread_t, size_t, const struct cpu_set_t *);
228int pthread_getattr_np(pthread_t, pthread_attr_t *);
229int pthread_setname_np(pthread_t, const char *);
230int pthread_getname_np(pthread_t, char *, size_t);
231int pthread_getattr_default_np(pthread_attr_t *);
232int pthread_setattr_default_np(const pthread_attr_t *);
233int pthread_tryjoin_np(pthread_t, void **);
234int pthread_timedjoin_np(pthread_t, void **, const struct timespec *);
235#endif
236
237#if _REDIR_TIME64
238__REDIR(pthread_mutex_timedlock, __pthread_mutex_timedlock_time64);
239__REDIR(pthread_cond_timedwait, __pthread_cond_timedwait_time64);
240__REDIR(pthread_rwlock_timedrdlock, __pthread_rwlock_timedrdlock_time64);
241__REDIR(pthread_rwlock_timedwrlock, __pthread_rwlock_timedwrlock_time64);
242#ifdef _GNU_SOURCE
243__REDIR(pthread_timedjoin_np, __pthread_timedjoin_np_time64);
244#endif
245#endif
246
247#ifdef __cplusplus
248}
249#endif
250#endif
lib/libc/wasi/libc-top-half/musl/include/pty.h deleted-18
......@@ -1,18 +0,0 @@
1#ifndef _PTY_H
2#define _PTY_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <termios.h>
9#include <sys/ioctl.h>
10
11int openpty(int *, int *, char *, const struct termios *, const struct winsize *);
12int forkpty(int *, char *, const struct termios *, const struct winsize *);
13
14#ifdef __cplusplus
15}
16#endif
17
18#endif
lib/libc/wasi/libc-top-half/musl/include/pwd.h deleted-50
......@@ -1,50 +0,0 @@
1#ifndef _PWD_H
2#define _PWD_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <features.h>
9
10#define __NEED_size_t
11#define __NEED_uid_t
12#define __NEED_gid_t
13
14#ifdef _GNU_SOURCE
15#define __NEED_FILE
16#endif
17
18#include <bits/alltypes.h>
19
20struct passwd {
21 char *pw_name;
22 char *pw_passwd;
23 uid_t pw_uid;
24 gid_t pw_gid;
25 char *pw_gecos;
26 char *pw_dir;
27 char *pw_shell;
28};
29
30#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
31void setpwent (void);
32void endpwent (void);
33struct passwd *getpwent (void);
34#endif
35
36struct passwd *getpwuid (uid_t);
37struct passwd *getpwnam (const char *);
38int getpwuid_r (uid_t, struct passwd *, char *, size_t, struct passwd **);
39int getpwnam_r (const char *, struct passwd *, char *, size_t, struct passwd **);
40
41#ifdef _GNU_SOURCE
42struct passwd *fgetpwent(FILE *);
43int putpwent(const struct passwd *, FILE *);
44#endif
45
46#ifdef __cplusplus
47}
48#endif
49
50#endif
lib/libc/wasi/libc-top-half/musl/include/resolv.h deleted-142
......@@ -1,142 +0,0 @@
1#ifndef _RESOLV_H
2#define _RESOLV_H
3
4#include <stdint.h>
5#include <arpa/nameser.h>
6#include <netinet/in.h>
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12#define MAXNS 3
13#define MAXDFLSRCH 3
14#define MAXDNSRCH 6
15#define LOCALDOMAINPARTS 2
16
17#define RES_TIMEOUT 5
18#define MAXRESOLVSORT 10
19#define RES_MAXNDOTS 15
20#define RES_MAXRETRANS 30
21#define RES_MAXRETRY 5
22#define RES_DFLRETRY 2
23#define RES_MAXTIME 65535
24
25/* unused; purely for broken apps */
26typedef struct __res_state {
27 int retrans;
28 int retry;
29 unsigned long options;
30 int nscount;
31 struct sockaddr_in nsaddr_list[MAXNS];
32# define nsaddr nsaddr_list[0]
33 unsigned short id;
34 char *dnsrch[MAXDNSRCH+1];
35 char defdname[256];
36 unsigned long pfcode;
37 unsigned ndots:4;
38 unsigned nsort:4;
39 unsigned ipv6_unavail:1;
40 unsigned unused:23;
41 struct {
42 struct in_addr addr;
43 uint32_t mask;
44 } sort_list[MAXRESOLVSORT];
45 void *qhook;
46 void *rhook;
47 int res_h_errno;
48 int _vcsock;
49 unsigned _flags;
50 union {
51 char pad[52];
52 struct {
53 uint16_t nscount;
54 uint16_t nsmap[MAXNS];
55 int nssocks[MAXNS];
56 uint16_t nscount6;
57 uint16_t nsinit;
58 struct sockaddr_in6 *nsaddrs[MAXNS];
59 unsigned int _initstamp[2];
60 } _ext;
61 } _u;
62} *res_state;
63
64#define __RES 19960801
65
66#ifndef _PATH_RESCONF
67#define _PATH_RESCONF "/etc/resolv.conf"
68#endif
69
70struct res_sym {
71 int number;
72 char *name;
73 char *humanname;
74};
75
76#define RES_F_VC 0x00000001
77#define RES_F_CONN 0x00000002
78#define RES_F_EDNS0ERR 0x00000004
79
80#define RES_EXHAUSTIVE 0x00000001
81
82#define RES_INIT 0x00000001
83#define RES_DEBUG 0x00000002
84#define RES_AAONLY 0x00000004
85#define RES_USEVC 0x00000008
86#define RES_PRIMARY 0x00000010
87#define RES_IGNTC 0x00000020
88#define RES_RECURSE 0x00000040
89#define RES_DEFNAMES 0x00000080
90#define RES_STAYOPEN 0x00000100
91#define RES_DNSRCH 0x00000200
92#define RES_INSECURE1 0x00000400
93#define RES_INSECURE2 0x00000800
94#define RES_NOALIASES 0x00001000
95#define RES_USE_INET6 0x00002000
96#define RES_ROTATE 0x00004000
97#define RES_NOCHECKNAME 0x00008000
98#define RES_KEEPTSIG 0x00010000
99#define RES_BLAST 0x00020000
100#define RES_USEBSTRING 0x00040000
101#define RES_NOIP6DOTINT 0x00080000
102#define RES_USE_EDNS0 0x00100000
103#define RES_SNGLKUP 0x00200000
104#define RES_SNGLKUPREOP 0x00400000
105#define RES_USE_DNSSEC 0x00800000
106
107#define RES_DEFAULT (RES_RECURSE|RES_DEFNAMES|RES_DNSRCH|RES_NOIP6DOTINT)
108
109#define RES_PRF_STATS 0x00000001
110#define RES_PRF_UPDATE 0x00000002
111#define RES_PRF_CLASS 0x00000004
112#define RES_PRF_CMD 0x00000008
113#define RES_PRF_QUES 0x00000010
114#define RES_PRF_ANS 0x00000020
115#define RES_PRF_AUTH 0x00000040
116#define RES_PRF_ADD 0x00000080
117#define RES_PRF_HEAD1 0x00000100
118#define RES_PRF_HEAD2 0x00000200
119#define RES_PRF_TTLID 0x00000400
120#define RES_PRF_HEADX 0x00000800
121#define RES_PRF_QUERY 0x00001000
122#define RES_PRF_REPLY 0x00002000
123#define RES_PRF_INIT 0x00004000
124
125struct __res_state *__res_state(void);
126#define _res (*__res_state())
127
128int res_init(void);
129int res_query(const char *, int, int, unsigned char *, int);
130int res_querydomain(const char *, const char *, int, int, unsigned char *, int);
131int res_search(const char *, int, int, unsigned char *, int);
132int res_mkquery(int, const char *, int, int, const unsigned char *, int, const unsigned char*, unsigned char *, int);
133int res_send(const unsigned char *, int, unsigned char *, int);
134int dn_comp(const char *, unsigned char *, int, unsigned char **, unsigned char **);
135int dn_expand(const unsigned char *, const unsigned char *, const unsigned char *, char *, int);
136int dn_skipname(const unsigned char *, const unsigned char *);
137
138#ifdef __cplusplus
139}
140#endif
141
142#endif
lib/libc/wasi/libc-top-half/musl/include/scsi/scsi.h deleted-150
......@@ -1,150 +0,0 @@
1#ifndef _SCSI_SCSI_H
2#define _SCSI_SCSI_H
3
4#define TEST_UNIT_READY 0x00
5#define REZERO_UNIT 0x01
6#define REQUEST_SENSE 0x03
7#define FORMAT_UNIT 0x04
8#define READ_BLOCK_LIMITS 0x05
9#define REASSIGN_BLOCKS 0x07
10#define READ_6 0x08
11#define WRITE_6 0x0a
12#define SEEK_6 0x0b
13#define READ_REVERSE 0x0f
14#define WRITE_FILEMARKS 0x10
15#define SPACE 0x11
16#define INQUIRY 0x12
17#define RECOVER_BUFFERED_DATA 0x14
18#define MODE_SELECT 0x15
19#define RESERVE 0x16
20#define RELEASE 0x17
21#define COPY 0x18
22#define ERASE 0x19
23#define MODE_SENSE 0x1a
24#define START_STOP 0x1b
25#define RECEIVE_DIAGNOSTIC 0x1c
26#define SEND_DIAGNOSTIC 0x1d
27#define ALLOW_MEDIUM_REMOVAL 0x1e
28#define SET_WINDOW 0x24
29#define READ_CAPACITY 0x25
30#define READ_10 0x28
31#define WRITE_10 0x2a
32#define SEEK_10 0x2b
33#define WRITE_VERIFY 0x2e
34#define VERIFY 0x2f
35#define SEARCH_HIGH 0x30
36#define SEARCH_EQUAL 0x31
37#define SEARCH_LOW 0x32
38#define SET_LIMITS 0x33
39#define PRE_FETCH 0x34
40#define READ_POSITION 0x34
41#define SYNCHRONIZE_CACHE 0x35
42#define LOCK_UNLOCK_CACHE 0x36
43#define READ_DEFECT_DATA 0x37
44#define MEDIUM_SCAN 0x38
45#define COMPARE 0x39
46#define COPY_VERIFY 0x3a
47#define WRITE_BUFFER 0x3b
48#define READ_BUFFER 0x3c
49#define UPDATE_BLOCK 0x3d
50#define READ_LONG 0x3e
51#define WRITE_LONG 0x3f
52#define CHANGE_DEFINITION 0x40
53#define WRITE_SAME 0x41
54#define READ_TOC 0x43
55#define LOG_SELECT 0x4c
56#define LOG_SENSE 0x4d
57#define MODE_SELECT_10 0x55
58#define RESERVE_10 0x56
59#define RELEASE_10 0x57
60#define MODE_SENSE_10 0x5a
61#define PERSISTENT_RESERVE_IN 0x5e
62#define PERSISTENT_RESERVE_OUT 0x5f
63#define MOVE_MEDIUM 0xa5
64#define READ_12 0xa8
65#define WRITE_12 0xaa
66#define WRITE_VERIFY_12 0xae
67#define SEARCH_HIGH_12 0xb0
68#define SEARCH_EQUAL_12 0xb1
69#define SEARCH_LOW_12 0xb2
70#define READ_ELEMENT_STATUS 0xb8
71#define SEND_VOLUME_TAG 0xb6
72#define WRITE_LONG_2 0xea
73#define GOOD 0x00
74#define CHECK_CONDITION 0x01
75#define CONDITION_GOOD 0x02
76#define BUSY 0x04
77#define INTERMEDIATE_GOOD 0x08
78#define INTERMEDIATE_C_GOOD 0x0a
79#define RESERVATION_CONFLICT 0x0c
80#define COMMAND_TERMINATED 0x11
81#define QUEUE_FULL 0x14
82#define STATUS_MASK 0x3e
83#define NO_SENSE 0x00
84#define RECOVERED_ERROR 0x01
85#define NOT_READY 0x02
86#define MEDIUM_ERROR 0x03
87#define HARDWARE_ERROR 0x04
88#define ILLEGAL_REQUEST 0x05
89#define UNIT_ATTENTION 0x06
90#define DATA_PROTECT 0x07
91#define BLANK_CHECK 0x08
92#define COPY_ABORTED 0x0a
93#define ABORTED_COMMAND 0x0b
94#define VOLUME_OVERFLOW 0x0d
95#define MISCOMPARE 0x0e
96#define TYPE_DISK 0x00
97#define TYPE_TAPE 0x01
98#define TYPE_PROCESSOR 0x03
99#define TYPE_WORM 0x04
100#define TYPE_ROM 0x05
101#define TYPE_SCANNER 0x06
102#define TYPE_MOD 0x07
103#define TYPE_MEDIUM_CHANGER 0x08
104#define TYPE_ENCLOSURE 0x0d
105#define TYPE_NO_LUN 0x7f
106#define COMMAND_COMPLETE 0x00
107#define EXTENDED_MESSAGE 0x01
108#define EXTENDED_MODIFY_DATA_POINTER 0x00
109#define EXTENDED_SDTR 0x01
110#define EXTENDED_EXTENDED_IDENTIFY 0x02
111#define EXTENDED_WDTR 0x03
112#define SAVE_POINTERS 0x02
113#define RESTORE_POINTERS 0x03
114#define DISCONNECT 0x04
115#define INITIATOR_ERROR 0x05
116#define ABORT 0x06
117#define MESSAGE_REJECT 0x07
118#define NOP 0x08
119#define MSG_PARITY_ERROR 0x09
120#define LINKED_CMD_COMPLETE 0x0a
121#define LINKED_FLG_CMD_COMPLETE 0x0b
122#define BUS_DEVICE_RESET 0x0c
123#define INITIATE_RECOVERY 0x0f
124#define RELEASE_RECOVERY 0x10
125#define SIMPLE_QUEUE_TAG 0x20
126#define HEAD_OF_QUEUE_TAG 0x21
127#define ORDERED_QUEUE_TAG 0x22
128#define SCSI_IOCTL_GET_IDLUN 0x5382
129#define SCSI_IOCTL_TAGGED_ENABLE 0x5383
130#define SCSI_IOCTL_TAGGED_DISABLE 0x5384
131#define SCSI_IOCTL_PROBE_HOST 0x5385
132#define SCSI_IOCTL_GET_BUS_NUMBER 0x5386
133
134struct ccs_modesel_head {
135 unsigned char _r1;
136 unsigned char medium;
137 unsigned char _r2;
138 unsigned char block_desc_length;
139 unsigned char density;
140 unsigned char number_blocks_hi;
141 unsigned char number_blocks_med;
142 unsigned char number_blocks_lo;
143 unsigned char _r3;
144 unsigned char block_length_hi;
145 unsigned char block_length_med;
146 unsigned char block_length_lo;
147};
148
149#endif
150
lib/libc/wasi/libc-top-half/musl/include/scsi/scsi_ioctl.h deleted-11
......@@ -1,11 +0,0 @@
1#ifndef _SCSI_IOCTL_H
2#define _SCSI_IOCTL_H
3#define SCSI_IOCTL_SEND_COMMAND 1
4#define SCSI_IOCTL_TEST_UNIT_READY 2
5#define SCSI_IOCTL_BENCHMARK_COMMAND 3
6#define SCSI_IOCTL_SYNC 4
7#define SCSI_IOCTL_START_UNIT 5
8#define SCSI_IOCTL_STOP_UNIT 6
9#define SCSI_IOCTL_DOORLOCK 0x5380
10#define SCSI_IOCTL_DOORUNLOCK 0x5381
11#endif
lib/libc/wasi/libc-top-half/musl/include/scsi/sg.h deleted-129
......@@ -1,129 +0,0 @@
1#ifndef _SCSI_SG_H
2#define _SCSI_SG_H
3
4#define SG_DXFER_NONE -1
5#define SG_DXFER_TO_DEV -2
6#define SG_DXFER_FROM_DEV -3
7#define SG_DXFER_TO_FROM_DEV -4
8#define SG_FLAG_DIRECT_IO 1
9#define SG_FLAG_LUN_INHIBIT 2
10#define SG_FLAG_NO_DXFER 0x10000
11#define SG_INFO_OK_MASK 0x1
12#define SG_INFO_OK 0x0
13#define SG_INFO_CHECK 0x1
14#define SG_INFO_DIRECT_IO_MASK 0x6
15#define SG_INFO_INDIRECT_IO 0x0
16#define SG_INFO_DIRECT_IO 0x2
17#define SG_INFO_MIXED_IO 0x4
18#define SG_EMULATED_HOST 0x2203
19#define SG_SET_TRANSFORM 0x2204
20#define SG_GET_TRANSFORM 0x2205
21#define SG_SET_RESERVED_SIZE 0x2275
22#define SG_GET_RESERVED_SIZE 0x2272
23#define SG_GET_SCSI_ID 0x2276
24#define SG_SET_FORCE_LOW_DMA 0x2279
25#define SG_GET_LOW_DMA 0x227a
26#define SG_SET_FORCE_PACK_ID 0x227b
27#define SG_GET_PACK_ID 0x227c
28#define SG_GET_NUM_WAITING 0x227d
29#define SG_GET_SG_TABLESIZE 0x227F
30#define SG_GET_VERSION_NUM 0x2282
31#define SG_SCSI_RESET 0x2284
32#define SG_SCSI_RESET_NOTHING 0
33#define SG_SCSI_RESET_DEVICE 1
34#define SG_SCSI_RESET_BUS 2
35#define SG_SCSI_RESET_HOST 3
36#define SG_IO 0x2285
37#define SG_GET_REQUEST_TABLE 0x2286
38#define SG_SET_KEEP_ORPHAN 0x2287
39#define SG_GET_KEEP_ORPHAN 0x2288
40#define SG_SCATTER_SZ (8 * 4096)
41#define SG_DEFAULT_RETRIES 1
42#define SG_DEF_FORCE_LOW_DMA 0
43#define SG_DEF_FORCE_PACK_ID 0
44#define SG_DEF_KEEP_ORPHAN 0
45#define SG_DEF_RESERVED_SIZE SG_SCATTER_SZ
46#define SG_MAX_QUEUE 16
47#define SG_BIG_BUFF SG_DEF_RESERVED_SIZE
48#define SG_MAX_SENSE 16
49#define SG_SET_TIMEOUT 0x2201
50#define SG_GET_TIMEOUT 0x2202
51#define SG_GET_COMMAND_Q 0x2270
52#define SG_SET_COMMAND_Q 0x2271
53#define SG_SET_DEBUG 0x227e
54#define SG_NEXT_CMD_LEN 0x2283
55#define SG_DEFAULT_TIMEOUT (60*100) /* 60*HZ */
56#define SG_DEF_COMMAND_Q 0
57#define SG_DEF_UNDERRUN_FLAG 0
58
59typedef struct sg_iovec {
60 void *iov_base;
61 unsigned long iov_len;
62} sg_iovec_t;
63
64typedef struct sg_io_hdr {
65 int interface_id;
66 int dxfer_direction;
67 unsigned char cmd_len;
68 unsigned char mx_sb_len;
69 unsigned short iovec_count;
70 unsigned dxfer_len;
71 void *dxferp;
72 unsigned char *cmdp;
73 unsigned char *sbp;
74 unsigned timeout;
75 unsigned flags;
76 int pack_id;
77 void *usr_ptr;
78 unsigned char status;
79 unsigned char masked_status;
80 unsigned char msg_status;
81 unsigned char sb_len_wr;
82 unsigned short host_status;
83 unsigned short driver_status;
84 int resid;
85 unsigned int duration;
86 unsigned int info;
87} sg_io_hdr_t;
88
89struct sg_scsi_id {
90 int host_no;
91 int channel;
92 int scsi_id;
93 int lun;
94 int scsi_type;
95 short h_cmd_per_lun;
96 short d_queue_depth;
97 int unused[2];
98};
99
100typedef struct sg_req_info {
101 char req_state;
102 char orphan;
103 char sg_io_owned;
104 char problem;
105 int pack_id;
106 void *usr_ptr;
107 unsigned duration;
108 int unused;
109} sg_req_info_t;
110
111typedef struct sg_io_hdr Sg_io_hdr;
112typedef struct sg_io_vec Sg_io_vec;
113typedef struct sg_scsi_id Sg_scsi_id;
114typedef struct sg_req_info Sg_req_info;
115
116struct sg_header {
117 int pack_len;
118 int reply_len;
119 int pack_id;
120 int result;
121 unsigned twelve_byte:1;
122 unsigned target_status:5;
123 unsigned host_status:8;
124 unsigned driver_status:8;
125 unsigned other_flags:10;
126 unsigned char sense_buffer[SG_MAX_SENSE];
127};
128
129#endif
lib/libc/wasi/libc-top-half/musl/include/setjmp.h+6-4
......@@ -7,7 +7,12 @@ extern "C" {
77
88#include <features.h>
99
10#ifdef __wasilibc_unmodified_upstream /* WASI has no setjmp */
10#ifndef __wasilibc_unmodified_upstream
11/* WASI has no setjmp */
12#if !defined(__wasm_exception_handling__)
13#error Setjmp/longjmp support requires Exception handling support, which is [not yet standardized](https://github.com/WebAssembly/proposals?tab=readme-ov-file#phase-3---implementation-phase-cg--wg). To enable it, compile with `-mllvm -wasm-enable-sjlj` and use an engine that implements the Exception handling proposal.
14#endif
15#endif
1116#include <bits/setjmp.h>
1217
1318typedef struct __jmp_buf_tag {
......@@ -40,9 +45,6 @@ int setjmp (jmp_buf) __setjmp_attr;
4045_Noreturn void longjmp (jmp_buf, int);
4146
4247#define setjmp setjmp
43#else
44#warning setjmp is not yet implemented for WASI
45#endif
4648
4749#undef __setjmp_attr
4850
lib/libc/wasi/libc-top-half/musl/include/shadow.h deleted-44
......@@ -1,44 +0,0 @@
1#ifndef _SHADOW_H
2#define _SHADOW_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#define __NEED_FILE
9#define __NEED_size_t
10
11#include <bits/alltypes.h>
12
13#define SHADOW "/etc/shadow"
14
15struct spwd {
16 char *sp_namp;
17 char *sp_pwdp;
18 long sp_lstchg;
19 long sp_min;
20 long sp_max;
21 long sp_warn;
22 long sp_inact;
23 long sp_expire;
24 unsigned long sp_flag;
25};
26
27void setspent(void);
28void endspent(void);
29struct spwd *getspent(void);
30struct spwd *fgetspent(FILE *);
31struct spwd *sgetspent(const char *);
32int putspent(const struct spwd *, FILE *);
33
34struct spwd *getspnam(const char *);
35int getspnam_r(const char *, struct spwd *, char *, size_t, struct spwd **);
36
37int lckpwdf(void);
38int ulckpwdf(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif
lib/libc/wasi/libc-top-half/musl/include/spawn.h deleted-83
......@@ -1,83 +0,0 @@
1#ifndef _SPAWN_H
2#define _SPAWN_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <features.h>
9
10#define __NEED_mode_t
11#define __NEED_pid_t
12#define __NEED_sigset_t
13
14#include <bits/alltypes.h>
15
16struct sched_param;
17
18#define POSIX_SPAWN_RESETIDS 1
19#define POSIX_SPAWN_SETPGROUP 2
20#define POSIX_SPAWN_SETSIGDEF 4
21#define POSIX_SPAWN_SETSIGMASK 8
22#define POSIX_SPAWN_SETSCHEDPARAM 16
23#define POSIX_SPAWN_SETSCHEDULER 32
24#define POSIX_SPAWN_USEVFORK 64
25#define POSIX_SPAWN_SETSID 128
26
27typedef struct {
28 int __flags;
29 pid_t __pgrp;
30 sigset_t __def, __mask;
31 int __prio, __pol;
32 void *__fn;
33 char __pad[64-sizeof(void *)];
34} posix_spawnattr_t;
35
36typedef struct {
37 int __pad0[2];
38 void *__actions;
39 int __pad[16];
40} posix_spawn_file_actions_t;
41
42int posix_spawn(pid_t *__restrict, const char *__restrict, const posix_spawn_file_actions_t *,
43 const posix_spawnattr_t *__restrict, char *const *__restrict, char *const *__restrict);
44int posix_spawnp(pid_t *__restrict, const char *__restrict, const posix_spawn_file_actions_t *,
45 const posix_spawnattr_t *__restrict, char *const *__restrict, char *const *__restrict);
46
47int posix_spawnattr_init(posix_spawnattr_t *);
48int posix_spawnattr_destroy(posix_spawnattr_t *);
49
50int posix_spawnattr_setflags(posix_spawnattr_t *, short);
51int posix_spawnattr_getflags(const posix_spawnattr_t *__restrict, short *__restrict);
52
53int posix_spawnattr_setpgroup(posix_spawnattr_t *, pid_t);
54int posix_spawnattr_getpgroup(const posix_spawnattr_t *__restrict, pid_t *__restrict);
55
56int posix_spawnattr_setsigmask(posix_spawnattr_t *__restrict, const sigset_t *__restrict);
57int posix_spawnattr_getsigmask(const posix_spawnattr_t *__restrict, sigset_t *__restrict);
58
59int posix_spawnattr_setsigdefault(posix_spawnattr_t *__restrict, const sigset_t *__restrict);
60int posix_spawnattr_getsigdefault(const posix_spawnattr_t *__restrict, sigset_t *__restrict);
61
62int posix_spawnattr_setschedparam(posix_spawnattr_t *__restrict, const struct sched_param *__restrict);
63int posix_spawnattr_getschedparam(const posix_spawnattr_t *__restrict, struct sched_param *__restrict);
64int posix_spawnattr_setschedpolicy(posix_spawnattr_t *, int);
65int posix_spawnattr_getschedpolicy(const posix_spawnattr_t *__restrict, int *__restrict);
66
67int posix_spawn_file_actions_init(posix_spawn_file_actions_t *);
68int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *);
69
70int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *__restrict, int, const char *__restrict, int, mode_t);
71int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *, int);
72int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *, int, int);
73
74#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
75int posix_spawn_file_actions_addchdir_np(posix_spawn_file_actions_t *__restrict, const char *__restrict);
76int posix_spawn_file_actions_addfchdir_np(posix_spawn_file_actions_t *, int);
77#endif
78
79#ifdef __cplusplus
80}
81#endif
82
83#endif
lib/libc/wasi/libc-top-half/musl/include/stdarg.h deleted-21
......@@ -1,21 +0,0 @@
1#ifndef _STDARG_H
2#define _STDARG_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#define __NEED_va_list
9
10#include <bits/alltypes.h>
11
12#define va_start(v,l) __builtin_va_start(v,l)
13#define va_end(v) __builtin_va_end(v)
14#define va_arg(v,l) __builtin_va_arg(v,l)
15#define va_copy(d,s) __builtin_va_copy(d,s)
16
17#ifdef __cplusplus
18}
19#endif
20
21#endif
lib/libc/wasi/libc-top-half/musl/include/stddef.h deleted-27
......@@ -1,27 +0,0 @@
1#ifndef _STDDEF_H
2#define _STDDEF_H
3
4#if __cplusplus >= 201103L
5#define NULL nullptr
6#elif defined(__cplusplus)
7#define NULL 0L
8#else
9#define NULL ((void*)0)
10#endif
11
12#define __NEED_ptrdiff_t
13#define __NEED_size_t
14#define __NEED_wchar_t
15#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L
16#define __NEED_max_align_t
17#endif
18
19#include <bits/alltypes.h>
20
21#if __GNUC__ > 3
22#define offsetof(type, member) __builtin_offsetof(type, member)
23#else
24#define offsetof(type, member) ((size_t)( (char *)&(((type *)0)->member) - (char *)0 ))
25#endif
26
27#endif
lib/libc/wasi/libc-top-half/musl/include/stdlib.h-2
......@@ -128,9 +128,7 @@ int rand_r (unsigned *);
128128
129129#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
130130 || defined(_BSD_SOURCE)
131#ifdef __wasilibc_unmodified_upstream /* WASI has no absolute paths */
132131char *realpath (const char *__restrict, char *__restrict);
133#endif
134132long int random (void);
135133void srandom (unsigned int);
136134char *initstate (unsigned int, char *, size_t);
lib/libc/wasi/libc-top-half/musl/include/sys/acct.h deleted-72
......@@ -1,72 +0,0 @@
1#ifndef _SYS_ACCT_H
2#define _SYS_ACCT_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <features.h>
9#include <time.h>
10#include <stdint.h>
11
12#define ACCT_COMM 16
13
14typedef uint16_t comp_t;
15
16struct acct {
17 char ac_flag;
18 uint16_t ac_uid;
19 uint16_t ac_gid;
20 uint16_t ac_tty;
21 uint32_t ac_btime;
22 comp_t ac_utime;
23 comp_t ac_stime;
24 comp_t ac_etime;
25 comp_t ac_mem;
26 comp_t ac_io;
27 comp_t ac_rw;
28 comp_t ac_minflt;
29 comp_t ac_majflt;
30 comp_t ac_swaps;
31 uint32_t ac_exitcode;
32 char ac_comm[ACCT_COMM+1];
33 char ac_pad[10];
34};
35
36
37struct acct_v3 {
38 char ac_flag;
39 char ac_version;
40 uint16_t ac_tty;
41 uint32_t ac_exitcode;
42 uint32_t ac_uid;
43 uint32_t ac_gid;
44 uint32_t ac_pid;
45 uint32_t ac_ppid;
46 uint32_t ac_btime;
47 float ac_etime;
48 comp_t ac_utime;
49 comp_t ac_stime;
50 comp_t ac_mem;
51 comp_t ac_io;
52 comp_t ac_rw;
53 comp_t ac_minflt;
54 comp_t ac_majflt;
55 comp_t ac_swaps;
56 char ac_comm[ACCT_COMM];
57};
58
59#define AFORK 1
60#define ASU 2
61#define ACORE 8
62#define AXSIG 16
63#define ACCT_BYTEORDER (128*(__BYTE_ORDER==__BIG_ENDIAN))
64#define AHZ 100
65
66int acct(const char *);
67
68#ifdef __cplusplus
69}
70#endif
71
72#endif
lib/libc/wasi/libc-top-half/musl/include/sys/auxv.h deleted-17
......@@ -1,17 +0,0 @@
1#ifndef _SYS_AUXV_H
2#define _SYS_AUXV_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <elf.h>
9#include <bits/hwcap.h>
10
11unsigned long getauxval(unsigned long);
12
13#ifdef __cplusplus
14}
15#endif
16
17#endif
lib/libc/wasi/libc-top-half/musl/include/sys/cachectl.h deleted-22
......@@ -1,22 +0,0 @@
1#ifndef _SYS_CACHECTL_H
2#define _SYS_CACHECTL_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#define ICACHE (1<<0)
9#define DCACHE (1<<1)
10#define BCACHE (ICACHE|DCACHE)
11#define CACHEABLE 0
12#define UNCACHEABLE 1
13
14int cachectl(void *, int, int);
15int cacheflush(void *, int, int);
16int _flush_cache(void *, int, int);
17
18#ifdef __cplusplus
19}
20#endif
21
22#endif
lib/libc/wasi/libc-top-half/musl/include/sys/epoll.h deleted-69
......@@ -1,69 +0,0 @@
1#ifndef _SYS_EPOLL_H
2#define _SYS_EPOLL_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <stdint.h>
9#include <sys/types.h>
10#include <fcntl.h>
11
12#define __NEED_sigset_t
13
14#include <bits/alltypes.h>
15
16#define EPOLL_CLOEXEC O_CLOEXEC
17#define EPOLL_NONBLOCK O_NONBLOCK
18
19enum EPOLL_EVENTS { __EPOLL_DUMMY };
20#define EPOLLIN 0x001
21#define EPOLLPRI 0x002
22#define EPOLLOUT 0x004
23#define EPOLLRDNORM 0x040
24#define EPOLLNVAL 0x020
25#define EPOLLRDBAND 0x080
26#define EPOLLWRNORM 0x100
27#define EPOLLWRBAND 0x200
28#define EPOLLMSG 0x400
29#define EPOLLERR 0x008
30#define EPOLLHUP 0x010
31#define EPOLLRDHUP 0x2000
32#define EPOLLEXCLUSIVE (1U<<28)
33#define EPOLLWAKEUP (1U<<29)
34#define EPOLLONESHOT (1U<<30)
35#define EPOLLET (1U<<31)
36
37#define EPOLL_CTL_ADD 1
38#define EPOLL_CTL_DEL 2
39#define EPOLL_CTL_MOD 3
40
41typedef union epoll_data {
42 void *ptr;
43 int fd;
44 uint32_t u32;
45 uint64_t u64;
46} epoll_data_t;
47
48struct epoll_event {
49 uint32_t events;
50 epoll_data_t data;
51}
52#ifdef __x86_64__
53__attribute__ ((__packed__))
54#endif
55;
56
57
58int epoll_create(int);
59int epoll_create1(int);
60int epoll_ctl(int, int, int, struct epoll_event *);
61int epoll_wait(int, struct epoll_event *, int, int);
62int epoll_pwait(int, struct epoll_event *, int, int, const sigset_t *);
63
64
65#ifdef __cplusplus
66}
67#endif
68
69#endif /* sys/epoll.h */
lib/libc/wasi/libc-top-half/musl/include/sys/fanotify.h deleted-111
......@@ -1,111 +0,0 @@
1#ifndef _FANOTIFY_H
2#define _FANOTIFY_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <sys/statfs.h>
9
10struct fanotify_event_metadata {
11 unsigned event_len;
12 unsigned char vers;
13 unsigned char reserved;
14 unsigned short metadata_len;
15 unsigned long long mask
16#ifdef __GNUC__
17 __attribute__((__aligned__(8)))
18#endif
19 ;
20 int fd;
21 int pid;
22};
23
24struct fanotify_event_info_header {
25 unsigned char info_type;
26 unsigned char pad;
27 unsigned short len;
28};
29
30struct fanotify_event_info_fid {
31 struct fanotify_event_info_header hdr;
32 fsid_t fsid;
33 unsigned char handle[];
34};
35
36struct fanotify_response {
37 int fd;
38 unsigned response;
39};
40
41#define FAN_ACCESS 0x01
42#define FAN_MODIFY 0x02
43#define FAN_ATTRIB 0x04
44#define FAN_CLOSE_WRITE 0x08
45#define FAN_CLOSE_NOWRITE 0x10
46#define FAN_OPEN 0x20
47#define FAN_MOVED_FROM 0x40
48#define FAN_MOVED_TO 0x80
49#define FAN_CREATE 0x100
50#define FAN_DELETE 0x200
51#define FAN_DELETE_SELF 0x400
52#define FAN_MOVE_SELF 0x800
53#define FAN_OPEN_EXEC 0x1000
54#define FAN_Q_OVERFLOW 0x4000
55#define FAN_OPEN_PERM 0x10000
56#define FAN_ACCESS_PERM 0x20000
57#define FAN_OPEN_EXEC_PERM 0x40000
58#define FAN_DIR_MODIFY 0x00080000
59#define FAN_EVENT_ON_CHILD 0x08000000
60#define FAN_ONDIR 0x40000000
61#define FAN_CLOSE (FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE)
62#define FAN_MOVE (FAN_MOVED_FROM | FAN_MOVED_TO)
63#define FAN_CLOEXEC 0x01
64#define FAN_NONBLOCK 0x02
65#define FAN_CLASS_NOTIF 0
66#define FAN_CLASS_CONTENT 0x04
67#define FAN_CLASS_PRE_CONTENT 0x08
68#define FAN_ALL_CLASS_BITS (FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | FAN_CLASS_PRE_CONTENT)
69#define FAN_UNLIMITED_QUEUE 0x10
70#define FAN_UNLIMITED_MARKS 0x20
71#define FAN_ENABLE_AUDIT 0x40
72#define FAN_REPORT_TID 0x100
73#define FAN_REPORT_FID 0x200
74#define FAN_REPORT_DIR_FID 0x00000400
75#define FAN_REPORT_NAME 0x00000800
76#define FAN_REPORT_DFID_NAME (FAN_REPORT_DIR_FID | FAN_REPORT_NAME)
77#define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK | FAN_ALL_CLASS_BITS | FAN_UNLIMITED_QUEUE | FAN_UNLIMITED_MARKS)
78#define FAN_MARK_ADD 0x01
79#define FAN_MARK_REMOVE 0x02
80#define FAN_MARK_DONT_FOLLOW 0x04
81#define FAN_MARK_ONLYDIR 0x08
82#define FAN_MARK_IGNORED_MASK 0x20
83#define FAN_MARK_IGNORED_SURV_MODIFY 0x40
84#define FAN_MARK_FLUSH 0x80
85#define FAN_MARK_INODE 0x00
86#define FAN_MARK_MOUNT 0x10
87#define FAN_MARK_FILESYSTEM 0x100
88#define FAN_MARK_TYPE_MASK (FAN_MARK_INODE | FAN_MARK_MOUNT | FAN_MARK_FILESYSTEM)
89#define FAN_ALL_MARK_FLAGS (FAN_MARK_ADD | FAN_MARK_REMOVE | FAN_MARK_DONT_FOLLOW | FAN_MARK_ONLYDIR | FAN_MARK_MOUNT | FAN_MARK_IGNORED_MASK | FAN_MARK_IGNORED_SURV_MODIFY | FAN_MARK_FLUSH)
90#define FAN_ALL_EVENTS (FAN_ACCESS | FAN_MODIFY | FAN_CLOSE | FAN_OPEN)
91#define FAN_ALL_PERM_EVENTS (FAN_OPEN_PERM | FAN_ACCESS_PERM)
92#define FAN_ALL_OUTGOING_EVENTS (FAN_ALL_EVENTS | FAN_ALL_PERM_EVENTS | FAN_Q_OVERFLOW)
93#define FANOTIFY_METADATA_VERSION 3
94#define FAN_EVENT_INFO_TYPE_FID 1
95#define FAN_EVENT_INFO_TYPE_DFID_NAME 2
96#define FAN_EVENT_INFO_TYPE_DFID 3
97#define FAN_ALLOW 0x01
98#define FAN_DENY 0x02
99#define FAN_AUDIT 0x10
100#define FAN_NOFD -1
101#define FAN_EVENT_METADATA_LEN (sizeof(struct fanotify_event_metadata))
102#define FAN_EVENT_NEXT(meta, len) ((len) -= (meta)->event_len, (struct fanotify_event_metadata*)(((char *)(meta)) + (meta)->event_len))
103#define FAN_EVENT_OK(meta, len) ((long)(len) >= (long)FAN_EVENT_METADATA_LEN && (long)(meta)->event_len >= (long)FAN_EVENT_METADATA_LEN && (long)(meta)->event_len <= (long)(len))
104
105int fanotify_init(unsigned, unsigned);
106int fanotify_mark(int, unsigned, unsigned long long, int, const char *);
107
108#ifdef __cplusplus
109}
110#endif
111#endif
lib/libc/wasi/libc-top-half/musl/include/sys/fsuid.h deleted-20
......@@ -1,20 +0,0 @@
1#ifndef _SYS_FSUID_H
2#define _SYS_FSUID_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#define __NEED_uid_t
9#define __NEED_gid_t
10
11#include <bits/alltypes.h>
12
13int setfsuid(uid_t);
14int setfsgid(gid_t);
15
16#ifdef __cplusplus
17}
18#endif
19
20#endif
lib/libc/wasi/libc-top-half/musl/include/sys/inotify.h deleted-58
......@@ -1,58 +0,0 @@
1#ifndef _SYS_INOTIFY_H
2#define _SYS_INOTIFY_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <stdint.h>
9#include <fcntl.h>
10
11struct inotify_event {
12 int wd;
13 uint32_t mask, cookie, len;
14 char name[];
15};
16
17#define IN_CLOEXEC O_CLOEXEC
18#define IN_NONBLOCK O_NONBLOCK
19
20#define IN_ACCESS 0x00000001
21#define IN_MODIFY 0x00000002
22#define IN_ATTRIB 0x00000004
23#define IN_CLOSE_WRITE 0x00000008
24#define IN_CLOSE_NOWRITE 0x00000010
25#define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE)
26#define IN_OPEN 0x00000020
27#define IN_MOVED_FROM 0x00000040
28#define IN_MOVED_TO 0x00000080
29#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO)
30#define IN_CREATE 0x00000100
31#define IN_DELETE 0x00000200
32#define IN_DELETE_SELF 0x00000400
33#define IN_MOVE_SELF 0x00000800
34#define IN_ALL_EVENTS 0x00000fff
35
36#define IN_UNMOUNT 0x00002000
37#define IN_Q_OVERFLOW 0x00004000
38#define IN_IGNORED 0x00008000
39
40#define IN_ONLYDIR 0x01000000
41#define IN_DONT_FOLLOW 0x02000000
42#define IN_EXCL_UNLINK 0x04000000
43#define IN_MASK_CREATE 0x10000000
44#define IN_MASK_ADD 0x20000000
45
46#define IN_ISDIR 0x40000000
47#define IN_ONESHOT 0x80000000
48
49int inotify_init(void);
50int inotify_init1(int);
51int inotify_add_watch(int, const char *, uint32_t);
52int inotify_rm_watch(int, int);
53
54#ifdef __cplusplus
55}
56#endif
57
58#endif
lib/libc/wasi/libc-top-half/musl/include/sys/io.h deleted-17
......@@ -1,17 +0,0 @@
1#ifndef _SYS_IO_H
2#define _SYS_IO_H
3#ifdef __cplusplus
4extern "C" {
5#endif
6
7#include <features.h>
8
9#include <bits/io.h>
10
11int iopl(int);
12int ioperm(unsigned long, unsigned long, int);
13
14#ifdef __cplusplus
15}
16#endif
17#endif
lib/libc/wasi/libc-top-half/musl/include/sys/ipc.h deleted-42
......@@ -1,42 +0,0 @@
1#ifndef _SYS_IPC_H
2#define _SYS_IPC_H
3#ifdef __cplusplus
4extern "C" {
5#endif
6
7#include <features.h>
8
9#define __NEED_uid_t
10#define __NEED_gid_t
11#define __NEED_mode_t
12#define __NEED_key_t
13
14#include <bits/alltypes.h>
15
16#define __ipc_perm_key __key
17#define __ipc_perm_seq __seq
18
19#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
20#define __key key
21#define __seq seq
22#endif
23
24#include <bits/ipc.h>
25#include <bits/ipcstat.h>
26
27#define IPC_CREAT 01000
28#define IPC_EXCL 02000
29#define IPC_NOWAIT 04000
30
31#define IPC_RMID 0
32#define IPC_SET 1
33#define IPC_INFO 3
34
35#define IPC_PRIVATE ((key_t) 0)
36
37key_t ftok (const char *, int);
38
39#ifdef __cplusplus
40}
41#endif
42#endif
lib/libc/wasi/libc-top-half/musl/include/sys/kd.h deleted-1
......@@ -1 +0,0 @@
1#include <bits/kd.h>
lib/libc/wasi/libc-top-half/musl/include/sys/klog.h deleted-14
......@@ -1,14 +0,0 @@
1#ifndef _SYS_KLOG_H
2#define _SYS_KLOG_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8int klogctl (int, char *, int);
9
10#ifdef __cplusplus
11}
12#endif
13
14#endif
lib/libc/wasi/libc-top-half/musl/include/sys/membarrier.h deleted-21
......@@ -1,21 +0,0 @@
1#ifndef _SYS_MEMBARRIER_H
2#define _SYS_MEMBARRIER_H
3
4#define MEMBARRIER_CMD_QUERY 0
5#define MEMBARRIER_CMD_GLOBAL 1
6#define MEMBARRIER_CMD_GLOBAL_EXPEDITED 2
7#define MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED 4
8#define MEMBARRIER_CMD_PRIVATE_EXPEDITED 8
9#define MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED 16
10#define MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE 32
11#define MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE 64
12#define MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ 128
13#define MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ 256
14
15#define MEMBARRIER_CMD_SHARED MEMBARRIER_CMD_GLOBAL
16
17#define MEMBARRIER_CMD_FLAG_CPU 1
18
19int membarrier(int, int);
20
21#endif
lib/libc/wasi/libc-top-half/musl/include/sys/mount.h deleted-75
......@@ -1,75 +0,0 @@
1#ifndef _SYS_MOUNT_H
2#define _SYS_MOUNT_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <sys/ioctl.h>
9
10#define BLKROSET _IO(0x12, 93)
11#define BLKROGET _IO(0x12, 94)
12#define BLKRRPART _IO(0x12, 95)
13#define BLKGETSIZE _IO(0x12, 96)
14#define BLKFLSBUF _IO(0x12, 97)
15#define BLKRASET _IO(0x12, 98)
16#define BLKRAGET _IO(0x12, 99)
17#define BLKFRASET _IO(0x12,100)
18#define BLKFRAGET _IO(0x12,101)
19#define BLKSECTSET _IO(0x12,102)
20#define BLKSECTGET _IO(0x12,103)
21#define BLKSSZGET _IO(0x12,104)
22#define BLKBSZGET _IOR(0x12,112,size_t)
23#define BLKBSZSET _IOW(0x12,113,size_t)
24#define BLKGETSIZE64 _IOR(0x12,114,size_t)
25
26#define MS_RDONLY 1
27#define MS_NOSUID 2
28#define MS_NODEV 4
29#define MS_NOEXEC 8
30#define MS_SYNCHRONOUS 16
31#define MS_REMOUNT 32
32#define MS_MANDLOCK 64
33#define MS_DIRSYNC 128
34#define MS_NOSYMFOLLOW 256
35#define MS_NOATIME 1024
36#define MS_NODIRATIME 2048
37#define MS_BIND 4096
38#define MS_MOVE 8192
39#define MS_REC 16384
40#define MS_SILENT 32768
41#define MS_POSIXACL (1<<16)
42#define MS_UNBINDABLE (1<<17)
43#define MS_PRIVATE (1<<18)
44#define MS_SLAVE (1<<19)
45#define MS_SHARED (1<<20)
46#define MS_RELATIME (1<<21)
47#define MS_KERNMOUNT (1<<22)
48#define MS_I_VERSION (1<<23)
49#define MS_STRICTATIME (1<<24)
50#define MS_LAZYTIME (1<<25)
51#define MS_NOREMOTELOCK (1<<27)
52#define MS_NOSEC (1<<28)
53#define MS_BORN (1<<29)
54#define MS_ACTIVE (1<<30)
55#define MS_NOUSER (1U<<31)
56
57#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION|MS_LAZYTIME)
58
59#define MS_MGC_VAL 0xc0ed0000
60#define MS_MGC_MSK 0xffff0000
61
62#define MNT_FORCE 1
63#define MNT_DETACH 2
64#define MNT_EXPIRE 4
65#define UMOUNT_NOFOLLOW 8
66
67int mount(const char *, const char *, const char *, unsigned long, const void *);
68int umount(const char *);
69int umount2(const char *, int);
70
71#ifdef __cplusplus
72}
73#endif
74
75#endif
lib/libc/wasi/libc-top-half/musl/include/sys/msg.h deleted-53
......@@ -1,53 +0,0 @@
1#ifndef _SYS_MSG_H
2#define _SYS_MSG_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <sys/ipc.h>
9
10#define __NEED_pid_t
11#define __NEED_key_t
12#define __NEED_time_t
13#define __NEED_size_t
14#define __NEED_ssize_t
15
16#include <bits/alltypes.h>
17
18typedef unsigned long msgqnum_t;
19typedef unsigned long msglen_t;
20
21#include <bits/msg.h>
22
23#define __msg_cbytes msg_cbytes
24
25#define MSG_NOERROR 010000
26#define MSG_EXCEPT 020000
27
28#define MSG_STAT (11 | (IPC_STAT & 0x100))
29#define MSG_INFO 12
30#define MSG_STAT_ANY (13 | (IPC_STAT & 0x100))
31
32struct msginfo {
33 int msgpool, msgmap, msgmax, msgmnb, msgmni, msgssz, msgtql;
34 unsigned short msgseg;
35};
36
37int msgctl (int, int, struct msqid_ds *);
38int msgget (key_t, int);
39ssize_t msgrcv (int, void *, size_t, long, int);
40int msgsnd (int, const void *, size_t, int);
41
42#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
43struct msgbuf {
44 long mtype;
45 char mtext[1];
46};
47#endif
48
49#ifdef __cplusplus
50}
51#endif
52
53#endif
lib/libc/wasi/libc-top-half/musl/include/sys/mtio.h deleted-188
......@@ -1,188 +0,0 @@
1#ifndef _SYS_MTIO_H
2#define _SYS_MTIO_H
3
4#include <sys/types.h>
5#include <sys/ioctl.h>
6
7struct mtop {
8 short mt_op;
9 int mt_count;
10};
11
12#define _IOT_mtop _IOT (_IOTS (short), 1, _IOTS (int), 1, 0, 0)
13#define _IOT_mtget _IOT (_IOTS (long), 7, 0, 0, 0, 0)
14#define _IOT_mtpos _IOT_SIMPLE (long)
15#define _IOT_mtconfiginfo _IOT (_IOTS (long), 2, _IOTS (short), 3, _IOTS (long), 1)
16
17
18#define MTRESET 0
19#define MTFSF 1
20#define MTBSF 2
21#define MTFSR 3
22#define MTBSR 4
23#define MTWEOF 5
24#define MTREW 6
25#define MTOFFL 7
26#define MTNOP 8
27#define MTRETEN 9
28#define MTBSFM 10
29#define MTFSFM 11
30#define MTEOM 12
31#define MTERASE 13
32#define MTRAS1 14
33#define MTRAS2 15
34#define MTRAS3 16
35#define MTSETBLK 20
36#define MTSETDENSITY 21
37#define MTSEEK 22
38#define MTTELL 23
39#define MTSETDRVBUFFER 24
40#define MTFSS 25
41#define MTBSS 26
42#define MTWSM 27
43#define MTLOCK 28
44#define MTUNLOCK 29
45#define MTLOAD 30
46#define MTUNLOAD 31
47#define MTCOMPRESSION 32
48#define MTSETPART 33
49#define MTMKPART 34
50
51struct mtget {
52 long mt_type;
53 long mt_resid;
54 long mt_dsreg;
55 long mt_gstat;
56 long mt_erreg;
57 int mt_fileno;
58 int mt_blkno;
59};
60
61#define MT_ISUNKNOWN 0x01
62#define MT_ISQIC02 0x02
63#define MT_ISWT5150 0x03
64#define MT_ISARCHIVE_5945L2 0x04
65#define MT_ISCMSJ500 0x05
66#define MT_ISTDC3610 0x06
67#define MT_ISARCHIVE_VP60I 0x07
68#define MT_ISARCHIVE_2150L 0x08
69#define MT_ISARCHIVE_2060L 0x09
70#define MT_ISARCHIVESC499 0x0A
71#define MT_ISQIC02_ALL_FEATURES 0x0F
72#define MT_ISWT5099EEN24 0x11
73#define MT_ISTEAC_MT2ST 0x12
74#define MT_ISEVEREX_FT40A 0x32
75#define MT_ISDDS1 0x51
76#define MT_ISDDS2 0x52
77#define MT_ISSCSI1 0x71
78#define MT_ISSCSI2 0x72
79#define MT_ISFTAPE_UNKNOWN 0x800000
80#define MT_ISFTAPE_FLAG 0x800000
81
82struct mt_tape_info {
83 long t_type;
84 char *t_name;
85};
86
87#define MT_TAPE_INFO \
88{ \
89 {MT_ISUNKNOWN, "Unknown type of tape device"}, \
90 {MT_ISQIC02, "Generic QIC-02 tape streamer"}, \
91 {MT_ISWT5150, "Wangtek 5150, QIC-150"}, \
92 {MT_ISARCHIVE_5945L2, "Archive 5945L-2"}, \
93 {MT_ISCMSJ500, "CMS Jumbo 500"}, \
94 {MT_ISTDC3610, "Tandberg TDC 3610, QIC-24"}, \
95 {MT_ISARCHIVE_VP60I, "Archive VP60i, QIC-02"}, \
96 {MT_ISARCHIVE_2150L, "Archive Viper 2150L"}, \
97 {MT_ISARCHIVE_2060L, "Archive Viper 2060L"}, \
98 {MT_ISARCHIVESC499, "Archive SC-499 QIC-36 controller"}, \
99 {MT_ISQIC02_ALL_FEATURES, "Generic QIC-02 tape, all features"}, \
100 {MT_ISWT5099EEN24, "Wangtek 5099-een24, 60MB"}, \
101 {MT_ISTEAC_MT2ST, "Teac MT-2ST 155mb data cassette drive"}, \
102 {MT_ISEVEREX_FT40A, "Everex FT40A, QIC-40"}, \
103 {MT_ISSCSI1, "Generic SCSI-1 tape"}, \
104 {MT_ISSCSI2, "Generic SCSI-2 tape"}, \
105 {0, 0} \
106}
107
108struct mtpos {
109 long mt_blkno;
110};
111
112struct mtconfiginfo {
113 long mt_type;
114 long ifc_type;
115 unsigned short irqnr;
116 unsigned short dmanr;
117 unsigned short port;
118 unsigned long debug;
119 unsigned have_dens:1;
120 unsigned have_bsf:1;
121 unsigned have_fsr:1;
122 unsigned have_bsr:1;
123 unsigned have_eod:1;
124 unsigned have_seek:1;
125 unsigned have_tell:1;
126 unsigned have_ras1:1;
127 unsigned have_ras2:1;
128 unsigned have_ras3:1;
129 unsigned have_qfa:1;
130 unsigned pad1:5;
131 char reserved[10];
132};
133
134#define MTIOCTOP _IOW('m', 1, struct mtop)
135#define MTIOCGET _IOR('m', 2, struct mtget)
136#define MTIOCPOS _IOR('m', 3, struct mtpos)
137
138#define MTIOCGETCONFIG _IOR('m', 4, struct mtconfiginfo)
139#define MTIOCSETCONFIG _IOW('m', 5, struct mtconfiginfo)
140
141#define GMT_EOF(x) ((x) & 0x80000000)
142#define GMT_BOT(x) ((x) & 0x40000000)
143#define GMT_EOT(x) ((x) & 0x20000000)
144#define GMT_SM(x) ((x) & 0x10000000)
145#define GMT_EOD(x) ((x) & 0x08000000)
146#define GMT_WR_PROT(x) ((x) & 0x04000000)
147#define GMT_ONLINE(x) ((x) & 0x01000000)
148#define GMT_D_6250(x) ((x) & 0x00800000)
149#define GMT_D_1600(x) ((x) & 0x00400000)
150#define GMT_D_800(x) ((x) & 0x00200000)
151#define GMT_DR_OPEN(x) ((x) & 0x00040000)
152#define GMT_IM_REP_EN(x) ((x) & 0x00010000)
153
154#define MT_ST_BLKSIZE_SHIFT 0
155#define MT_ST_BLKSIZE_MASK 0xffffff
156#define MT_ST_DENSITY_SHIFT 24
157#define MT_ST_DENSITY_MASK 0xff000000
158#define MT_ST_SOFTERR_SHIFT 0
159#define MT_ST_SOFTERR_MASK 0xffff
160#define MT_ST_OPTIONS 0xf0000000
161#define MT_ST_BOOLEANS 0x10000000
162#define MT_ST_SETBOOLEANS 0x30000000
163#define MT_ST_CLEARBOOLEANS 0x40000000
164#define MT_ST_WRITE_THRESHOLD 0x20000000
165#define MT_ST_DEF_BLKSIZE 0x50000000
166#define MT_ST_DEF_OPTIONS 0x60000000
167#define MT_ST_BUFFER_WRITES 0x1
168#define MT_ST_ASYNC_WRITES 0x2
169#define MT_ST_READ_AHEAD 0x4
170#define MT_ST_DEBUGGING 0x8
171#define MT_ST_TWO_FM 0x10
172#define MT_ST_FAST_MTEOM 0x20
173#define MT_ST_AUTO_LOCK 0x40
174#define MT_ST_DEF_WRITES 0x80
175#define MT_ST_CAN_BSR 0x100
176#define MT_ST_NO_BLKLIMS 0x200
177#define MT_ST_CAN_PARTITIONS 0x400
178#define MT_ST_SCSI2LOGICAL 0x800
179#define MT_ST_CLEAR_DEFAULT 0xfffff
180#define MT_ST_DEF_DENSITY (MT_ST_DEF_OPTIONS | 0x100000)
181#define MT_ST_DEF_COMPRESSION (MT_ST_DEF_OPTIONS | 0x200000)
182#define MT_ST_DEF_DRVBUFFER (MT_ST_DEF_OPTIONS | 0x300000)
183#define MT_ST_HPLOADER_OFFSET 10000
184#ifndef DEFTAPE
185# define DEFTAPE "/dev/tape"
186#endif
187
188#endif
lib/libc/wasi/libc-top-half/musl/include/sys/personality.h deleted-49
......@@ -1,49 +0,0 @@
1#ifndef _PERSONALITY_H
2#define _PERSONALITY_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#define UNAME26 0x0020000
9#define ADDR_NO_RANDOMIZE 0x0040000
10#define FDPIC_FUNCPTRS 0x0080000
11#define MMAP_PAGE_ZERO 0x0100000
12#define ADDR_COMPAT_LAYOUT 0x0200000
13#define READ_IMPLIES_EXEC 0x0400000
14#define ADDR_LIMIT_32BIT 0x0800000
15#define SHORT_INODE 0x1000000
16#define WHOLE_SECONDS 0x2000000
17#define STICKY_TIMEOUTS 0x4000000
18#define ADDR_LIMIT_3GB 0x8000000
19
20#define PER_LINUX 0
21#define PER_LINUX_32BIT ADDR_LIMIT_32BIT
22#define PER_LINUX_FDPIC FDPIC_FUNCPTRS
23#define PER_SVR4 (1 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO)
24#define PER_SVR3 (2 | STICKY_TIMEOUTS | SHORT_INODE)
25#define PER_SCOSVR3 (3 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE)
26#define PER_OSR5 (3 | STICKY_TIMEOUTS | WHOLE_SECONDS)
27#define PER_WYSEV386 (4 | STICKY_TIMEOUTS | SHORT_INODE)
28#define PER_ISCR4 (5 | STICKY_TIMEOUTS)
29#define PER_BSD 6
30#define PER_SUNOS (6 | STICKY_TIMEOUTS)
31#define PER_XENIX (7 | STICKY_TIMEOUTS | SHORT_INODE)
32#define PER_LINUX32 8
33#define PER_LINUX32_3GB (8 | ADDR_LIMIT_3GB)
34#define PER_IRIX32 (9 | STICKY_TIMEOUTS)
35#define PER_IRIXN32 (0xa | STICKY_TIMEOUTS)
36#define PER_IRIX64 (0x0b | STICKY_TIMEOUTS)
37#define PER_RISCOS 0xc
38#define PER_SOLARIS (0xd | STICKY_TIMEOUTS)
39#define PER_UW7 (0xe | STICKY_TIMEOUTS | MMAP_PAGE_ZERO)
40#define PER_OSF4 0xf
41#define PER_HPUX 0x10
42#define PER_MASK 0xff
43
44int personality(unsigned long);
45
46#ifdef __cplusplus
47}
48#endif
49#endif
lib/libc/wasi/libc-top-half/musl/include/sys/prctl.h deleted-186
......@@ -1,186 +0,0 @@
1#ifndef _SYS_PRCTL_H
2#define _SYS_PRCTL_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <stdint.h>
9
10#define PR_SET_PDEATHSIG 1
11#define PR_GET_PDEATHSIG 2
12#define PR_GET_DUMPABLE 3
13#define PR_SET_DUMPABLE 4
14#define PR_GET_UNALIGN 5
15#define PR_SET_UNALIGN 6
16#define PR_UNALIGN_NOPRINT 1
17#define PR_UNALIGN_SIGBUS 2
18#define PR_GET_KEEPCAPS 7
19#define PR_SET_KEEPCAPS 8
20#define PR_GET_FPEMU 9
21#define PR_SET_FPEMU 10
22#define PR_FPEMU_NOPRINT 1
23#define PR_FPEMU_SIGFPE 2
24#define PR_GET_FPEXC 11
25#define PR_SET_FPEXC 12
26#define PR_FP_EXC_SW_ENABLE 0x80
27#define PR_FP_EXC_DIV 0x010000
28#define PR_FP_EXC_OVF 0x020000
29#define PR_FP_EXC_UND 0x040000
30#define PR_FP_EXC_RES 0x080000
31#define PR_FP_EXC_INV 0x100000
32#define PR_FP_EXC_DISABLED 0
33#define PR_FP_EXC_NONRECOV 1
34#define PR_FP_EXC_ASYNC 2
35#define PR_FP_EXC_PRECISE 3
36#define PR_GET_TIMING 13
37#define PR_SET_TIMING 14
38#define PR_TIMING_STATISTICAL 0
39#define PR_TIMING_TIMESTAMP 1
40#define PR_SET_NAME 15
41#define PR_GET_NAME 16
42#define PR_GET_ENDIAN 19
43#define PR_SET_ENDIAN 20
44#define PR_ENDIAN_BIG 0
45#define PR_ENDIAN_LITTLE 1
46#define PR_ENDIAN_PPC_LITTLE 2
47#define PR_GET_SECCOMP 21
48#define PR_SET_SECCOMP 22
49#define PR_CAPBSET_READ 23
50#define PR_CAPBSET_DROP 24
51#define PR_GET_TSC 25
52#define PR_SET_TSC 26
53#define PR_TSC_ENABLE 1
54#define PR_TSC_SIGSEGV 2
55#define PR_GET_SECUREBITS 27
56#define PR_SET_SECUREBITS 28
57#define PR_SET_TIMERSLACK 29
58#define PR_GET_TIMERSLACK 30
59
60#define PR_TASK_PERF_EVENTS_DISABLE 31
61#define PR_TASK_PERF_EVENTS_ENABLE 32
62
63#define PR_MCE_KILL 33
64#define PR_MCE_KILL_CLEAR 0
65#define PR_MCE_KILL_SET 1
66#define PR_MCE_KILL_LATE 0
67#define PR_MCE_KILL_EARLY 1
68#define PR_MCE_KILL_DEFAULT 2
69#define PR_MCE_KILL_GET 34
70
71#define PR_SET_MM 35
72#define PR_SET_MM_START_CODE 1
73#define PR_SET_MM_END_CODE 2
74#define PR_SET_MM_START_DATA 3
75#define PR_SET_MM_END_DATA 4
76#define PR_SET_MM_START_STACK 5
77#define PR_SET_MM_START_BRK 6
78#define PR_SET_MM_BRK 7
79#define PR_SET_MM_ARG_START 8
80#define PR_SET_MM_ARG_END 9
81#define PR_SET_MM_ENV_START 10
82#define PR_SET_MM_ENV_END 11
83#define PR_SET_MM_AUXV 12
84#define PR_SET_MM_EXE_FILE 13
85#define PR_SET_MM_MAP 14
86#define PR_SET_MM_MAP_SIZE 15
87
88struct prctl_mm_map {
89 uint64_t start_code;
90 uint64_t end_code;
91 uint64_t start_data;
92 uint64_t end_data;
93 uint64_t start_brk;
94 uint64_t brk;
95 uint64_t start_stack;
96 uint64_t arg_start;
97 uint64_t arg_end;
98 uint64_t env_start;
99 uint64_t env_end;
100 uint64_t *auxv;
101 uint32_t auxv_size;
102 uint32_t exe_fd;
103};
104
105#define PR_SET_PTRACER 0x59616d61
106#define PR_SET_PTRACER_ANY (-1UL)
107
108#define PR_SET_CHILD_SUBREAPER 36
109#define PR_GET_CHILD_SUBREAPER 37
110
111#define PR_SET_NO_NEW_PRIVS 38
112#define PR_GET_NO_NEW_PRIVS 39
113
114#define PR_GET_TID_ADDRESS 40
115
116#define PR_SET_THP_DISABLE 41
117#define PR_GET_THP_DISABLE 42
118
119#define PR_MPX_ENABLE_MANAGEMENT 43
120#define PR_MPX_DISABLE_MANAGEMENT 44
121
122#define PR_SET_FP_MODE 45
123#define PR_GET_FP_MODE 46
124#define PR_FP_MODE_FR (1 << 0)
125#define PR_FP_MODE_FRE (1 << 1)
126
127#define PR_CAP_AMBIENT 47
128#define PR_CAP_AMBIENT_IS_SET 1
129#define PR_CAP_AMBIENT_RAISE 2
130#define PR_CAP_AMBIENT_LOWER 3
131#define PR_CAP_AMBIENT_CLEAR_ALL 4
132
133#define PR_SVE_SET_VL 50
134#define PR_SVE_SET_VL_ONEXEC (1 << 18)
135#define PR_SVE_GET_VL 51
136#define PR_SVE_VL_LEN_MASK 0xffff
137#define PR_SVE_VL_INHERIT (1 << 17)
138
139#define PR_GET_SPECULATION_CTRL 52
140#define PR_SET_SPECULATION_CTRL 53
141#define PR_SPEC_STORE_BYPASS 0
142#define PR_SPEC_INDIRECT_BRANCH 1
143#define PR_SPEC_NOT_AFFECTED 0
144#define PR_SPEC_PRCTL (1UL << 0)
145#define PR_SPEC_ENABLE (1UL << 1)
146#define PR_SPEC_DISABLE (1UL << 2)
147#define PR_SPEC_FORCE_DISABLE (1UL << 3)
148#define PR_SPEC_DISABLE_NOEXEC (1UL << 4)
149
150#define PR_PAC_RESET_KEYS 54
151#define PR_PAC_APIAKEY (1UL << 0)
152#define PR_PAC_APIBKEY (1UL << 1)
153#define PR_PAC_APDAKEY (1UL << 2)
154#define PR_PAC_APDBKEY (1UL << 3)
155#define PR_PAC_APGAKEY (1UL << 4)
156
157#define PR_SET_TAGGED_ADDR_CTRL 55
158#define PR_GET_TAGGED_ADDR_CTRL 56
159#define PR_TAGGED_ADDR_ENABLE (1UL << 0)
160#define PR_MTE_TCF_SHIFT 1
161#define PR_MTE_TCF_NONE (0UL << 1)
162#define PR_MTE_TCF_SYNC (1UL << 1)
163#define PR_MTE_TCF_ASYNC (2UL << 1)
164#define PR_MTE_TCF_MASK (3UL << 1)
165#define PR_MTE_TAG_SHIFT 3
166#define PR_MTE_TAG_MASK (0xffffUL << 3)
167
168#define PR_SET_IO_FLUSHER 57
169#define PR_GET_IO_FLUSHER 58
170
171#define PR_SET_SYSCALL_USER_DISPATCH 59
172#define PR_SYS_DISPATCH_OFF 0
173#define PR_SYS_DISPATCH_ON 1
174#define SYSCALL_DISPATCH_FILTER_ALLOW 0
175#define SYSCALL_DISPATCH_FILTER_BLOCK 1
176
177#define PR_PAC_SET_ENABLED_KEYS 60
178#define PR_PAC_GET_ENABLED_KEYS 61
179
180int prctl (int, ...);
181
182#ifdef __cplusplus
183}
184#endif
185
186#endif
lib/libc/wasi/libc-top-half/musl/include/sys/procfs.h deleted-63
......@@ -1,63 +0,0 @@
1#ifndef _SYS_PROCFS_H
2#define _SYS_PROCFS_H
3#ifdef __cplusplus
4extern "C" {
5#endif
6
7#include <sys/time.h>
8#include <sys/types.h>
9#include <sys/user.h>
10
11struct elf_siginfo {
12 int si_signo;
13 int si_code;
14 int si_errno;
15};
16
17struct elf_prstatus {
18 struct elf_siginfo pr_info;
19 short int pr_cursig;
20 unsigned long int pr_sigpend;
21 unsigned long int pr_sighold;
22 pid_t pr_pid;
23 pid_t pr_ppid;
24 pid_t pr_pgrp;
25 pid_t pr_sid;
26 struct {
27 long tv_sec, tv_usec;
28 } pr_utime, pr_stime, pr_cutime, pr_cstime;
29 elf_gregset_t pr_reg;
30 int pr_fpvalid;
31};
32
33#define ELF_PRARGSZ 80
34
35struct elf_prpsinfo {
36 char pr_state;
37 char pr_sname;
38 char pr_zomb;
39 char pr_nice;
40 unsigned long int pr_flag;
41#if UINTPTR_MAX == 0xffffffff
42 unsigned short int pr_uid;
43 unsigned short int pr_gid;
44#else
45 unsigned int pr_uid;
46 unsigned int pr_gid;
47#endif
48 int pr_pid, pr_ppid, pr_pgrp, pr_sid;
49 char pr_fname[16];
50 char pr_psargs[ELF_PRARGSZ];
51};
52
53typedef void *psaddr_t;
54typedef elf_gregset_t prgregset_t;
55typedef elf_fpregset_t prfpregset_t;
56typedef pid_t lwpid_t;
57typedef struct elf_prstatus prstatus_t;
58typedef struct elf_prpsinfo prpsinfo_t;
59
60#ifdef __cplusplus
61}
62#endif
63#endif
lib/libc/wasi/libc-top-half/musl/include/sys/ptrace.h deleted-147
......@@ -1,147 +0,0 @@
1#ifndef _SYS_PTRACE_H
2#define _SYS_PTRACE_H
3#ifdef __cplusplus
4extern "C" {
5#endif
6
7#include <stdint.h>
8
9#define PTRACE_TRACEME 0
10#define PT_TRACE_ME PTRACE_TRACEME
11
12#define PTRACE_PEEKTEXT 1
13#define PTRACE_PEEKDATA 2
14#define PTRACE_PEEKUSER 3
15#define PTRACE_POKETEXT 4
16#define PTRACE_POKEDATA 5
17#define PTRACE_POKEUSER 6
18#define PTRACE_CONT 7
19#define PTRACE_KILL 8
20#define PTRACE_SINGLESTEP 9
21#define PTRACE_GETREGS 12
22#define PTRACE_SETREGS 13
23#define PTRACE_GETFPREGS 14
24#define PTRACE_SETFPREGS 15
25#define PTRACE_ATTACH 16
26#define PTRACE_DETACH 17
27#define PTRACE_GETFPXREGS 18
28#define PTRACE_SETFPXREGS 19
29#define PTRACE_SYSCALL 24
30#define PTRACE_SETOPTIONS 0x4200
31#define PTRACE_GETEVENTMSG 0x4201
32#define PTRACE_GETSIGINFO 0x4202
33#define PTRACE_SETSIGINFO 0x4203
34#define PTRACE_GETREGSET 0x4204
35#define PTRACE_SETREGSET 0x4205
36#define PTRACE_SEIZE 0x4206
37#define PTRACE_INTERRUPT 0x4207
38#define PTRACE_LISTEN 0x4208
39#define PTRACE_PEEKSIGINFO 0x4209
40#define PTRACE_GETSIGMASK 0x420a
41#define PTRACE_SETSIGMASK 0x420b
42#define PTRACE_SECCOMP_GET_FILTER 0x420c
43#define PTRACE_SECCOMP_GET_METADATA 0x420d
44#define PTRACE_GET_SYSCALL_INFO 0x420e
45#define PTRACE_GET_RSEQ_CONFIGURATION 0x420f
46
47#define PT_READ_I PTRACE_PEEKTEXT
48#define PT_READ_D PTRACE_PEEKDATA
49#define PT_READ_U PTRACE_PEEKUSER
50#define PT_WRITE_I PTRACE_POKETEXT
51#define PT_WRITE_D PTRACE_POKEDATA
52#define PT_WRITE_U PTRACE_POKEUSER
53#define PT_CONTINUE PTRACE_CONT
54#define PT_KILL PTRACE_KILL
55#define PT_STEP PTRACE_SINGLESTEP
56#define PT_GETREGS PTRACE_GETREGS
57#define PT_SETREGS PTRACE_SETREGS
58#define PT_GETFPREGS PTRACE_GETFPREGS
59#define PT_SETFPREGS PTRACE_SETFPREGS
60#define PT_ATTACH PTRACE_ATTACH
61#define PT_DETACH PTRACE_DETACH
62#define PT_GETFPXREGS PTRACE_GETFPXREGS
63#define PT_SETFPXREGS PTRACE_SETFPXREGS
64#define PT_SYSCALL PTRACE_SYSCALL
65#define PT_SETOPTIONS PTRACE_SETOPTIONS
66#define PT_GETEVENTMSG PTRACE_GETEVENTMSG
67#define PT_GETSIGINFO PTRACE_GETSIGINFO
68#define PT_SETSIGINFO PTRACE_SETSIGINFO
69
70#define PTRACE_O_TRACESYSGOOD 0x00000001
71#define PTRACE_O_TRACEFORK 0x00000002
72#define PTRACE_O_TRACEVFORK 0x00000004
73#define PTRACE_O_TRACECLONE 0x00000008
74#define PTRACE_O_TRACEEXEC 0x00000010
75#define PTRACE_O_TRACEVFORKDONE 0x00000020
76#define PTRACE_O_TRACEEXIT 0x00000040
77#define PTRACE_O_TRACESECCOMP 0x00000080
78#define PTRACE_O_EXITKILL 0x00100000
79#define PTRACE_O_SUSPEND_SECCOMP 0x00200000
80#define PTRACE_O_MASK 0x003000ff
81
82#define PTRACE_EVENT_FORK 1
83#define PTRACE_EVENT_VFORK 2
84#define PTRACE_EVENT_CLONE 3
85#define PTRACE_EVENT_EXEC 4
86#define PTRACE_EVENT_VFORK_DONE 5
87#define PTRACE_EVENT_EXIT 6
88#define PTRACE_EVENT_SECCOMP 7
89#define PTRACE_EVENT_STOP 128
90
91#define PTRACE_PEEKSIGINFO_SHARED 1
92
93#define PTRACE_SYSCALL_INFO_NONE 0
94#define PTRACE_SYSCALL_INFO_ENTRY 1
95#define PTRACE_SYSCALL_INFO_EXIT 2
96#define PTRACE_SYSCALL_INFO_SECCOMP 3
97
98#include <bits/ptrace.h>
99
100struct __ptrace_peeksiginfo_args {
101 uint64_t off;
102 uint32_t flags;
103 int32_t nr;
104};
105
106struct __ptrace_seccomp_metadata {
107 uint64_t filter_off;
108 uint64_t flags;
109};
110
111struct __ptrace_syscall_info {
112 uint8_t op;
113 uint8_t __pad[3];
114 uint32_t arch;
115 uint64_t instruction_pointer;
116 uint64_t stack_pointer;
117 union {
118 struct {
119 uint64_t nr;
120 uint64_t args[6];
121 } entry;
122 struct {
123 int64_t rval;
124 uint8_t is_error;
125 } exit;
126 struct {
127 uint64_t nr;
128 uint64_t args[6];
129 uint32_t ret_data;
130 } seccomp;
131 };
132};
133
134struct __ptrace_rseq_configuration {
135 uint64_t rseq_abi_pointer;
136 uint32_t rseq_abi_size;
137 uint32_t signature;
138 uint32_t flags;
139 uint32_t pad;
140};
141
142long ptrace(int, ...);
143
144#ifdef __cplusplus
145}
146#endif
147#endif
lib/libc/wasi/libc-top-half/musl/include/sys/quota.h deleted-102
......@@ -1,102 +0,0 @@
1#ifndef _SYS_QUOTA_H
2#define _SYS_QUOTA_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <stdint.h>
9
10#define _LINUX_QUOTA_VERSION 2
11
12#define dbtob(num) ((num) << 10)
13#define btodb(num) ((num) >> 10)
14#define fs_to_dq_blocks(num, blksize) (((num) * (blksize)) / 1024)
15
16#define MAX_IQ_TIME 604800
17#define MAX_DQ_TIME 604800
18
19#define MAXQUOTAS 2
20#define USRQUOTA 0
21#define GRPQUOTA 1
22
23#define INITQFNAMES { "user", "group", "undefined" };
24
25#define QUOTAFILENAME "quota"
26#define QUOTAGROUP "staff"
27
28#define NR_DQHASH 43
29#define NR_DQUOTS 256
30
31#define SUBCMDMASK 0x00ff
32#define SUBCMDSHIFT 8
33#define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
34
35#define Q_SYNC 0x800001
36#define Q_QUOTAON 0x800002
37#define Q_QUOTAOFF 0x800003
38#define Q_GETFMT 0x800004
39#define Q_GETINFO 0x800005
40#define Q_SETINFO 0x800006
41#define Q_GETQUOTA 0x800007
42#define Q_SETQUOTA 0x800008
43
44#define QFMT_VFS_OLD 1
45#define QFMT_VFS_V0 2
46#define QFMT_OCFS2 3
47#define QFMT_VFS_V1 4
48
49#define QIF_BLIMITS 1
50#define QIF_SPACE 2
51#define QIF_ILIMITS 4
52#define QIF_INODES 8
53#define QIF_BTIME 16
54#define QIF_ITIME 32
55#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS)
56#define QIF_USAGE (QIF_SPACE | QIF_INODES)
57#define QIF_TIMES (QIF_BTIME | QIF_ITIME)
58#define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES)
59
60struct dqblk {
61 uint64_t dqb_bhardlimit;
62 uint64_t dqb_bsoftlimit;
63 uint64_t dqb_curspace;
64 uint64_t dqb_ihardlimit;
65 uint64_t dqb_isoftlimit;
66 uint64_t dqb_curinodes;
67 uint64_t dqb_btime;
68 uint64_t dqb_itime;
69 uint32_t dqb_valid;
70};
71
72#define dq_bhardlimit dq_dqb.dqb_bhardlimit
73#define dq_bsoftlimit dq_dqb.dqb_bsoftlimit
74#define dq_curspace dq_dqb.dqb_curspace
75#define dq_valid dq_dqb.dqb_valid
76#define dq_ihardlimit dq_dqb.dqb_ihardlimit
77#define dq_isoftlimit dq_dqb.dqb_isoftlimit
78#define dq_curinodes dq_dqb.dqb_curinodes
79#define dq_btime dq_dqb.dqb_btime
80#define dq_itime dq_dqb.dqb_itime
81
82#define dqoff(UID) ((long long)(UID) * sizeof (struct dqblk))
83
84#define IIF_BGRACE 1
85#define IIF_IGRACE 2
86#define IIF_FLAGS 4
87#define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)
88
89struct dqinfo {
90 uint64_t dqi_bgrace;
91 uint64_t dqi_igrace;
92 uint32_t dqi_flags;
93 uint32_t dqi_valid;
94};
95
96int quotactl(int, const char *, int, char *);
97
98#ifdef __cplusplus
99}
100#endif
101
102#endif
lib/libc/wasi/libc-top-half/musl/include/sys/reboot.h deleted-20
......@@ -1,20 +0,0 @@
1#ifndef _SYS_REBOOT_H
2#define _SYS_REBOOT_H
3#ifdef __cplusplus
4extern "C" {
5#endif
6
7#define RB_AUTOBOOT 0x01234567
8#define RB_HALT_SYSTEM 0xcdef0123
9#define RB_ENABLE_CAD 0x89abcdef
10#define RB_DISABLE_CAD 0
11#define RB_POWER_OFF 0x4321fedc
12#define RB_SW_SUSPEND 0xd000fce2
13#define RB_KEXEC 0x45584543
14
15int reboot(int);
16
17#ifdef __cplusplus
18}
19#endif
20#endif
lib/libc/wasi/libc-top-half/musl/include/sys/sem.h deleted-72
......@@ -1,72 +0,0 @@
1#ifndef _SYS_SEM_H
2#define _SYS_SEM_H
3#ifdef __cplusplus
4extern "C" {
5#endif
6
7#include <features.h>
8
9#define __NEED_size_t
10#define __NEED_pid_t
11#define __NEED_time_t
12#ifdef _GNU_SOURCE
13#define __NEED_struct_timespec
14#endif
15#include <bits/alltypes.h>
16
17#include <sys/ipc.h>
18
19#define SEM_UNDO 0x1000
20#define GETPID 11
21#define GETVAL 12
22#define GETALL 13
23#define GETNCNT 14
24#define GETZCNT 15
25#define SETVAL 16
26#define SETALL 17
27
28#include <bits/sem.h>
29
30#define _SEM_SEMUN_UNDEFINED 1
31
32#define SEM_STAT (18 | (IPC_STAT & 0x100))
33#define SEM_INFO 19
34#define SEM_STAT_ANY (20 | (IPC_STAT & 0x100))
35
36struct seminfo {
37 int semmap;
38 int semmni;
39 int semmns;
40 int semmnu;
41 int semmsl;
42 int semopm;
43 int semume;
44 int semusz;
45 int semvmx;
46 int semaem;
47};
48
49struct sembuf {
50 unsigned short sem_num;
51 short sem_op;
52 short sem_flg;
53};
54
55int semctl(int, int, int, ...);
56int semget(key_t, int, int);
57int semop(int, struct sembuf *, size_t);
58
59#ifdef _GNU_SOURCE
60int semtimedop(int, struct sembuf *, size_t, const struct timespec *);
61#endif
62
63#if _REDIR_TIME64
64#ifdef _GNU_SOURCE
65__REDIR(semtimedop, __semtimedop_time64);
66#endif
67#endif
68
69#ifdef __cplusplus
70}
71#endif
72#endif
lib/libc/wasi/libc-top-half/musl/include/sys/sendfile.h deleted-22
......@@ -1,22 +0,0 @@
1#ifndef _SYS_SENDFILE_H
2#define _SYS_SENDFILE_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <features.h>
9#include <unistd.h>
10
11ssize_t sendfile(int, int, off_t *, size_t);
12
13#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
14#define sendfile64 sendfile
15#define off64_t off_t
16#endif
17
18#ifdef __cplusplus
19}
20#endif
21
22#endif
lib/libc/wasi/libc-top-half/musl/include/sys/shm.h deleted-70
......@@ -1,70 +0,0 @@
1#ifndef _SYS_SHM_H
2#define _SYS_SHM_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <features.h>
9
10#define __NEED_time_t
11#define __NEED_size_t
12#define __NEED_pid_t
13
14#include <bits/alltypes.h>
15
16#include <sys/ipc.h>
17
18#ifdef _GNU_SOURCE
19#define __used_ids used_ids
20#define __swap_attempts swap_attempts
21#define __swap_successes swap_successes
22#endif
23
24#include <bits/shm.h>
25
26#define SHM_R 0400
27#define SHM_W 0200
28
29#define SHM_RDONLY 010000
30#define SHM_RND 020000
31#define SHM_REMAP 040000
32#define SHM_EXEC 0100000
33
34#define SHM_LOCK 11
35#define SHM_UNLOCK 12
36#define SHM_STAT (13 | (IPC_STAT & 0x100))
37#define SHM_INFO 14
38#define SHM_STAT_ANY (15 | (IPC_STAT & 0x100))
39#define SHM_DEST 01000
40#define SHM_LOCKED 02000
41#define SHM_HUGETLB 04000
42#define SHM_NORESERVE 010000
43
44#define SHM_HUGE_SHIFT 26
45#define SHM_HUGE_MASK 0x3f
46#define SHM_HUGE_64KB (16 << 26)
47#define SHM_HUGE_512KB (19 << 26)
48#define SHM_HUGE_1MB (20 << 26)
49#define SHM_HUGE_2MB (21 << 26)
50#define SHM_HUGE_8MB (23 << 26)
51#define SHM_HUGE_16MB (24 << 26)
52#define SHM_HUGE_32MB (25 << 26)
53#define SHM_HUGE_256MB (28 << 26)
54#define SHM_HUGE_512MB (29 << 26)
55#define SHM_HUGE_1GB (30 << 26)
56#define SHM_HUGE_2GB (31 << 26)
57#define SHM_HUGE_16GB (34U << 26)
58
59typedef unsigned long shmatt_t;
60
61void *shmat(int, const void *, int);
62int shmctl(int, int, struct shmid_ds *);
63int shmdt(const void *);
64int shmget(key_t, size_t, int);
65
66#ifdef __cplusplus
67}
68#endif
69
70#endif
lib/libc/wasi/libc-top-half/musl/include/sys/signalfd.h deleted-49
......@@ -1,49 +0,0 @@
1#ifndef _SYS_SIGNALFD_H
2#define _SYS_SIGNALFD_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <stdint.h>
9#include <fcntl.h>
10
11#define __NEED_sigset_t
12
13#include <bits/alltypes.h>
14
15#define SFD_CLOEXEC O_CLOEXEC
16#define SFD_NONBLOCK O_NONBLOCK
17
18int signalfd(int, const sigset_t *, int);
19
20struct signalfd_siginfo {
21 uint32_t ssi_signo;
22 int32_t ssi_errno;
23 int32_t ssi_code;
24 uint32_t ssi_pid;
25 uint32_t ssi_uid;
26 int32_t ssi_fd;
27 uint32_t ssi_tid;
28 uint32_t ssi_band;
29 uint32_t ssi_overrun;
30 uint32_t ssi_trapno;
31 int32_t ssi_status;
32 int32_t ssi_int;
33 uint64_t ssi_ptr;
34 uint64_t ssi_utime;
35 uint64_t ssi_stime;
36 uint64_t ssi_addr;
37 uint16_t ssi_addr_lsb;
38 uint16_t __pad2;
39 int32_t ssi_syscall;
40 uint64_t ssi_call_addr;
41 uint32_t ssi_arch;
42 uint8_t __pad[128-14*4-5*8-2*2];
43};
44
45#ifdef __cplusplus
46}
47#endif
48
49#endif
lib/libc/wasi/libc-top-half/musl/include/sys/socket.h+12-6
......@@ -1,5 +1,8 @@
11#ifndef _SYS_SOCKET_H
22#define _SYS_SOCKET_H
3
4#include <__wasi_snapshot.h>
5
36#ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */
47#else
58#include <__header_sys_socket.h>
......@@ -395,30 +398,33 @@ struct sockaddr_storage {
395398#include <__struct_sockaddr_storage.h>
396399#endif
397400
398#ifdef __wasilibc_unmodified_upstream /* WASI has no socket/socketpair */
401#if (defined __wasilibc_unmodified_upstream) || (defined __wasilibc_use_wasip2)
399402int socket (int, int, int);
403#endif
404
405#ifdef __wasilibc_unmodified_upstream /* WASI has no socketpair */
400406int socketpair (int, int, int, int [2]);
401407#endif
402408
403409int shutdown (int, int);
404410
405#ifdef __wasilibc_unmodified_upstream /* WASI has no bind/connect/listen/accept */
406int bind (int, const struct sockaddr *, socklen_t);
411#if (defined __wasilibc_unmodified_upstream) || (defined __wasilibc_use_wasip2)
407412int connect (int, const struct sockaddr *, socklen_t);
413int bind (int, const struct sockaddr *, socklen_t);
408414int listen (int, int);
409415#endif
410416
411417int accept (int, struct sockaddr *__restrict, socklen_t *__restrict);
412418int accept4(int, struct sockaddr *__restrict, socklen_t *__restrict, int);
413419
414#ifdef __wasilibc_unmodified_upstream /* WASI has no getsockname/getpeername */
420#if (defined __wasilibc_unmodified_upstream) || (defined __wasilibc_use_wasip2)
415421int getsockname (int, struct sockaddr *__restrict, socklen_t *__restrict);
416422int getpeername (int, struct sockaddr *__restrict, socklen_t *__restrict);
417423#endif
418424
419425ssize_t send (int, const void *, size_t, int);
420426ssize_t recv (int, void *, size_t, int);
421#ifdef __wasilibc_unmodified_upstream /* WASI has no sendto/recvfrom */
427#if (defined __wasilibc_unmodified_upstream) || (defined __wasilibc_use_wasip2)
422428ssize_t sendto (int, const void *, size_t, int, const struct sockaddr *, socklen_t);
423429ssize_t recvfrom (int, void *__restrict, size_t, int, struct sockaddr *__restrict, socklen_t *__restrict);
424430#endif
......@@ -428,7 +434,7 @@ ssize_t recvmsg (int, struct msghdr *, int);
428434#endif
429435
430436int getsockopt (int, int, int, void *__restrict, socklen_t *__restrict);
431#ifdef __wasilibc_unmodified_upstream /* WASI has no setsockopt */
437#if (defined __wasilibc_unmodified_upstream) || (defined __wasilibc_use_wasip2)
432438int setsockopt (int, int, int, const void *, socklen_t);
433439#endif
434440
lib/libc/wasi/libc-top-half/musl/include/sys/soundcard.h deleted-1
......@@ -1 +0,0 @@
1#include <bits/soundcard.h>
lib/libc/wasi/libc-top-half/musl/include/sys/stat.h-2
......@@ -78,11 +78,9 @@ int stat(const char *__restrict, struct stat *__restrict);
7878int fstat(int, struct stat *);
7979int lstat(const char *__restrict, struct stat *__restrict);
8080int fstatat(int, const char *__restrict, struct stat *__restrict, int);
81#ifdef __wasilibc_unmodified_upstream /* WASI has no chmod */
8281int chmod(const char *, mode_t);
8382int fchmod(int, mode_t);
8483int fchmodat(int, const char *, mode_t, int);
85#endif
8684#ifdef __wasilibc_unmodified_upstream /* WASI has no umask */
8785mode_t umask(mode_t);
8886#endif
lib/libc/wasi/libc-top-half/musl/include/sys/statfs.h deleted-32
......@@ -1,32 +0,0 @@
1#ifndef _SYS_STATFS_H
2#define _SYS_STATFS_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <features.h>
9
10#include <sys/statvfs.h>
11
12typedef struct __fsid_t {
13 int __val[2];
14} fsid_t;
15
16#include <bits/statfs.h>
17
18int statfs (const char *, struct statfs *);
19int fstatfs (int, struct statfs *);
20
21#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
22#define statfs64 statfs
23#define fstatfs64 fstatfs
24#define fsblkcnt64_t fsblkcnt_t
25#define fsfilcnt64_t fsfilcnt_t
26#endif
27
28#ifdef __cplusplus
29}
30#endif
31
32#endif
lib/libc/wasi/libc-top-half/musl/include/sys/swap.h deleted-21
......@@ -1,21 +0,0 @@
1#ifndef _SYS_SWAP_H
2#define _SYS_SWAP_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8
9#define SWAP_FLAG_PREFER 0x8000
10#define SWAP_FLAG_PRIO_MASK 0x7fff
11#define SWAP_FLAG_PRIO_SHIFT 0
12#define SWAP_FLAG_DISCARD 0x10000
13
14int swapon (const char *, int);
15int swapoff (const char *);
16
17#ifdef __cplusplus
18}
19#endif
20
21#endif
lib/libc/wasi/libc-top-half/musl/include/sys/syslog.h deleted-1
......@@ -1 +0,0 @@
1#include <syslog.h>
lib/libc/wasi/libc-top-half/musl/include/sys/sysmacros.h deleted-15
......@@ -1,15 +0,0 @@
1#ifndef _SYS_SYSMACROS_H
2#define _SYS_SYSMACROS_H
3
4#define major(x) \
5 ((unsigned)( (((x)>>31>>1) & 0xfffff000) | (((x)>>8) & 0x00000fff) ))
6#define minor(x) \
7 ((unsigned)( (((x)>>12) & 0xffffff00) | ((x) & 0x000000ff) ))
8
9#define makedev(x,y) ( \
10 (((x)&0xfffff000ULL) << 32) | \
11 (((x)&0x00000fffULL) << 8) | \
12 (((y)&0xffffff00ULL) << 12) | \
13 (((y)&0x000000ffULL)) )
14
15#endif
lib/libc/wasi/libc-top-half/musl/include/sys/termios.h deleted-2
......@@ -1,2 +0,0 @@
1#warning redirecting incorrect #include <sys/termios.h> to <termios.h>
2#include <termios.h>
lib/libc/wasi/libc-top-half/musl/include/sys/timerfd.h deleted-32
......@@ -1,32 +0,0 @@
1#ifndef _SYS_TIMERFD_H
2#define _SYS_TIMERFD_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <time.h>
9#include <fcntl.h>
10
11#define TFD_NONBLOCK O_NONBLOCK
12#define TFD_CLOEXEC O_CLOEXEC
13
14#define TFD_TIMER_ABSTIME 1
15#define TFD_TIMER_CANCEL_ON_SET (1 << 1)
16
17struct itimerspec;
18
19int timerfd_create(int, int);
20int timerfd_settime(int, int, const struct itimerspec *, struct itimerspec *);
21int timerfd_gettime(int, struct itimerspec *);
22
23#if _REDIR_TIME64
24__REDIR(timerfd_settime, __timerfd_settime64);
25__REDIR(timerfd_gettime, __timerfd_gettime64);
26#endif
27
28#ifdef __cplusplus
29}
30#endif
31
32#endif
lib/libc/wasi/libc-top-half/musl/include/sys/ucontext.h deleted-1
......@@ -1 +0,0 @@
1#include <ucontext.h>
lib/libc/wasi/libc-top-half/musl/include/sys/user.h deleted-16
......@@ -1,16 +0,0 @@
1#ifndef _SYS_USER_H
2#define _SYS_USER_H
3#ifdef __cplusplus
4extern "C" {
5#endif
6
7#include <limits.h>
8#include <stdint.h>
9#include <unistd.h>
10
11#include <bits/user.h>
12
13#ifdef __cplusplus
14}
15#endif
16#endif
lib/libc/wasi/libc-top-half/musl/include/sys/vfs.h deleted-1
......@@ -1 +0,0 @@
1#include <sys/statfs.h>
lib/libc/wasi/libc-top-half/musl/include/sys/vt.h deleted-1
......@@ -1 +0,0 @@
1#include <bits/vt.h>
lib/libc/wasi/libc-top-half/musl/include/sys/wait.h deleted-67
......@@ -1,67 +0,0 @@
1#ifndef _SYS_WAIT_H
2#define _SYS_WAIT_H
3#ifdef __cplusplus
4extern "C" {
5#endif
6
7#include <features.h>
8
9#define __NEED_pid_t
10#define __NEED_id_t
11#include <bits/alltypes.h>
12
13typedef enum {
14 P_ALL = 0,
15 P_PID = 1,
16 P_PGID = 2,
17 P_PIDFD = 3
18} idtype_t;
19
20pid_t wait (int *);
21pid_t waitpid (pid_t, int *, int );
22
23#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
24 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
25 || defined(_BSD_SOURCE)
26#include <signal.h>
27int waitid (idtype_t, id_t, siginfo_t *, int);
28#endif
29
30#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
31#include <sys/resource.h>
32pid_t wait3 (int *, int, struct rusage *);
33pid_t wait4 (pid_t, int *, int, struct rusage *);
34#endif
35
36#define WNOHANG 1
37#define WUNTRACED 2
38
39#define WSTOPPED 2
40#define WEXITED 4
41#define WCONTINUED 8
42#define WNOWAIT 0x1000000
43
44#define __WNOTHREAD 0x20000000
45#define __WALL 0x40000000
46#define __WCLONE 0x80000000
47
48#define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
49#define WTERMSIG(s) ((s) & 0x7f)
50#define WSTOPSIG(s) WEXITSTATUS(s)
51#define WCOREDUMP(s) ((s) & 0x80)
52#define WIFEXITED(s) (!WTERMSIG(s))
53#define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001)>>8) > 0x7f00)
54#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)
55#define WIFCONTINUED(s) ((s) == 0xffff)
56
57#if _REDIR_TIME64
58#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
59__REDIR(wait3, __wait3_time64);
60__REDIR(wait4, __wait4_time64);
61#endif
62#endif
63
64#ifdef __cplusplus
65}
66#endif
67#endif
lib/libc/wasi/libc-top-half/musl/include/sys/xattr.h deleted-32
......@@ -1,32 +0,0 @@
1#ifndef _SYS_XATTR_H
2#define _SYS_XATTR_H
3#ifdef __cplusplus
4extern "C" {
5#endif
6
7#define __NEED_ssize_t
8#define __NEED_size_t
9#include <bits/alltypes.h>
10
11#define XATTR_CREATE 1
12#define XATTR_REPLACE 2
13
14ssize_t getxattr(const char *, const char *, void *, size_t);
15ssize_t lgetxattr(const char *, const char *, void *, size_t);
16ssize_t fgetxattr(int, const char *, void *, size_t);
17ssize_t listxattr(const char *, char *, size_t);
18ssize_t llistxattr(const char *, char *, size_t);
19ssize_t flistxattr(int, char *, size_t);
20int setxattr(const char *, const char *, const void *, size_t, int);
21int lsetxattr(const char *, const char *, const void *, size_t, int);
22int fsetxattr(int, const char *, const void *, size_t, int);
23int removexattr(const char *, const char *);
24int lremovexattr(const char *, const char *);
25int fremovexattr(int, const char *);
26
27#define __UAPI_DEF_XATTR 0
28
29#ifdef __cplusplus
30}
31#endif
32#endif
lib/libc/wasi/libc-top-half/musl/include/syslog.h deleted-100
......@@ -1,100 +0,0 @@
1#ifndef _SYSLOG_H
2#define _SYSLOG_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <features.h>
9
10#define LOG_EMERG 0
11#define LOG_ALERT 1
12#define LOG_CRIT 2
13#define LOG_ERR 3
14#define LOG_WARNING 4
15#define LOG_NOTICE 5
16#define LOG_INFO 6
17#define LOG_DEBUG 7
18
19#define LOG_PRIMASK 7
20#define LOG_PRI(p) ((p)&LOG_PRIMASK)
21#define LOG_MAKEPRI(f, p) (((f)<<3)|(p))
22
23#define LOG_MASK(p) (1<<(p))
24#define LOG_UPTO(p) ((1<<((p)+1))-1)
25
26#define LOG_KERN (0<<3)
27#define LOG_USER (1<<3)
28#define LOG_MAIL (2<<3)
29#define LOG_DAEMON (3<<3)
30#define LOG_AUTH (4<<3)
31#define LOG_SYSLOG (5<<3)
32#define LOG_LPR (6<<3)
33#define LOG_NEWS (7<<3)
34#define LOG_UUCP (8<<3)
35#define LOG_CRON (9<<3)
36#define LOG_AUTHPRIV (10<<3)
37#define LOG_FTP (11<<3)
38
39#define LOG_LOCAL0 (16<<3)
40#define LOG_LOCAL1 (17<<3)
41#define LOG_LOCAL2 (18<<3)
42#define LOG_LOCAL3 (19<<3)
43#define LOG_LOCAL4 (20<<3)
44#define LOG_LOCAL5 (21<<3)
45#define LOG_LOCAL6 (22<<3)
46#define LOG_LOCAL7 (23<<3)
47
48#define LOG_NFACILITIES 24
49#define LOG_FACMASK 0x3f8
50#define LOG_FAC(p) (((p)&LOG_FACMASK)>>3)
51
52#define LOG_PID 0x01
53#define LOG_CONS 0x02
54#define LOG_ODELAY 0x04
55#define LOG_NDELAY 0x08
56#define LOG_NOWAIT 0x10
57#define LOG_PERROR 0x20
58
59void closelog (void);
60void openlog (const char *, int, int);
61int setlogmask (int);
62void syslog (int, const char *, ...);
63
64#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
65#define _PATH_LOG "/dev/log"
66#define __NEED_va_list
67#include <bits/alltypes.h>
68void vsyslog (int, const char *, va_list);
69#if defined(SYSLOG_NAMES)
70#define INTERNAL_NOPRI 0x10
71#define INTERNAL_MARK (LOG_NFACILITIES<<3)
72typedef struct {
73 char *c_name;
74 int c_val;
75} CODE;
76#define prioritynames ((CODE *)(const CODE []){ \
77 { "alert", LOG_ALERT }, { "crit", LOG_CRIT }, { "debug", LOG_DEBUG }, \
78 { "emerg", LOG_EMERG }, { "err", LOG_ERR }, { "error", LOG_ERR }, \
79 { "info", LOG_INFO }, { "none", INTERNAL_NOPRI }, \
80 { "notice", LOG_NOTICE }, { "panic", LOG_EMERG }, \
81 { "warn", LOG_WARNING }, { "warning", LOG_WARNING }, { 0, -1 } })
82#define facilitynames ((CODE *)(const CODE []){ \
83 { "auth", LOG_AUTH }, { "authpriv", LOG_AUTHPRIV }, \
84 { "cron", LOG_CRON }, { "daemon", LOG_DAEMON }, { "ftp", LOG_FTP }, \
85 { "kern", LOG_KERN }, { "lpr", LOG_LPR }, { "mail", LOG_MAIL }, \
86 { "mark", INTERNAL_MARK }, { "news", LOG_NEWS }, \
87 { "security", LOG_AUTH }, { "syslog", LOG_SYSLOG }, \
88 { "user", LOG_USER }, { "uucp", LOG_UUCP }, \
89 { "local0", LOG_LOCAL0 }, { "local1", LOG_LOCAL1 }, \
90 { "local2", LOG_LOCAL2 }, { "local3", LOG_LOCAL3 }, \
91 { "local4", LOG_LOCAL4 }, { "local5", LOG_LOCAL5 }, \
92 { "local6", LOG_LOCAL6 }, { "local7", LOG_LOCAL7 }, { 0, -1 } })
93#endif
94#endif
95
96#ifdef __cplusplus
97}
98#endif
99
100#endif
lib/libc/wasi/libc-top-half/musl/include/termios.h deleted-50
......@@ -1,50 +0,0 @@
1#ifndef _TERMIOS_H
2#define _TERMIOS_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <features.h>
9
10#define __NEED_pid_t
11#define __NEED_struct_winsize
12
13#include <bits/alltypes.h>
14
15typedef unsigned char cc_t;
16typedef unsigned int speed_t;
17typedef unsigned int tcflag_t;
18
19#define NCCS 32
20
21#include <bits/termios.h>
22
23speed_t cfgetospeed (const struct termios *);
24speed_t cfgetispeed (const struct termios *);
25int cfsetospeed (struct termios *, speed_t);
26int cfsetispeed (struct termios *, speed_t);
27
28int tcgetattr (int, struct termios *);
29int tcsetattr (int, int, const struct termios *);
30
31int tcgetwinsize (int, struct winsize *);
32int tcsetwinsize (int, const struct winsize *);
33
34int tcsendbreak (int, int);
35int tcdrain (int);
36int tcflush (int, int);
37int tcflow (int, int);
38
39pid_t tcgetsid (int);
40
41#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
42void cfmakeraw(struct termios *);
43int cfsetspeed(struct termios *, speed_t);
44#endif
45
46#ifdef __cplusplus
47}
48#endif
49
50#endif
lib/libc/wasi/libc-top-half/musl/include/ucontext.h deleted-25
......@@ -1,25 +0,0 @@
1#ifndef _UCONTEXT_H
2#define _UCONTEXT_H
3#ifdef __cplusplus
4extern "C" {
5#endif
6
7#include <features.h>
8
9#include <signal.h>
10
11#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
12#define NGREG (sizeof(gregset_t)/sizeof(greg_t))
13#endif
14
15struct __ucontext;
16
17int getcontext(struct __ucontext *);
18void makecontext(struct __ucontext *, void (*)(), int, ...);
19int setcontext(const struct __ucontext *);
20int swapcontext(struct __ucontext *, const struct __ucontext *);
21
22#ifdef __cplusplus
23}
24#endif
25#endif
lib/libc/wasi/libc-top-half/musl/include/ulimit.h deleted-17
......@@ -1,17 +0,0 @@
1#ifndef _ULIMIT_H
2#define _ULIMIT_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#define UL_GETFSIZE 1
9#define UL_SETFSIZE 2
10
11long ulimit (int, ...);
12
13#ifdef __cplusplus
14}
15#endif
16
17#endif
lib/libc/wasi/libc-top-half/musl/include/utmp.h deleted-52
......@@ -1,52 +0,0 @@
1#ifndef _UTMP_H
2#define _UTMP_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <utmpx.h>
9
10#define ACCOUNTING 9
11#define UT_NAMESIZE 32
12#define UT_HOSTSIZE 256
13#define UT_LINESIZE 32
14
15struct lastlog {
16 time_t ll_time;
17 char ll_line[UT_LINESIZE];
18 char ll_host[UT_HOSTSIZE];
19};
20
21#define ut_time ut_tv.tv_sec
22#define ut_name ut_user
23#define ut_addr ut_addr_v6[0]
24#define utmp utmpx
25#define e_exit __e_exit
26#define e_termination __e_termination
27
28void endutent(void);
29struct utmp *getutent(void);
30struct utmp *getutid(const struct utmp *);
31struct utmp *getutline(const struct utmp *);
32struct utmp *pututline(const struct utmp *);
33void setutent(void);
34
35void updwtmp(const char *, const struct utmp *);
36int utmpname(const char *);
37
38int login_tty(int);
39
40#define _PATH_UTMP "/dev/null/utmp"
41#define _PATH_WTMP "/dev/null/wtmp"
42
43#define UTMP_FILE _PATH_UTMP
44#define WTMP_FILE _PATH_WTMP
45#define UTMP_FILENAME _PATH_UTMP
46#define WTMP_FILENAME _PATH_WTMP
47
48#ifdef __cplusplus
49}
50#endif
51
52#endif
lib/libc/wasi/libc-top-half/musl/include/utmpx.h deleted-67
......@@ -1,67 +0,0 @@
1#ifndef _UTMPX_H
2#define _UTMPX_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <features.h>
9
10#define __NEED_pid_t
11#define __NEED_time_t
12#define __NEED_suseconds_t
13#define __NEED_struct_timeval
14
15#include <bits/alltypes.h>
16
17struct utmpx {
18 short ut_type;
19 short __ut_pad1;
20 pid_t ut_pid;
21 char ut_line[32];
22 char ut_id[4];
23 char ut_user[32];
24 char ut_host[256];
25 struct {
26 short __e_termination;
27 short __e_exit;
28 } ut_exit;
29#if __BYTE_ORDER == 1234
30 int ut_session, __ut_pad2;
31#else
32 int __ut_pad2, ut_session;
33#endif
34 struct timeval ut_tv;
35 unsigned ut_addr_v6[4];
36 char __unused[20];
37};
38
39void endutxent(void);
40struct utmpx *getutxent(void);
41struct utmpx *getutxid(const struct utmpx *);
42struct utmpx *getutxline(const struct utmpx *);
43struct utmpx *pututxline(const struct utmpx *);
44void setutxent(void);
45
46#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
47#define e_exit __e_exit
48#define e_termination __e_termination
49void updwtmpx(const char *, const struct utmpx *);
50int utmpxname(const char *);
51#endif
52
53#define EMPTY 0
54#define RUN_LVL 1
55#define BOOT_TIME 2
56#define NEW_TIME 3
57#define OLD_TIME 4
58#define INIT_PROCESS 5
59#define LOGIN_PROCESS 6
60#define USER_PROCESS 7
61#define DEAD_PROCESS 8
62
63#ifdef __cplusplus
64}
65#endif
66
67#endif
lib/libc/wasi/libc-top-half/musl/include/wait.h deleted-2
......@@ -1,2 +0,0 @@
1#warning redirecting incorrect #include <wait.h> to <sys/wait.h>
2#include <sys/wait.h>
lib/libc/wasi/libc-top-half/musl/include/wordexp.h deleted-41
......@@ -1,41 +0,0 @@
1#ifndef _WORDEXP_H
2#define _WORDEXP_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <features.h>
9
10#define __NEED_size_t
11
12#include <bits/alltypes.h>
13
14#define WRDE_DOOFFS 1
15#define WRDE_APPEND 2
16#define WRDE_NOCMD 4
17#define WRDE_REUSE 8
18#define WRDE_SHOWERR 16
19#define WRDE_UNDEF 32
20
21typedef struct {
22 size_t we_wordc;
23 char **we_wordv;
24 size_t we_offs;
25} wordexp_t;
26
27#define WRDE_NOSYS -1
28#define WRDE_NOSPACE 1
29#define WRDE_BADCHAR 2
30#define WRDE_BADVAL 3
31#define WRDE_CMDSUB 4
32#define WRDE_SYNTAX 5
33
34int wordexp (const char *__restrict, wordexp_t *__restrict, int);
35void wordfree (wordexp_t *);
36
37#ifdef __cplusplus
38}
39#endif
40
41#endif
lib/libc/wasi/libc-top-half/musl/src/include/pthread.h deleted-31
......@@ -1,31 +0,0 @@
1#ifndef PTHREAD_H
2#define PTHREAD_H
3
4#include "../../include/pthread.h"
5
6hidden int __pthread_once(pthread_once_t *, void (*)(void));
7hidden void __pthread_testcancel(void);
8hidden int __pthread_setcancelstate(int, int *);
9hidden int __pthread_create(pthread_t *restrict, const pthread_attr_t *restrict, void *(*)(void *), void *restrict);
10#ifdef __wasilibc_unmodified_upstream
11hidden _Noreturn void __pthread_exit(void *);
12#endif
13hidden int __pthread_join(pthread_t, void **);
14hidden int __pthread_mutex_lock(pthread_mutex_t *);
15hidden int __pthread_mutex_trylock(pthread_mutex_t *);
16hidden int __pthread_mutex_trylock_owner(pthread_mutex_t *);
17hidden int __pthread_mutex_timedlock(pthread_mutex_t *restrict, const struct timespec *restrict);
18hidden int __pthread_mutex_unlock(pthread_mutex_t *);
19hidden int __private_cond_signal(pthread_cond_t *, int);
20hidden int __pthread_cond_timedwait(pthread_cond_t *restrict, pthread_mutex_t *restrict, const struct timespec *restrict);
21hidden int __pthread_key_create(pthread_key_t *, void (*)(void *));
22hidden int __pthread_key_delete(pthread_key_t);
23hidden int __pthread_rwlock_rdlock(pthread_rwlock_t *);
24hidden int __pthread_rwlock_tryrdlock(pthread_rwlock_t *);
25hidden int __pthread_rwlock_timedrdlock(pthread_rwlock_t *__restrict, const struct timespec *__restrict);
26hidden int __pthread_rwlock_wrlock(pthread_rwlock_t *);
27hidden int __pthread_rwlock_trywrlock(pthread_rwlock_t *);
28hidden int __pthread_rwlock_timedwrlock(pthread_rwlock_t *__restrict, const struct timespec *__restrict);
29hidden int __pthread_rwlock_unlock(pthread_rwlock_t *);
30
31#endif
lib/libc/wasi/libc-top-half/musl/src/include/resolv.h deleted-12
......@@ -1,12 +0,0 @@
1#ifndef RESOLV_H
2#define RESOLV_H
3
4#include "../../include/resolv.h"
5
6hidden int __dn_expand(const unsigned char *, const unsigned char *, const unsigned char *, char *, int);
7
8hidden int __res_mkquery(int, const char *, int, int, const unsigned char *, int, const unsigned char*, unsigned char *, int);
9hidden int __res_send(const unsigned char *, int, unsigned char *, int);
10hidden int __res_msend(int, const unsigned char *const *, const int *, unsigned char *const *, int *, int);
11
12#endif
lib/libc/wasi/libc-top-half/musl/src/include/sys/auxv.h deleted-10
......@@ -1,10 +0,0 @@
1#ifndef SYS_AUXV_H
2#define SYS_AUXV_H
3
4#include "../../../include/sys/auxv.h"
5
6#include <features.h>
7
8hidden unsigned long __getauxval(unsigned long);
9
10#endif
lib/libc/wasi/libc-top-half/musl/src/include/sys/membarrier.h deleted-9
......@@ -1,9 +0,0 @@
1#ifndef SYS_MEMBARRIER_H
2#define SYS_MEMBARRIER_H
3
4#include "../../../include/sys/membarrier.h"
5#include <features.h>
6
7hidden int __membarrier(int, int);
8
9#endif
lib/libc/wasi/libc-top-half/musl/src/internal/locale_impl.h+8
......@@ -28,7 +28,15 @@ extern hidden const struct __locale_struct __c_dot_utf8_locale;
2828hidden const struct __locale_map *__get_locale(int, const char *);
2929hidden const char *__mo_lookup(const void *, size_t, const char *);
3030hidden const char *__lctrans(const char *, const struct __locale_map *);
31#ifdef __wasilibc_unmodified_upstream
3132hidden const char *__lctrans_cur(const char *);
33#else
34// We make this visible in the wasi-libc build because
35// libwasi-emulated-signal.so needs to import it from libc.so. If we ever
36// decide to merge libwasi-emulated-signal.so into libc.so, this will no longer
37// be necessary.
38const char *__lctrans_cur(const char *);
39#endif
3240hidden const char *__lctrans_impl(const char *, const struct __locale_map *);
3341hidden int __loc_is_allocated(locale_t);
3442hidden char *__gettextdomain(void);
lib/libc/wasi/libc-top-half/musl/src/ipc/ipc.h deleted-24
......@@ -1,24 +0,0 @@
1#include "syscall.h"
2
3#define IPCOP_semop 1
4#define IPCOP_semget 2
5#define IPCOP_semctl 3
6#define IPCOP_semtimedop 4
7#define IPCOP_msgsnd 11
8#define IPCOP_msgrcv 12
9#define IPCOP_msgget 13
10#define IPCOP_msgctl 14
11#define IPCOP_shmat 21
12#define IPCOP_shmdt 22
13#define IPCOP_shmget 23
14#define IPCOP_shmctl 24
15
16#ifndef IPC_64
17#define IPC_64 0x100
18#endif
19
20#define IPC_TIME64 (IPC_STAT & 0x100)
21
22#define IPC_CMD(cmd) (((cmd) & ~IPC_TIME64) | IPC_64)
23
24#define IPC_HILO(b,t) ((b)->t = (b)->__##t##_lo | 0LL+(b)->__##t##_hi<<32)
lib/libc/wasi/libc-top-half/musl/src/malloc/mallocng/glue.h deleted-93
......@@ -1,93 +0,0 @@
1#ifndef MALLOC_GLUE_H
2#define MALLOC_GLUE_H
3
4#include <stdint.h>
5#include <sys/mman.h>
6#include <pthread.h>
7#include <unistd.h>
8#include <elf.h>
9#include <string.h>
10#include "atomic.h"
11#include "syscall.h"
12#include "libc.h"
13#include "lock.h"
14#include "dynlink.h"
15
16// use macros to appropriately namespace these.
17#define size_classes __malloc_size_classes
18#define ctx __malloc_context
19#define alloc_meta __malloc_alloc_meta
20#define is_allzero __malloc_allzerop
21#define dump_heap __dump_heap
22
23#define malloc __libc_malloc_impl
24#define realloc __libc_realloc
25#define free __libc_free
26
27#if USE_REAL_ASSERT
28#include <assert.h>
29#else
30#undef assert
31#define assert(x) do { if (!(x)) a_crash(); } while(0)
32#endif
33
34#define brk(p) ((uintptr_t)__syscall(SYS_brk, p))
35
36#define mmap __mmap
37#define madvise __madvise
38#define mremap __mremap
39
40#define DISABLE_ALIGNED_ALLOC (__malloc_replaced && !__aligned_alloc_replaced)
41
42static inline uint64_t get_random_secret()
43{
44 uint64_t secret = (uintptr_t)&secret * 1103515245;
45 for (size_t i=0; libc.auxv[i]; i+=2)
46 if (libc.auxv[i]==AT_RANDOM)
47 memcpy(&secret, (char *)libc.auxv[i+1]+8, sizeof secret);
48 return secret;
49}
50
51#ifndef PAGESIZE
52#define PAGESIZE PAGE_SIZE
53#endif
54
55#define MT (libc.need_locks)
56
57#define RDLOCK_IS_EXCLUSIVE 1
58
59__attribute__((__visibility__("hidden")))
60extern int __malloc_lock[1];
61
62#define LOCK_OBJ_DEF \
63int __malloc_lock[1]; \
64void __malloc_atfork(int who) { malloc_atfork(who); }
65
66static inline void rdlock()
67{
68 if (MT) LOCK(__malloc_lock);
69}
70static inline void wrlock()
71{
72 if (MT) LOCK(__malloc_lock);
73}
74static inline void unlock()
75{
76 UNLOCK(__malloc_lock);
77}
78static inline void upgradelock()
79{
80}
81static inline void resetlock()
82{
83 __malloc_lock[0] = 0;
84}
85
86static inline void malloc_atfork(int who)
87{
88 if (who<0) rdlock();
89 else if (who>0) resetlock();
90 else unlock();
91}
92
93#endif
lib/libc/wasi/libc-top-half/musl/src/malloc/mallocng/meta.h deleted-288
......@@ -1,288 +0,0 @@
1#ifndef MALLOC_META_H
2#define MALLOC_META_H
3
4#include <stdint.h>
5#include <errno.h>
6#include <limits.h>
7#include "glue.h"
8
9__attribute__((__visibility__("hidden")))
10extern const uint16_t size_classes[];
11
12#define MMAP_THRESHOLD 131052
13
14#define UNIT 16
15#define IB 4
16
17struct group {
18 struct meta *meta;
19 unsigned char active_idx:5;
20 char pad[UNIT - sizeof(struct meta *) - 1];
21 unsigned char storage[];
22};
23
24struct meta {
25 struct meta *prev, *next;
26 struct group *mem;
27 volatile int avail_mask, freed_mask;
28 uintptr_t last_idx:5;
29 uintptr_t freeable:1;
30 uintptr_t sizeclass:6;
31 uintptr_t maplen:8*sizeof(uintptr_t)-12;
32};
33
34struct meta_area {
35 uint64_t check;
36 struct meta_area *next;
37 int nslots;
38 struct meta slots[];
39};
40
41struct malloc_context {
42 uint64_t secret;
43#ifndef PAGESIZE
44 size_t pagesize;
45#endif
46 int init_done;
47 unsigned mmap_counter;
48 struct meta *free_meta_head;
49 struct meta *avail_meta;
50 size_t avail_meta_count, avail_meta_area_count, meta_alloc_shift;
51 struct meta_area *meta_area_head, *meta_area_tail;
52 unsigned char *avail_meta_areas;
53 struct meta *active[48];
54 size_t usage_by_class[48];
55 uint8_t unmap_seq[32], bounces[32];
56 uint8_t seq;
57 uintptr_t brk;
58};
59
60__attribute__((__visibility__("hidden")))
61extern struct malloc_context ctx;
62
63#ifdef PAGESIZE
64#define PGSZ PAGESIZE
65#else
66#define PGSZ ctx.pagesize
67#endif
68
69__attribute__((__visibility__("hidden")))
70struct meta *alloc_meta(void);
71
72__attribute__((__visibility__("hidden")))
73int is_allzero(void *);
74
75static inline void queue(struct meta **phead, struct meta *m)
76{
77 assert(!m->next);
78 assert(!m->prev);
79 if (*phead) {
80 struct meta *head = *phead;
81 m->next = head;
82 m->prev = head->prev;
83 m->next->prev = m->prev->next = m;
84 } else {
85 m->prev = m->next = m;
86 *phead = m;
87 }
88}
89
90static inline void dequeue(struct meta **phead, struct meta *m)
91{
92 if (m->next != m) {
93 m->prev->next = m->next;
94 m->next->prev = m->prev;
95 if (*phead == m) *phead = m->next;
96 } else {
97 *phead = 0;
98 }
99 m->prev = m->next = 0;
100}
101
102static inline struct meta *dequeue_head(struct meta **phead)
103{
104 struct meta *m = *phead;
105 if (m) dequeue(phead, m);
106 return m;
107}
108
109static inline void free_meta(struct meta *m)
110{
111 *m = (struct meta){0};
112 queue(&ctx.free_meta_head, m);
113}
114
115static inline uint32_t activate_group(struct meta *m)
116{
117 assert(!m->avail_mask);
118 uint32_t mask, act = (2u<<m->mem->active_idx)-1;
119 do mask = m->freed_mask;
120 while (a_cas(&m->freed_mask, mask, mask&~act)!=mask);
121 return m->avail_mask = mask & act;
122}
123
124static inline int get_slot_index(const unsigned char *p)
125{
126 return p[-3] & 31;
127}
128
129static inline struct meta *get_meta(const unsigned char *p)
130{
131 assert(!((uintptr_t)p & 15));
132 int offset = *(const uint16_t *)(p - 2);
133 int index = get_slot_index(p);
134 if (p[-4]) {
135 assert(!offset);
136 offset = *(uint32_t *)(p - 8);
137 assert(offset > 0xffff);
138 }
139 const struct group *base = (const void *)(p - UNIT*offset - UNIT);
140 const struct meta *meta = base->meta;
141 assert(meta->mem == base);
142 assert(index <= meta->last_idx);
143 assert(!(meta->avail_mask & (1u<<index)));
144 assert(!(meta->freed_mask & (1u<<index)));
145 const struct meta_area *area = (void *)((uintptr_t)meta & -4096);
146 assert(area->check == ctx.secret);
147 if (meta->sizeclass < 48) {
148 assert(offset >= size_classes[meta->sizeclass]*index);
149 assert(offset < size_classes[meta->sizeclass]*(index+1));
150 } else {
151 assert(meta->sizeclass == 63);
152 }
153 if (meta->maplen) {
154 assert(offset <= meta->maplen*4096UL/UNIT - 1);
155 }
156 return (struct meta *)meta;
157}
158
159static inline size_t get_nominal_size(const unsigned char *p, const unsigned char *end)
160{
161 size_t reserved = p[-3] >> 5;
162 if (reserved >= 5) {
163 assert(reserved == 5);
164 reserved = *(const uint32_t *)(end-4);
165 assert(reserved >= 5);
166 assert(!end[-5]);
167 }
168 assert(reserved <= end-p);
169 assert(!*(end-reserved));
170 // also check the slot's overflow byte
171 assert(!*end);
172 return end-reserved-p;
173}
174
175static inline size_t get_stride(const struct meta *g)
176{
177 if (!g->last_idx && g->maplen) {
178 return g->maplen*4096UL - UNIT;
179 } else {
180 return UNIT*size_classes[g->sizeclass];
181 }
182}
183
184static inline void set_size(unsigned char *p, unsigned char *end, size_t n)
185{
186 int reserved = end-p-n;
187 if (reserved) end[-reserved] = 0;
188 if (reserved >= 5) {
189 *(uint32_t *)(end-4) = reserved;
190 end[-5] = 0;
191 reserved = 5;
192 }
193 p[-3] = (p[-3]&31) + (reserved<<5);
194}
195
196static inline void *enframe(struct meta *g, int idx, size_t n, int ctr)
197{
198 size_t stride = get_stride(g);
199 size_t slack = (stride-IB-n)/UNIT;
200 unsigned char *p = g->mem->storage + stride*idx;
201 unsigned char *end = p+stride-IB;
202 // cycle offset within slot to increase interval to address
203 // reuse, facilitate trapping double-free.
204 int off = (p[-3] ? *(uint16_t *)(p-2) + 1 : ctr) & 255;
205 assert(!p[-4]);
206 if (off > slack) {
207 size_t m = slack;
208 m |= m>>1; m |= m>>2; m |= m>>4;
209 off &= m;
210 if (off > slack) off -= slack+1;
211 assert(off <= slack);
212 }
213 if (off) {
214 // store offset in unused header at offset zero
215 // if enframing at non-zero offset.
216 *(uint16_t *)(p-2) = off;
217 p[-3] = 7<<5;
218 p += UNIT*off;
219 // for nonzero offset there is no permanent check
220 // byte, so make one.
221 p[-4] = 0;
222 }
223 *(uint16_t *)(p-2) = (size_t)(p-g->mem->storage)/UNIT;
224 p[-3] = idx;
225 set_size(p, end, n);
226 return p;
227}
228
229static inline int size_to_class(size_t n)
230{
231 n = (n+IB-1)>>4;
232 if (n<10) return n;
233 n++;
234 int i = (28-a_clz_32(n))*4 + 8;
235 if (n>size_classes[i+1]) i+=2;
236 if (n>size_classes[i]) i++;
237 return i;
238}
239
240static inline int size_overflows(size_t n)
241{
242 if (n >= SIZE_MAX/2 - 4096) {
243 errno = ENOMEM;
244 return 1;
245 }
246 return 0;
247}
248
249static inline void step_seq(void)
250{
251 if (ctx.seq==255) {
252 for (int i=0; i<32; i++) ctx.unmap_seq[i] = 0;
253 ctx.seq = 1;
254 } else {
255 ctx.seq++;
256 }
257}
258
259static inline void record_seq(int sc)
260{
261 if (sc-7U < 32) ctx.unmap_seq[sc-7] = ctx.seq;
262}
263
264static inline void account_bounce(int sc)
265{
266 if (sc-7U < 32) {
267 int seq = ctx.unmap_seq[sc-7];
268 if (seq && ctx.seq-seq < 10) {
269 if (ctx.bounces[sc-7]+1 < 100)
270 ctx.bounces[sc-7]++;
271 else
272 ctx.bounces[sc-7] = 150;
273 }
274 }
275}
276
277static inline void decay_bounces(int sc)
278{
279 if (sc-7U < 32 && ctx.bounces[sc-7])
280 ctx.bounces[sc-7]--;
281}
282
283static inline int is_bouncing(int sc)
284{
285 return (sc-7U < 32 && ctx.bounces[sc-7] >= 100);
286}
287
288#endif
lib/libc/wasi/libc-top-half/musl/src/malloc/oldmalloc/malloc_impl.h deleted-39
......@@ -1,39 +0,0 @@
1#ifndef MALLOC_IMPL_H
2#define MALLOC_IMPL_H
3
4#include <sys/mman.h>
5#include "dynlink.h"
6
7struct chunk {
8 size_t psize, csize;
9 struct chunk *next, *prev;
10};
11
12struct bin {
13 volatile int lock[2];
14 struct chunk *head;
15 struct chunk *tail;
16};
17
18#define SIZE_ALIGN (4*sizeof(size_t))
19#define SIZE_MASK (-SIZE_ALIGN)
20#define OVERHEAD (2*sizeof(size_t))
21#define MMAP_THRESHOLD (0x1c00*SIZE_ALIGN)
22#define DONTCARE 16
23#define RECLAIM 163840
24
25#define CHUNK_SIZE(c) ((c)->csize & -2)
26#define CHUNK_PSIZE(c) ((c)->psize & -2)
27#define PREV_CHUNK(c) ((struct chunk *)((char *)(c) - CHUNK_PSIZE(c)))
28#define NEXT_CHUNK(c) ((struct chunk *)((char *)(c) + CHUNK_SIZE(c)))
29#define MEM_TO_CHUNK(p) (struct chunk *)((char *)(p) - OVERHEAD)
30#define CHUNK_TO_MEM(c) (void *)((char *)(c) + OVERHEAD)
31#define BIN_TO_CHUNK(i) (MEM_TO_CHUNK(&mal.bins[i].head))
32
33#define C_INUSE ((size_t)1)
34
35#define IS_MMAPPED(c) !((c)->csize & (C_INUSE))
36
37hidden void __bin_chunk(struct chunk *);
38
39#endif
lib/libc/wasi/libc-top-half/musl/src/misc/realpath.c created+156
......@@ -0,0 +1,156 @@
1#include <stdlib.h>
2#include <limits.h>
3#include <errno.h>
4#include <unistd.h>
5#include <string.h>
6
7static size_t slash_len(const char *s)
8{
9 const char *s0 = s;
10 while (*s == '/') s++;
11 return s-s0;
12}
13
14char *realpath(const char *restrict filename, char *restrict resolved)
15{
16 char stack[PATH_MAX+1];
17 char output[PATH_MAX];
18 size_t p, q, l, l0, cnt=0, nup=0;
19 int check_dir=0;
20
21 if (!filename) {
22 errno = EINVAL;
23 return 0;
24 }
25 l = strnlen(filename, sizeof stack);
26 if (!l) {
27 errno = ENOENT;
28 return 0;
29 }
30 if (l >= PATH_MAX) goto toolong;
31 p = sizeof stack - l - 1;
32 q = 0;
33 memcpy(stack+p, filename, l+1);
34
35 /* Main loop. Each iteration pops the next part from stack of
36 * remaining path components and consumes any slashes that follow.
37 * If not a link, it's moved to output; if a link, contents are
38 * pushed to the stack. */
39restart:
40 for (; ; p+=slash_len(stack+p)) {
41 /* If stack starts with /, the whole component is / or //
42 * and the output state must be reset. */
43 if (stack[p] == '/') {
44 check_dir=0;
45 nup=0;
46 q=0;
47 output[q++] = '/';
48 p++;
49 /* Initial // is special. */
50 if (stack[p] == '/' && stack[p+1] != '/')
51 output[q++] = '/';
52 continue;
53 }
54
55 char *z = __strchrnul(stack+p, '/');
56 l0 = l = z-(stack+p);
57
58 if (!l && !check_dir) break;
59
60 /* Skip any . component but preserve check_dir status. */
61 if (l==1 && stack[p]=='.') {
62 p += l;
63 continue;
64 }
65
66 /* Copy next component onto output at least temporarily, to
67 * call readlink, but wait to advance output position until
68 * determining it's not a link. */
69 if (q && output[q-1] != '/') {
70 if (!p) goto toolong;
71 stack[--p] = '/';
72 l++;
73 }
74 if (q+l >= PATH_MAX) goto toolong;
75 memcpy(output+q, stack+p, l);
76 output[q+l] = 0;
77 p += l;
78
79 int up = 0;
80 if (l0==2 && stack[p-2]=='.' && stack[p-1]=='.') {
81 up = 1;
82 /* Any non-.. path components we could cancel start
83 * after nup repetitions of the 3-byte string "../";
84 * if there are none, accumulate .. components to
85 * later apply to cwd, if needed. */
86 if (q <= 3*nup) {
87 nup++;
88 q += l;
89 continue;
90 }
91 /* When previous components are already known to be
92 * directories, processing .. can skip readlink. */
93 if (!check_dir) goto skip_readlink;
94 }
95 ssize_t k = readlink(output, stack, p);
96 if (k==p) goto toolong;
97 if (!k) {
98 errno = ENOENT;
99 return 0;
100 }
101 if (k<0) {
102 if (errno != EINVAL) return 0;
103skip_readlink:
104 check_dir = 0;
105 if (up) {
106 while(q && output[q-1]!='/') q--;
107 if (q>1 && (q>2 || output[0]!='/')) q--;
108 continue;
109 }
110 if (l0) q += l;
111 check_dir = stack[p];
112 continue;
113 }
114 if (++cnt == SYMLOOP_MAX) {
115 errno = ELOOP;
116 return 0;
117 }
118
119 /* If link contents end in /, strip any slashes already on
120 * stack to avoid /->// or //->/// or spurious toolong. */
121 if (stack[k-1]=='/') while (stack[p]=='/') p++;
122 p -= k;
123 memmove(stack+p, stack, k);
124
125 /* Skip the stack advancement in case we have a new
126 * absolute base path. */
127 goto restart;
128 }
129
130 output[q] = 0;
131
132 if (output[0] != '/') {
133 if (!getcwd(stack, sizeof stack)) return 0;
134 l = strlen(stack);
135 /* Cancel any initial .. components. */
136 p = 0;
137 while (nup--) {
138 while(l>1 && stack[l-1]!='/') l--;
139 if (l>1) l--;
140 p += 2;
141 if (p<q) p++;
142 }
143 if (q-p && stack[l-1]!='/') stack[l++] = '/';
144 if (l + (q-p) + 1 >= PATH_MAX) goto toolong;
145 memmove(output + l, output + p, q - p + 1);
146 memcpy(output, stack, l);
147 q = l + q-p;
148 }
149
150 if (resolved) return memcpy(resolved, output, q+1);
151 else return strdup(output);
152
153toolong:
154 errno = ENAMETOOLONG;
155 return 0;
156}
lib/libc/wasi/libc-top-half/musl/src/passwd/nscd.h deleted-44
......@@ -1,44 +0,0 @@
1#ifndef NSCD_H
2#define NSCD_H
3
4#include <stdint.h>
5
6#define NSCDVERSION 2
7#define GETPWBYNAME 0
8#define GETPWBYUID 1
9#define GETGRBYNAME 2
10#define GETGRBYGID 3
11#define GETINITGR 15
12
13#define REQVERSION 0
14#define REQTYPE 1
15#define REQKEYLEN 2
16#define REQ_LEN 3
17
18#define PWVERSION 0
19#define PWFOUND 1
20#define PWNAMELEN 2
21#define PWPASSWDLEN 3
22#define PWUID 4
23#define PWGID 5
24#define PWGECOSLEN 6
25#define PWDIRLEN 7
26#define PWSHELLLEN 8
27#define PW_LEN 9
28
29#define GRVERSION 0
30#define GRFOUND 1
31#define GRNAMELEN 2
32#define GRPASSWDLEN 3
33#define GRGID 4
34#define GRMEMCNT 5
35#define GR_LEN 6
36
37#define INITGRVERSION 0
38#define INITGRFOUND 1
39#define INITGRNGRPS 2
40#define INITGR_LEN 3
41
42hidden FILE *__nscd_query(int32_t req, const char *key, int32_t *buf, size_t len, int *swap);
43
44#endif
lib/libc/wasi/libc-top-half/musl/src/passwd/pwf.h deleted-15
......@@ -1,15 +0,0 @@
1#include <pwd.h>
2#include <grp.h>
3#include <shadow.h>
4#include <stdio.h>
5#include <errno.h>
6#include <stdint.h>
7#include <stdlib.h>
8#include <string.h>
9#include <limits.h>
10
11hidden int __getpwent_a(FILE *f, struct passwd *pw, char **line, size_t *size, struct passwd **res);
12hidden int __getpw_a(const char *name, uid_t uid, struct passwd *pw, char **buf, size_t *size, struct passwd **res);
13hidden int __getgrent_a(FILE *f, struct group *gr, char **line, size_t *size, char ***mem, size_t *nmem, struct group **res);
14hidden int __getgr_a(const char *name, gid_t gid, struct group *gr, char **buf, size_t *size, char ***mem, size_t *nmem, struct group **res);
15hidden int __parsespent(char *s, struct spwd *sp);
lib/libc/wasi/libc-top-half/musl/src/process/fdop.h deleted-17
......@@ -1,17 +0,0 @@
1#define FDOP_CLOSE 1
2#define FDOP_DUP2 2
3#define FDOP_OPEN 3
4#define FDOP_CHDIR 4
5#define FDOP_FCHDIR 5
6
7struct fdop {
8 struct fdop *next, *prev;
9 int cmd, fd, srcfd, oflag;
10 mode_t mode;
11 char path[];
12};
13
14#define malloc __libc_malloc
15#define calloc __libc_calloc
16#define realloc undef
17#define free __libc_free
src/wasi_libc.zig+2-1
......@@ -490,7 +490,7 @@ const libc_bottom_half_src_files = [_][]const u8{
490490 "wasi/libc-bottom-half/sources/__wasilibc_tell.c",
491491 "wasi/libc-bottom-half/sources/__wasilibc_unlinkat.c",
492492 "wasi/libc-bottom-half/sources/abort.c",
493 "wasi/libc-bottom-half/sources/accept.c",
493 "wasi/libc-bottom-half/sources/accept-wasip1.c",
494494 "wasi/libc-bottom-half/sources/at_fdcwd.c",
495495 "wasi/libc-bottom-half/sources/complex-builtins.c",
496496 "wasi/libc-bottom-half/sources/environ.c",
......@@ -521,6 +521,7 @@ const libc_top_half_src_files = [_][]const u8{
521521 "wasi/libc-top-half/musl/src/misc/getopt.c",
522522 "wasi/libc-top-half/musl/src/misc/getopt_long.c",
523523 "wasi/libc-top-half/musl/src/misc/getsubopt.c",
524 "wasi/libc-top-half/musl/src/misc/realpath.c",
524525 "wasi/libc-top-half/musl/src/misc/uname.c",
525526 "wasi/libc-top-half/musl/src/misc/nftw.c",
526527 "wasi/libc-top-half/musl/src/errno/strerror.c",