cc,wasi: remove unused headers and sources

This commit is contained in:
Jakub Konka 2021-05-19 22:26:23 +02:00
parent 6d5002028a
commit f291b8b9bc
624 changed files with 0 additions and 35900 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,170 +0,0 @@
#include <__errno.h>
#include <__errno_values.h>
#include <__fd_set.h>
#include <__function___isatty.h>
#include <__functions_malloc.h>
#include <__functions_memcpy.h>
#include <__header_dirent.h>
#include <__header_fcntl.h>
#include <__header_inttypes.h>
#include <__header_netinet_in.h>
#include <__header_poll.h>
#include <__header_stdlib.h>
#include <__header_string.h>
#include <__header_sys_ioctl.h>
#include <__header_sys_resource.h>
#include <__header_sys_socket.h>
#include <__header_sys_stat.h>
#include <__header_time.h>
#include <__header_unistd.h>
#include <__macro_FD_SETSIZE.h>
#include <__macro_PAGESIZE.h>
#include <__mode_t.h>
#include <__seek.h>
#include <__struct_dirent.h>
#include <__struct_in6_addr.h>
#include <__struct_in_addr.h>
#include <__struct_iovec.h>
#include <__struct_msghdr.h>
#include <__struct_pollfd.h>
#include <__struct_rusage.h>
#include <__struct_sockaddr.h>
#include <__struct_sockaddr_in.h>
#include <__struct_sockaddr_in6.h>
#include <__struct_sockaddr_storage.h>
#include <__struct_sockaddr_un.h>
#include <__struct_stat.h>
#include <__struct_timespec.h>
#include <__struct_timeval.h>
#include <__struct_tm.h>
#include <__struct_tms.h>
#include <__typedef_DIR.h>
#include <__typedef_blkcnt_t.h>
#include <__typedef_blksize_t.h>
#include <__typedef_clock_t.h>
#include <__typedef_clockid_t.h>
#include <__typedef_dev_t.h>
#include <__typedef_fd_set.h>
#include <__typedef_gid_t.h>
#include <__typedef_in_addr_t.h>
#include <__typedef_in_port_t.h>
#include <__typedef_ino_t.h>
#include <__typedef_mode_t.h>
#include <__typedef_nfds_t.h>
#include <__typedef_nlink_t.h>
#include <__typedef_off_t.h>
#include <__typedef_sa_family_t.h>
#include <__typedef_sigset_t.h>
#include <__typedef_socklen_t.h>
#include <__typedef_ssize_t.h>
#include <__typedef_suseconds_t.h>
#include <__typedef_time_t.h>
#include <__typedef_uid_t.h>
#include <alloca.h>
#include <ar.h>
#include <arpa/ftp.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
#include <arpa/nameser_compat.h>
#include <arpa/telnet.h>
#include <arpa/tftp.h>
#include <assert.h>
#include <byteswap.h>
#include <complex.h>
#include <cpio.h>
#include <crypt.h>
#include <ctype.h>
#include <dirent.h>
#include <endian.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <features.h>
#include <fenv.h>
#include <float.h>
#include <fmtmsg.h>
#include <fnmatch.h>
#include <ftw.h>
#include <getopt.h>
#include <glob.h>
#include <iconv.h>
#include <ifaddrs.h>
#include <inttypes.h>
#include <iso646.h>
#include <langinfo.h>
#include <libgen.h>
#include <limits.h>
#include <locale.h>
#include <malloc.h>
#include <math.h>
#include <memory.h>
#include <monetary.h>
#include <mqueue.h>
#include <netinet/icmp6.h>
#include <netinet/igmp.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/ip6.h>
#include <netinet/ip_icmp.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <netpacket/packet.h>
#include <nl_types.h>
#include <poll.h>
#include <regex.h>
#include <sched.h>
#include <search.h>
#include <semaphore.h>
#include <stdalign.h>
#include <stdbool.h>
#include <stdc-predef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdio_ext.h>
#include <stdlib.h>
#include <stdnoreturn.h>
#include <string.h>
#include <strings.h>
#include <stropts.h>
#include <sys/dir.h>
#include <sys/errno.h>
#include <sys/eventfd.h>
#include <sys/fcntl.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <sys/param.h>
#include <sys/poll.h>
#include <sys/random.h>
#include <sys/reg.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/stropts.h>
#include <sys/syscall.h>
#include <sys/sysinfo.h>
#include <sys/time.h>
#include <sys/timeb.h>
#include <sys/timex.h>
#include <sys/ttydefaults.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <sys/un.h>
#include <sys/utsname.h>
#include <syscall.h>
#include <sysexits.h>
#include <tar.h>
#include <tgmath.h>
#include <threads.h>
#include <time.h>
#include <uchar.h>
#include <unistd.h>
#include <utime.h>
#include <values.h>
#include <wasi/api.h>
#include <wasi/libc-environ.h>
#include <wasi/libc-find-relpath.h>
#include <wasi/libc-nocwd.h>
#include <wasi/libc.h>
#include <wchar.h>
#include <wctype.h>

File diff suppressed because it is too large Load Diff

View File

@ -1,68 +0,0 @@
__addtf3
__divtf3
__eqtf2
__extenddftf2
__extendsftf2
__fixtfdi
__fixtfsi
__fixunstfsi
__floatsitf
__floatunsitf
__getf2
__gttf2
__heap_base
__imported_wasi_snapshot_preview1_args_get
__imported_wasi_snapshot_preview1_args_sizes_get
__imported_wasi_snapshot_preview1_clock_res_get
__imported_wasi_snapshot_preview1_clock_time_get
__imported_wasi_snapshot_preview1_environ_get
__imported_wasi_snapshot_preview1_environ_sizes_get
__imported_wasi_snapshot_preview1_fd_advise
__imported_wasi_snapshot_preview1_fd_allocate
__imported_wasi_snapshot_preview1_fd_close
__imported_wasi_snapshot_preview1_fd_datasync
__imported_wasi_snapshot_preview1_fd_fdstat_get
__imported_wasi_snapshot_preview1_fd_fdstat_set_flags
__imported_wasi_snapshot_preview1_fd_fdstat_set_rights
__imported_wasi_snapshot_preview1_fd_filestat_get
__imported_wasi_snapshot_preview1_fd_filestat_set_size
__imported_wasi_snapshot_preview1_fd_filestat_set_times
__imported_wasi_snapshot_preview1_fd_pread
__imported_wasi_snapshot_preview1_fd_prestat_dir_name
__imported_wasi_snapshot_preview1_fd_prestat_get
__imported_wasi_snapshot_preview1_fd_pwrite
__imported_wasi_snapshot_preview1_fd_read
__imported_wasi_snapshot_preview1_fd_readdir
__imported_wasi_snapshot_preview1_fd_renumber
__imported_wasi_snapshot_preview1_fd_seek
__imported_wasi_snapshot_preview1_fd_sync
__imported_wasi_snapshot_preview1_fd_tell
__imported_wasi_snapshot_preview1_fd_write
__imported_wasi_snapshot_preview1_path_create_directory
__imported_wasi_snapshot_preview1_path_filestat_get
__imported_wasi_snapshot_preview1_path_filestat_set_times
__imported_wasi_snapshot_preview1_path_link
__imported_wasi_snapshot_preview1_path_open
__imported_wasi_snapshot_preview1_path_readlink
__imported_wasi_snapshot_preview1_path_remove_directory
__imported_wasi_snapshot_preview1_path_rename
__imported_wasi_snapshot_preview1_path_symlink
__imported_wasi_snapshot_preview1_path_unlink_file
__imported_wasi_snapshot_preview1_poll_oneoff
__imported_wasi_snapshot_preview1_proc_exit
__imported_wasi_snapshot_preview1_proc_raise
__imported_wasi_snapshot_preview1_random_get
__imported_wasi_snapshot_preview1_sched_yield
__imported_wasi_snapshot_preview1_sock_recv
__imported_wasi_snapshot_preview1_sock_send
__imported_wasi_snapshot_preview1_sock_shutdown
__letf2
__lttf2
__netf2
__stack_pointer
__subtf3
__trunctfdf2
__trunctfsf2
__unordtf2
__wasm_call_ctors
main

View File

@ -1,20 +0,0 @@
#ifndef __wasilibc___errno_h
#define __wasilibc___errno_h
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
extern thread_local int errno;
#else
extern _Thread_local int errno;
#endif
#define errno errno
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,86 +0,0 @@
#ifndef __wasilibc___errno_values_h
#define __wasilibc___errno_values_h
#include <wasi/api.h>
#define E2BIG __WASI_ERRNO_2BIG
#define EACCES __WASI_ERRNO_ACCES
#define EADDRINUSE __WASI_ERRNO_ADDRINUSE
#define EADDRNOTAVAIL __WASI_ERRNO_ADDRNOTAVAIL
#define EAFNOSUPPORT __WASI_ERRNO_AFNOSUPPORT
#define EAGAIN __WASI_ERRNO_AGAIN
#define EALREADY __WASI_ERRNO_ALREADY
#define EBADF __WASI_ERRNO_BADF
#define EBADMSG __WASI_ERRNO_BADMSG
#define EBUSY __WASI_ERRNO_BUSY
#define ECANCELED __WASI_ERRNO_CANCELED
#define ECHILD __WASI_ERRNO_CHILD
#define ECONNABORTED __WASI_ERRNO_CONNABORTED
#define ECONNREFUSED __WASI_ERRNO_CONNREFUSED
#define ECONNRESET __WASI_ERRNO_CONNRESET
#define EDEADLK __WASI_ERRNO_DEADLK
#define EDESTADDRREQ __WASI_ERRNO_DESTADDRREQ
#define EDOM __WASI_ERRNO_DOM
#define EDQUOT __WASI_ERRNO_DQUOT
#define EEXIST __WASI_ERRNO_EXIST
#define EFAULT __WASI_ERRNO_FAULT
#define EFBIG __WASI_ERRNO_FBIG
#define EHOSTUNREACH __WASI_ERRNO_HOSTUNREACH
#define EIDRM __WASI_ERRNO_IDRM
#define EILSEQ __WASI_ERRNO_ILSEQ
#define EINPROGRESS __WASI_ERRNO_INPROGRESS
#define EINTR __WASI_ERRNO_INTR
#define EINVAL __WASI_ERRNO_INVAL
#define EIO __WASI_ERRNO_IO
#define EISCONN __WASI_ERRNO_ISCONN
#define EISDIR __WASI_ERRNO_ISDIR
#define ELOOP __WASI_ERRNO_LOOP
#define EMFILE __WASI_ERRNO_MFILE
#define EMLINK __WASI_ERRNO_MLINK
#define EMSGSIZE __WASI_ERRNO_MSGSIZE
#define EMULTIHOP __WASI_ERRNO_MULTIHOP
#define ENAMETOOLONG __WASI_ERRNO_NAMETOOLONG
#define ENETDOWN __WASI_ERRNO_NETDOWN
#define ENETRESET __WASI_ERRNO_NETRESET
#define ENETUNREACH __WASI_ERRNO_NETUNREACH
#define ENFILE __WASI_ERRNO_NFILE
#define ENOBUFS __WASI_ERRNO_NOBUFS
#define ENODEV __WASI_ERRNO_NODEV
#define ENOENT __WASI_ERRNO_NOENT
#define ENOEXEC __WASI_ERRNO_NOEXEC
#define ENOLCK __WASI_ERRNO_NOLCK
#define ENOLINK __WASI_ERRNO_NOLINK
#define ENOMEM __WASI_ERRNO_NOMEM
#define ENOMSG __WASI_ERRNO_NOMSG
#define ENOPROTOOPT __WASI_ERRNO_NOPROTOOPT
#define ENOSPC __WASI_ERRNO_NOSPC
#define ENOSYS __WASI_ERRNO_NOSYS
#define ENOTCONN __WASI_ERRNO_NOTCONN
#define ENOTDIR __WASI_ERRNO_NOTDIR
#define ENOTEMPTY __WASI_ERRNO_NOTEMPTY
#define ENOTRECOVERABLE __WASI_ERRNO_NOTRECOVERABLE
#define ENOTSOCK __WASI_ERRNO_NOTSOCK
#define ENOTSUP __WASI_ERRNO_NOTSUP
#define ENOTTY __WASI_ERRNO_NOTTY
#define ENXIO __WASI_ERRNO_NXIO
#define EOVERFLOW __WASI_ERRNO_OVERFLOW
#define EOWNERDEAD __WASI_ERRNO_OWNERDEAD
#define EPERM __WASI_ERRNO_PERM
#define EPIPE __WASI_ERRNO_PIPE
#define EPROTO __WASI_ERRNO_PROTO
#define EPROTONOSUPPORT __WASI_ERRNO_PROTONOSUPPORT
#define EPROTOTYPE __WASI_ERRNO_PROTOTYPE
#define ERANGE __WASI_ERRNO_RANGE
#define EROFS __WASI_ERRNO_ROFS
#define ESPIPE __WASI_ERRNO_SPIPE
#define ESRCH __WASI_ERRNO_SRCH
#define ESTALE __WASI_ERRNO_STALE
#define ETIMEDOUT __WASI_ERRNO_TIMEDOUT
#define ETXTBSY __WASI_ERRNO_TXTBSY
#define EXDEV __WASI_ERRNO_XDEV
#define ENOTCAPABLE __WASI_ERRNO_NOTCAPABLE
#define EOPNOTSUPP ENOTSUP
#define EWOULDBLOCK EAGAIN
#endif

View File

@ -1,76 +0,0 @@
#ifndef __wasilibc___fd_set_h
#define __wasilibc___fd_set_h
#include <__typedef_fd_set.h>
#ifdef __cplusplus
extern "C" {
#endif
static __inline void FD_CLR(int __fd, fd_set *__set) {
size_t __n = __set->__nfds;
for (int *__p = __set->__fds, *__e = __p + __n;
__p < __e; ++__p)
{
if (*__p == __fd) {
*__p = __e[-1];
__set->__nfds = __n - 1;
return;
}
}
}
static __inline
#ifdef __cplusplus
bool
#else
_Bool
#endif
FD_ISSET(int __fd, const fd_set *__set)
{
size_t __n = __set->__nfds;
for (const int *__p = __set->__fds, *__e = __p + __n;
__p < __e; ++__p)
{
if (*__p == __fd) {
return 1;
}
}
return 0;
}
static __inline void FD_SET(int __fd, fd_set *__set) {
size_t __n = __set->__nfds;
for (const int *__p = __set->__fds, *__e = __p + __n;
__p < __e; ++__p)
{
if (*__p == __fd) {
return;
}
}
__set->__nfds = __n + 1;
__set->__fds[__n] = __fd;
}
static __inline void FD_ZERO(fd_set *__set) {
__set->__nfds = 0;
}
static __inline void FD_COPY(const fd_set *__restrict __from,
fd_set *__restrict __to) {
size_t __n = __from->__nfds;
__to->__nfds = __n;
__builtin_memcpy(__to->__fds, __from->__fds, __n * sizeof(int));
}
#define FD_CLR(fd, set) (FD_CLR((fd), (set)))
#define FD_ISSET(fd, set) (FD_ISSET((fd), (set)))
#define FD_SET(fd, set) (FD_SET((fd), (set)))
#define FD_ZERO(set) (FD_ZERO((set)))
#define FD_COPY(from, to) (FD_COPY((from), (to)))
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,14 +0,0 @@
#ifndef __wasilibc___function___isatty_h
#define __wasilibc___function___isatty_h
#ifdef __cplusplus
extern "C" {
#endif
int __isatty(int fd);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,26 +0,0 @@
#ifndef __wasilibc___functions_malloc_h
#define __wasilibc___functions_malloc_h
#define __need_size_t
#define __need_wchar_t
#define __need_NULL
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
void *malloc(size_t __size) __attribute__((__malloc__, __warn_unused_result__));
void free(void *__ptr);
void *calloc(size_t __nmemb, size_t __size) __attribute__((__malloc__, __warn_unused_result__));
void *realloc(void *__ptr, size_t __size) __attribute__((__warn_unused_result__));
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
void *reallocarray(void *__ptr, size_t __nmemb, size_t __size) __attribute__((__warn_unused_result__));
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,20 +0,0 @@
#ifndef __wasilibc___functions_memcpy_h
#define __wasilibc___functions_memcpy_h
#define __need_size_t
#define __need_NULL
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
void *memcpy(void *__restrict__ __dst, const void *__restrict__ __src, size_t __n) __attribute__((__nothrow__, __leaf__, __nonnull__(1, 2)));
void *memmove(void *__dst, const void *__src, size_t __n) __attribute__((__nothrow__, __leaf__, __nonnull__(1, 2)));
void *memset(void *__dst, int __c, size_t __n) __attribute__((__nothrow__, __leaf__, __nonnull__(1)));
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,39 +0,0 @@
#ifndef __wasilibc___header_dirent_h
#define __wasilibc___header_dirent_h
#include <wasi/api.h>
#define DT_BLK __WASI_FILETYPE_BLOCK_DEVICE
#define DT_CHR __WASI_FILETYPE_CHARACTER_DEVICE
#define DT_DIR __WASI_FILETYPE_DIRECTORY
#define DT_FIFO __WASI_FILETYPE_SOCKET_STREAM
#define DT_LNK __WASI_FILETYPE_SYMBOLIC_LINK
#define DT_REG __WASI_FILETYPE_REGULAR_FILE
#define DT_UNKNOWN __WASI_FILETYPE_UNKNOWN
#include <__struct_dirent.h>
#include <__typedef_DIR.h>
#ifdef __cplusplus
extern "C" {
#endif
int closedir(DIR *);
DIR *opendir(const char *);
DIR *fdopendir(int);
int fdclosedir(DIR *);
struct dirent *readdir(DIR *);
void rewinddir(DIR *);
void seekdir(DIR *, long);
long telldir(DIR *);
DIR *opendirat(int, const char *);
void rewinddir(DIR *);
int scandirat(int, const char *, struct dirent ***,
int (*)(const struct dirent *),
int (*)(const struct dirent **, const struct dirent **));
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,61 +0,0 @@
#ifndef __wasilibc___header_fcntl_h
#define __wasilibc___header_fcntl_h
#include <wasi/api.h>
#include <__seek.h>
#include <__mode_t.h>
#define O_APPEND __WASI_FDFLAGS_APPEND
#define O_DSYNC __WASI_FDFLAGS_DSYNC
#define O_NONBLOCK __WASI_FDFLAGS_NONBLOCK
#define O_RSYNC __WASI_FDFLAGS_RSYNC
#define O_SYNC __WASI_FDFLAGS_SYNC
#define O_CREAT (__WASI_OFLAGS_CREAT << 12)
#define O_DIRECTORY (__WASI_OFLAGS_DIRECTORY << 12)
#define O_EXCL (__WASI_OFLAGS_EXCL << 12)
#define O_TRUNC (__WASI_OFLAGS_TRUNC << 12)
#define O_NOFOLLOW (0x01000000)
#define O_EXEC (0x02000000)
#define O_RDONLY (0x04000000)
#define O_SEARCH (0x08000000)
#define O_WRONLY (0x10000000)
/*
* O_CLOEXEC is defined to be zero, as WASI has no exec-style functions.
*/
#define O_CLOEXEC (0)
/*
* O_TTY_INIT is defined to be zero, meaning that WASI implementations are
* expected to always initialize a terminal the first time it's opened.
*/
#define O_TTY_INIT (0)
#define O_NOCTTY (0)
#define O_RDWR (O_RDONLY | O_WRONLY)
#define O_ACCMODE (O_EXEC | O_RDWR | O_SEARCH)
#define POSIX_FADV_DONTNEED __WASI_ADVICE_DONTNEED
#define POSIX_FADV_NOREUSE __WASI_ADVICE_NOREUSE
#define POSIX_FADV_NORMAL __WASI_ADVICE_NORMAL
#define POSIX_FADV_RANDOM __WASI_ADVICE_RANDOM
#define POSIX_FADV_SEQUENTIAL __WASI_ADVICE_SEQUENTIAL
#define POSIX_FADV_WILLNEED __WASI_ADVICE_WILLNEED
#define F_GETFD (1)
#define F_SETFD (2)
#define F_GETFL (3)
#define F_SETFL (4)
#define FD_CLOEXEC (1)
#define AT_EACCESS (0x0)
#define AT_SYMLINK_NOFOLLOW (0x1)
#define AT_SYMLINK_FOLLOW (0x2)
#define AT_REMOVEDIR (0x4)
#define AT_FDCWD (-2)
#endif

View File

@ -1,182 +0,0 @@
#ifndef __wasilibc___include_inttypes_h
#define __wasilibc___include_inttypes_h
#include <stdint.h>
#define __need_wchar_t
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct { intmax_t quot, rem; } imaxdiv_t;
intmax_t imaxabs(intmax_t);
imaxdiv_t imaxdiv(intmax_t, intmax_t);
intmax_t strtoimax(const char *__restrict, char **__restrict, int);
uintmax_t strtoumax(const char *__restrict, char **__restrict, int);
intmax_t wcstoimax(const wchar_t *__restrict, wchar_t **__restrict, int);
uintmax_t wcstoumax(const wchar_t *__restrict, wchar_t **__restrict, int);
#define PRId16 __INT16_FMTd__
#define PRIi16 __INT16_FMTi__
#define PRId32 __INT32_FMTd__
#define PRIi32 __INT32_FMTi__
#define PRId64 __INT64_FMTd__
#define PRIi64 __INT64_FMTi__
#define PRId8 __INT8_FMTd__
#define PRIi8 __INT8_FMTi__
#define PRIdMAX __INTMAX_FMTd__
#define PRIiMAX __INTMAX_FMTi__
#define PRIdPTR __INTPTR_FMTd__
#define PRIiPTR __INTPTR_FMTi__
#define PRIdFAST16 __INT_FAST16_FMTd__
#define PRIiFAST16 __INT_FAST16_FMTi__
#define PRIdFAST32 __INT_FAST32_FMTd__
#define PRIiFAST32 __INT_FAST32_FMTi__
#define PRIdFAST64 __INT_FAST64_FMTd__
#define PRIiFAST64 __INT_FAST64_FMTi__
#define PRIdFAST8 __INT_FAST8_FMTd__
#define PRIiFAST8 __INT_FAST8_FMTi__
#define PRIdLEAST16 __INT_LEAST16_FMTd__
#define PRIiLEAST16 __INT_LEAST16_FMTi__
#define PRIdLEAST32 __INT_LEAST32_FMTd__
#define PRIiLEAST32 __INT_LEAST32_FMTi__
#define PRIdLEAST64 __INT_LEAST64_FMTd__
#define PRIiLEAST64 __INT_LEAST64_FMTi__
#define PRIdLEAST8 __INT_LEAST8_FMTd__
#define PRIiLEAST8 __INT_LEAST8_FMTi__
#define PRIX16 __UINT16_FMTX__
#define PRIo16 __UINT16_FMTo__
#define PRIu16 __UINT16_FMTu__
#define PRIx16 __UINT16_FMTx__
#define PRIX32 __UINT32_FMTX__
#define PRIo32 __UINT32_FMTo__
#define PRIu32 __UINT32_FMTu__
#define PRIx32 __UINT32_FMTx__
#define PRIX64 __UINT64_FMTX__
#define PRIo64 __UINT64_FMTo__
#define PRIu64 __UINT64_FMTu__
#define PRIx64 __UINT64_FMTx__
#define PRIX8 __UINT8_FMTX__
#define PRIo8 __UINT8_FMTo__
#define PRIu8 __UINT8_FMTu__
#define PRIx8 __UINT8_FMTx__
#define PRIXMAX __UINTMAX_FMTX__
#define PRIoMAX __UINTMAX_FMTo__
#define PRIuMAX __UINTMAX_FMTu__
#define PRIxMAX __UINTMAX_FMTx__
#define PRIXPTR __UINTPTR_FMTX__
#define PRIoPTR __UINTPTR_FMTo__
#define PRIuPTR __UINTPTR_FMTu__
#define PRIxPTR __UINTPTR_FMTx__
#define PRIXFAST16 __UINT_FAST16_FMTX__
#define PRIoFAST16 __UINT_FAST16_FMTo__
#define PRIuFAST16 __UINT_FAST16_FMTu__
#define PRIxFAST16 __UINT_FAST16_FMTx__
#define PRIXFAST32 __UINT_FAST32_FMTX__
#define PRIoFAST32 __UINT_FAST32_FMTo__
#define PRIuFAST32 __UINT_FAST32_FMTu__
#define PRIxFAST32 __UINT_FAST32_FMTx__
#define PRIXFAST64 __UINT_FAST64_FMTX__
#define PRIoFAST64 __UINT_FAST64_FMTo__
#define PRIuFAST64 __UINT_FAST64_FMTu__
#define PRIxFAST64 __UINT_FAST64_FMTx__
#define PRIXFAST8 __UINT_FAST8_FMTX__
#define PRIoFAST8 __UINT_FAST8_FMTo__
#define PRIuFAST8 __UINT_FAST8_FMTu__
#define PRIxFAST8 __UINT_FAST8_FMTx__
#define PRIXLEAST16 __UINT_LEAST16_FMTX__
#define PRIoLEAST16 __UINT_LEAST16_FMTo__
#define PRIuLEAST16 __UINT_LEAST16_FMTu__
#define PRIxLEAST16 __UINT_LEAST16_FMTx__
#define PRIXLEAST32 __UINT_LEAST32_FMTX__
#define PRIoLEAST32 __UINT_LEAST32_FMTo__
#define PRIuLEAST32 __UINT_LEAST32_FMTu__
#define PRIxLEAST32 __UINT_LEAST32_FMTx__
#define PRIXLEAST64 __UINT_LEAST64_FMTX__
#define PRIoLEAST64 __UINT_LEAST64_FMTo__
#define PRIuLEAST64 __UINT_LEAST64_FMTu__
#define PRIxLEAST64 __UINT_LEAST64_FMTx__
#define PRIXLEAST8 __UINT_LEAST8_FMTX__
#define PRIoLEAST8 __UINT_LEAST8_FMTo__
#define PRIuLEAST8 __UINT_LEAST8_FMTu__
#define PRIxLEAST8 __UINT_LEAST8_FMTx__
#define SCNd16 __INT16_FMTd__
#define SCNi16 __INT16_FMTi__
#define SCNd32 __INT32_FMTd__
#define SCNi32 __INT32_FMTi__
#define SCNd64 __INT64_FMTd__
#define SCNi64 __INT64_FMTi__
#define SCNd8 __INT8_FMTd__
#define SCNi8 __INT8_FMTi__
#define SCNdMAX __INTMAX_FMTd__
#define SCNiMAX __INTMAX_FMTi__
#define SCNdPTR __INTPTR_FMTd__
#define SCNiPTR __INTPTR_FMTi__
#define SCNdFAST16 __INT_FAST16_FMTd__
#define SCNiFAST16 __INT_FAST16_FMTi__
#define SCNdFAST32 __INT_FAST32_FMTd__
#define SCNiFAST32 __INT_FAST32_FMTi__
#define SCNdFAST64 __INT_FAST64_FMTd__
#define SCNiFAST64 __INT_FAST64_FMTi__
#define SCNdFAST8 __INT_FAST8_FMTd__
#define SCNiFAST8 __INT_FAST8_FMTi__
#define SCNdLEAST16 __INT_LEAST16_FMTd__
#define SCNiLEAST16 __INT_LEAST16_FMTi__
#define SCNdLEAST32 __INT_LEAST32_FMTd__
#define SCNiLEAST32 __INT_LEAST32_FMTi__
#define SCNdLEAST64 __INT_LEAST64_FMTd__
#define SCNiLEAST64 __INT_LEAST64_FMTi__
#define SCNdLEAST8 __INT_LEAST8_FMTd__
#define SCNiLEAST8 __INT_LEAST8_FMTi__
#define SCNo16 __UINT16_FMTo__
#define SCNu16 __UINT16_FMTu__
#define SCNx16 __UINT16_FMTx__
#define SCNo32 __UINT32_FMTo__
#define SCNu32 __UINT32_FMTu__
#define SCNx32 __UINT32_FMTx__
#define SCNo64 __UINT64_FMTo__
#define SCNu64 __UINT64_FMTu__
#define SCNx64 __UINT64_FMTx__
#define SCNo8 __UINT8_FMTo__
#define SCNu8 __UINT8_FMTu__
#define SCNx8 __UINT8_FMTx__
#define SCNoMAX __UINTMAX_FMTo__
#define SCNuMAX __UINTMAX_FMTu__
#define SCNxMAX __UINTMAX_FMTx__
#define SCNoPTR __UINTPTR_FMTo__
#define SCNuPTR __UINTPTR_FMTu__
#define SCNxPTR __UINTPTR_FMTx__
#define SCNoFAST16 __UINT_FAST16_FMTo__
#define SCNuFAST16 __UINT_FAST16_FMTu__
#define SCNxFAST16 __UINT_FAST16_FMTx__
#define SCNoFAST32 __UINT_FAST32_FMTo__
#define SCNuFAST32 __UINT_FAST32_FMTu__
#define SCNxFAST32 __UINT_FAST32_FMTx__
#define SCNoFAST64 __UINT_FAST64_FMTo__
#define SCNuFAST64 __UINT_FAST64_FMTu__
#define SCNxFAST64 __UINT_FAST64_FMTx__
#define SCNoFAST8 __UINT_FAST8_FMTo__
#define SCNuFAST8 __UINT_FAST8_FMTu__
#define SCNxFAST8 __UINT_FAST8_FMTx__
#define SCNoLEAST16 __UINT_LEAST16_FMTo__
#define SCNuLEAST16 __UINT_LEAST16_FMTu__
#define SCNxLEAST16 __UINT_LEAST16_FMTx__
#define SCNoLEAST32 __UINT_LEAST32_FMTo__
#define SCNuLEAST32 __UINT_LEAST32_FMTu__
#define SCNxLEAST32 __UINT_LEAST32_FMTx__
#define SCNoLEAST64 __UINT_LEAST64_FMTo__
#define SCNuLEAST64 __UINT_LEAST64_FMTu__
#define SCNxLEAST64 __UINT_LEAST64_FMTx__
#define SCNoLEAST8 __UINT_LEAST8_FMTo__
#define SCNuLEAST8 __UINT_LEAST8_FMTu__
#define SCNxLEAST8 __UINT_LEAST8_FMTx__
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,30 +0,0 @@
#ifndef __wasilibc___header_netinet_in_h
#define __wasilibc___header_netinet_in_h
#include <__struct_in_addr.h>
#include <__struct_in6_addr.h>
#include <__struct_sockaddr_in.h>
#include <__struct_sockaddr_in6.h>
#define IPPROTO_IP 0
#define IPPROTO_ICMP 1
#define IPPROTO_TCP 6
#define IPPROTO_UDP 17
#define IPPROTO_IPV6 41
#define IPPROTO_RAW 255
#define IN6ADDR_ANY_INIT { { \
0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00 \
} }
#define IN6ADDR_LOOPBACK_INIT { { \
0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x01 \
} }
#endif

View File

@ -1,27 +0,0 @@
#ifndef __wasilibc___header_poll_h
#define __wasilibc___header_poll_h
#include <__struct_pollfd.h>
#include <__typedef_nfds_t.h>
#define POLLRDNORM 0x1
#define POLLWRNORM 0x2
#define POLLIN POLLRDNORM
#define POLLOUT POLLWRNORM
#define POLLERR 0x1000
#define POLLHUP 0x2000
#define POLLNVAL 0x4000
#ifdef __cplusplus
extern "C" {
#endif
int poll(struct pollfd[], nfds_t, int);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,21 +0,0 @@
#ifndef __wasilibc___header_stdlib_h
#define __wasilibc___header_stdlib_h
#define __need_size_t
#include <stddef.h>
#include <__functions_malloc.h>
#ifdef __cplusplus
extern "C" {
#endif
void abort(void) __attribute__((__noreturn__));
void qsort(void *, size_t, size_t, int (*)(const void *, const void *));
void _Exit(int) __attribute__((__noreturn__));
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,23 +0,0 @@
#ifndef __wasilibc___header_string_h
#define __wasilibc___header_string_h
#define __need_size_t
#define __need_NULL
#include <stddef.h>
#include <__functions_memcpy.h>
#ifdef __cplusplus
extern "C" {
#endif
size_t strlen(const char *) __attribute__((__nothrow__, __leaf__, __pure__, __nonnull__(1)));
char *strdup(const char *) __attribute__((__nothrow__, __nonnull__(1)));
int strcmp(const char *, const char *) __attribute__((__nothrow__, __pure__, __nonnull__(1, 2)));
void *memchr(const void *, int, size_t) __attribute__((__nothrow__, __pure__, __nonnull__(1)));
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,17 +0,0 @@
#ifndef __wasilibc___header_sys_ioctl_h
#define __wasilibc___header_sys_ioctl_h
#define FIONREAD 1
#define FIONBIO 2
#ifdef __cplusplus
extern "C" {
#endif
int ioctl(int, int, ...);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,19 +0,0 @@
#ifndef __wasilibc___header_sys_resource_h
#define __wasilibc___header_sys_resource_h
#include <__struct_rusage.h>
#define RUSAGE_SELF 1
#define RUSAGE_CHILDREN 2
#ifdef __cplusplus
extern "C" {
#endif
int getrusage(int who, struct rusage *usage);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,41 +0,0 @@
#ifndef __wasilibc___header_sys_socket_h
#define __wasilibc___header_sys_socket_h
#include <__struct_msghdr.h>
#include <__struct_sockaddr.h>
#include <__struct_sockaddr_storage.h>
#include <wasi/api.h>
#define SHUT_RD __WASI_SDFLAGS_RD
#define SHUT_WR __WASI_SDFLAGS_WR
#define SHUT_RDWR (SHUT_RD | SHUT_WR)
#define MSG_PEEK __WASI_RIFLAGS_RECV_PEEK
#define MSG_WAITALL __WASI_RIFLAGS_RECV_WAITALL
#define MSG_TRUNC __WASI_RIFLAGS_RECV_DATA_TRUNCATED
#define SOCK_DGRAM __WASI_FILETYPE_SOCKET_DGRAM
#define SOCK_STREAM __WASI_FILETYPE_SOCKET_STREAM
#define SOCK_NONBLOCK (0x00004000)
#define SOCK_CLOEXEC (0x00002000)
#define SOL_SOCKET 0x7fffffff
#define SO_TYPE 3
#define AF_UNSPEC 0
#define AF_INET 1
#define AF_INET6 2
#define AF_UNIX 3
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,15 +0,0 @@
#ifndef __wasilibc___header_sys_stat_h
#define __wasilibc___header_sys_stat_h
#include <__struct_stat.h>
#define st_atime st_atim.tv_sec
#define st_mtime st_mtim.tv_sec
#define st_ctime st_ctim.tv_sec
#include <__mode_t.h>
#define UTIME_NOW (-1)
#define UTIME_OMIT (-2)
#endif

View File

@ -1,37 +0,0 @@
#ifndef __wasilibc___header_time_h
#define __wasilibc___header_time_h
#define __need_size_t
#define __need_NULL
#include <stddef.h>
#include <__typedef_time_t.h>
#include <__struct_timespec.h>
#include <__struct_tm.h>
#include <__typedef_clockid_t.h>
#include <wasi/api.h>
#define TIMER_ABSTIME __WASI_SUBCLOCKFLAGS_SUBSCRIPTION_CLOCK_ABSTIME
extern const struct __clockid _CLOCK_MONOTONIC;
#define CLOCK_MONOTONIC (&_CLOCK_MONOTONIC)
extern const struct __clockid _CLOCK_PROCESS_CPUTIME_ID;
#define CLOCK_PROCESS_CPUTIME_ID (&_CLOCK_PROCESS_CPUTIME_ID)
extern const struct __clockid _CLOCK_REALTIME;
#define CLOCK_REALTIME (&_CLOCK_REALTIME)
extern const struct __clockid _CLOCK_THREAD_CPUTIME_ID;
#define CLOCK_THREAD_CPUTIME_ID (&_CLOCK_THREAD_CPUTIME_ID)
/*
* TIME_UTC is the only standardized time base value.
*/
#define TIME_UTC 1
/*
* Note that XSI specifies CLOCKS_PER_SEC to be 1000000, rather than
* 1000000000; the clock API is providing more precision than XSI specifies.
*/
#define CLOCKS_PER_SEC ((clock_t)1000000000)
#endif

View File

@ -1,28 +0,0 @@
#ifndef __wasilibc___header_unistd_h
#define __wasilibc___header_unistd_h
struct stat;
#include <__seek.h>
#define F_OK (0)
#define X_OK (1)
#define W_OK (2)
#define R_OK (4)
#ifdef __cplusplus
extern "C" {
#endif
int close(int fd);
int faccessat(int, const char *, int, int);
int fstatat(int, const char *__restrict, struct stat *__restrict, int);
int renameat(int, const char *, int, const char *);
int openat(int, const char *, int, ...);
void *sbrk(intptr_t increment);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,6 +0,0 @@
#ifndef __wasilibc___macro_FD_SETSIZE_h
#define __wasilibc___macro_FD_SETSIZE_h
#define FD_SETSIZE 1024
#endif

View File

@ -1,11 +0,0 @@
#ifndef __wasilibc___macro_PAGESIZE_h
#define __wasilibc___macro_PAGESIZE_h
/*
* The page size in WebAssembly is fixed at 64 KiB. If this ever changes,
* it's expected that applications will need to opt in, so we can change
* this.
*/
#define PAGESIZE (0x10000)
#endif

View File

@ -1,38 +0,0 @@
#ifndef __wasilibc___mode_t_h
#define __wasilibc___mode_t_h
#define S_IFMT \
(S_IFBLK | S_IFCHR | S_IFDIR | S_IFIFO | S_IFLNK | S_IFREG | S_IFSOCK)
#define S_IFBLK (0x6000)
#define S_IFCHR (0x2000)
#define S_IFDIR (0x4000)
#define S_IFLNK (0xa000)
#define S_IFREG (0x8000)
#define S_IFSOCK (0xc000)
#define S_IFIFO (0xc000)
#define S_ISBLK(m) (((m)&S_IFMT) == S_IFBLK)
#define S_ISCHR(m) (((m)&S_IFMT) == S_IFCHR)
#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
#define S_ISFIFO(m) (((m)&S_IFMT) == S_IFIFO)
#define S_ISLNK(m) (((m)&S_IFMT) == S_IFLNK)
#define S_ISREG(m) (((m)&S_IFMT) == S_IFREG)
#define S_ISSOCK(m) (((m)&S_IFMT) == S_IFSOCK)
#define S_IXOTH (0x1)
#define S_IWOTH (0x2)
#define S_IROTH (0x4)
#define S_IRWXO (S_IXOTH | S_IWOTH | S_IROTH)
#define S_IXGRP (0x8)
#define S_IWGRP (0x10)
#define S_IRGRP (0x20)
#define S_IRWXG (S_IXGRP | S_IWGRP | S_IRGRP)
#define S_IXUSR (0x40)
#define S_IWUSR (0x80)
#define S_IRUSR (0x100)
#define S_IRWXU (S_IXUSR | S_IWUSR | S_IRUSR)
#define S_ISVTX (0x200)
#define S_ISGID (0x400)
#define S_ISUID (0x800)
#endif

View File

@ -1,10 +0,0 @@
#ifndef __wasilibc___seek_h
#define __wasilibc___seek_h
#include <wasi/api.h>
#define SEEK_CUR __WASI_WHENCE_CUR
#define SEEK_END __WASI_WHENCE_END
#define SEEK_SET __WASI_WHENCE_SET
#endif

View File

@ -1,14 +0,0 @@
#ifndef __wasilibc___struct_dirent_h
#define __wasilibc___struct_dirent_h
#include <__typedef_ino_t.h>
#define _DIRENT_HAVE_D_TYPE
struct dirent {
ino_t d_ino;
unsigned char d_type;
char d_name[];
};
#endif

View File

@ -1,8 +0,0 @@
#ifndef __wasilibc___struct_in6_addr_h
#define __wasilibc___struct_in6_addr_h
struct in6_addr {
_Alignas(int32_t) unsigned char s6_addr[16];
};
#endif

View File

@ -1,10 +0,0 @@
#ifndef __wasilibc___struct_in_addr_h
#define __wasilibc___struct_in_addr_h
#include <__typedef_in_addr_t.h>
struct in_addr {
in_addr_t s_addr;
};
#endif

View File

@ -1,12 +0,0 @@
#ifndef __wasilibc___struct_iovec_h
#define __wasilibc___struct_iovec_h
#define __need_size_t
#include <stddef.h>
struct iovec {
void *iov_base;
size_t iov_len;
};
#endif

View File

@ -1,16 +0,0 @@
#ifndef __wasilibc___struct_msghdr_h
#define __wasilibc___struct_msghdr_h
#include <__typedef_socklen_t.h>
struct msghdr {
void *msg_name;
socklen_t msg_namelen;
struct iovec *msg_iov;
int msg_iovlen;
void *msg_control;
socklen_t msg_controllen;
int msg_flags;
};
#endif

View File

@ -1,10 +0,0 @@
#ifndef __wasilibc___struct_pollfd_h
#define __wasilibc___struct_pollfd_h
struct pollfd {
int fd;
short events;
short revents;
};
#endif

View File

@ -1,12 +0,0 @@
#ifndef __wasilibc___struct_rusage_h
#define __wasilibc___struct_rusage_h
#include <__struct_timeval.h>
/* TODO: Add more features here. */
struct rusage {
struct timeval ru_utime;
struct timeval ru_stime;
};
#endif

View File

@ -1,14 +0,0 @@
#ifndef __wasilibc___struct_sockaddr_h
#define __wasilibc___struct_sockaddr_h
#define __need_STDDEF_H_misc
#include <stddef.h>
#include <__typedef_sa_family_t.h>
struct sockaddr {
_Alignas(max_align_t) sa_family_t sa_family;
char sa_data[0];
};
#endif

View File

@ -1,17 +0,0 @@
#ifndef __wasilibc___struct_sockaddr_in_h
#define __wasilibc___struct_sockaddr_in_h
#define __need_STDDEF_H_misc
#include <stddef.h>
#include <__typedef_sa_family_t.h>
#include <__typedef_in_port_t.h>
#include <__struct_in_addr.h>
struct sockaddr_in {
_Alignas(max_align_t) sa_family_t sin_family;
in_port_t sin_port;
struct in_addr sin_addr;
};
#endif

View File

@ -1,19 +0,0 @@
#ifndef __wasilibc___struct_sockaddr_in6_h
#define __wasilibc___struct_sockaddr_in6_h
#define __need_STDDEF_H_misc
#include <stddef.h>
#include <__typedef_sa_family_t.h>
#include <__typedef_in_port_t.h>
#include <__struct_in6_addr.h>
struct sockaddr_in6 {
_Alignas(max_align_t) sa_family_t sin6_family;
in_port_t sin6_port;
unsigned sin6_flowinfo;
struct in6_addr sin6_addr;
unsigned sin6_scope_id;
};
#endif

View File

@ -1,14 +0,0 @@
#ifndef __wasilibc___struct_sockaddr_storage_h
#define __wasilibc___struct_sockaddr_storage_h
#define __need_STDDEF_H_misc
#include <stddef.h>
#include <__typedef_sa_family_t.h>
struct sockaddr_storage {
_Alignas(max_align_t) sa_family_t ss_family;
char __ss_data[32];
};
#endif

View File

@ -1,13 +0,0 @@
#ifndef __wasilibc___struct_sockaddr_un_h
#define __wasilibc___struct_sockaddr_un_h
#define __need_STDDEF_H_misc
#include <stddef.h>
#include <__typedef_sa_family_t.h>
struct sockaddr_un {
_Alignas(max_align_t) sa_family_t sun_family;
};
#endif

View File

@ -1,35 +0,0 @@
#ifndef __wasilibc___struct_stat_h
#define __wasilibc___struct_stat_h
#include <__typedef_dev_t.h>
#include <__typedef_ino_t.h>
#include <__typedef_nlink_t.h>
#include <__typedef_mode_t.h>
#include <__typedef_uid_t.h>
#include <__typedef_gid_t.h>
#include <__typedef_off_t.h>
#include <__typedef_blksize_t.h>
#include <__typedef_blkcnt_t.h>
#include <__struct_timespec.h>
struct stat {
dev_t st_dev;
ino_t st_ino;
nlink_t st_nlink;
mode_t st_mode;
uid_t st_uid;
gid_t st_gid;
unsigned int __pad0;
dev_t st_rdev;
off_t st_size;
blksize_t st_blksize;
blkcnt_t st_blocks;
struct timespec st_atim;
struct timespec st_mtim;
struct timespec st_ctim;
long long __reserved[3];
};
#endif

View File

@ -1,12 +0,0 @@
#ifndef __wasilibc___struct_timespec_h
#define __wasilibc___struct_timespec_h
#include <__typedef_time_t.h>
/* As specified in POSIX. */
struct timespec {
time_t tv_sec;
long tv_nsec;
};
#endif

View File

@ -1,13 +0,0 @@
#ifndef __wasilibc___struct_timeval_h
#define __wasilibc___struct_timeval_h
#include <__typedef_time_t.h>
#include <__typedef_suseconds_t.h>
/* As specified in POSIX. */
struct timeval {
time_t tv_sec;
suseconds_t tv_usec;
};
#endif

View File

@ -1,19 +0,0 @@
#ifndef __wasilibc___struct_tm_h
#define __wasilibc___struct_tm_h
struct tm {
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
int tm_wday;
int tm_yday;
int tm_isdst;
int __tm_gmtoff;
const char *__tm_zone;
int __tm_nsec;
};
#endif

View File

@ -1,13 +0,0 @@
#ifndef __wasilibc___struct_tms_h
#define __wasilibc___struct_tms_h
#include <__typedef_clock_t.h>
struct tms {
clock_t tms_utime;
clock_t tms_stime;
clock_t tms_cutime;
clock_t tms_cstime;
};
#endif

View File

@ -1,6 +0,0 @@
#ifndef __wasilibc___typedef_DIR_h
#define __wasilibc___typedef_DIR_h
typedef struct _DIR DIR;
#endif

View File

@ -1,7 +0,0 @@
#ifndef __wasilibc___typedef_blkcnt_t_h
#define __wasilibc___typedef_blkcnt_t_h
/* Define these as 64-bit signed integers to support files larger than 2 GiB. */
typedef long long blkcnt_t;
#endif

View File

@ -1,6 +0,0 @@
#ifndef __wasilibc___typedef_blksize_t_h
#define __wasilibc___typedef_blksize_t_h
typedef long blksize_t;
#endif

View File

@ -1,7 +0,0 @@
#ifndef __wasilibc___typedef_clock_t_h
#define __wasilibc___typedef_clock_t_h
/* Define this as a 64-bit signed integer to avoid wraparounds. */
typedef long long clock_t;
#endif

View File

@ -1,6 +0,0 @@
#ifndef __wasilibc___typedef_clockid_t_h
#define __wasilibc___typedef_clockid_t_h
typedef const struct __clockid *clockid_t;
#endif

View File

@ -1,7 +0,0 @@
#ifndef __wasilibc___typedef_dev_t_h
#define __wasilibc___typedef_dev_t_h
/* Define these as 64-bit integers to support billions of devices. */
typedef unsigned long long dev_t;
#endif

View File

@ -1,14 +0,0 @@
#ifndef __wasilibc___typedef_fd_set_h
#define __wasilibc___typedef_fd_set_h
#define __need_size_t
#include <stddef.h>
#include <__macro_FD_SETSIZE.h>
typedef struct {
size_t __nfds;
int __fds[FD_SETSIZE];
} fd_set;
#endif

View File

@ -1,6 +0,0 @@
#ifndef __wasilibc___typedef_gid_t_h
#define __wasilibc___typedef_gid_t_h
typedef unsigned gid_t;
#endif

View File

@ -1,6 +0,0 @@
#ifndef __wasilibc___typedef_in_addr_t_h
#define __wasilibc___typedef_in_addr_t_h
typedef unsigned in_addr_t;
#endif

View File

@ -1,6 +0,0 @@
#ifndef __wasilibc___typedef_in_port_t_h
#define __wasilibc___typedef_in_port_t_h
typedef unsigned short in_port_t;
#endif

View File

@ -1,7 +0,0 @@
#ifndef __wasilibc___typedef_ino_t_h
#define __wasilibc___typedef_ino_t_h
/* Define these as 64-bit integers to support billions of inodes. */
typedef unsigned long long ino_t;
#endif

View File

@ -1,6 +0,0 @@
#ifndef __wasilibc___typedef_mode_t_h
#define __wasilibc___typedef_mode_t_h
typedef unsigned mode_t;
#endif

View File

@ -1,6 +0,0 @@
#ifndef __wasilibc___typedef_nfds_t_h
#define __wasilibc___typedef_nfds_t_h
typedef unsigned long nfds_t;
#endif

View File

@ -1,7 +0,0 @@
#ifndef __wasilibc___typedef_nlink_t_h
#define __wasilibc___typedef_nlink_t_h
/* Define these as 64-bit unsigned integers to support billions of links. */
typedef unsigned long long nlink_t;
#endif

View File

@ -1,7 +0,0 @@
#ifndef __wasilibc___typedef_off_t_h
#define __wasilibc___typedef_off_t_h
/* Define these as 64-bit signed integers to support files larger than 2 GiB. */
typedef long long off_t;
#endif

View File

@ -1,6 +0,0 @@
#ifndef __wasilibc___typedef_sa_family_t_h
#define __wasilibc___typedef_sa_family_t_h
typedef unsigned short sa_family_t;
#endif

View File

@ -1,7 +0,0 @@
#ifndef __wasilibc___typedef_sigset_t_h
#define __wasilibc___typedef_sigset_t_h
/* TODO: This is just a placeholder for now. Keep this in sync with musl. */
typedef unsigned char sigset_t;
#endif

View File

@ -1,6 +0,0 @@
#ifndef __wasilibc___typedef_socklen_t_h
#define __wasilibc___typedef_socklen_t_h
typedef unsigned socklen_t;
#endif

View File

@ -1,7 +0,0 @@
#ifndef __wasilibc___typedef_ssize_t_h
#define __wasilibc___typedef_ssize_t_h
/* This is defined to be the same size as size_t. */
typedef long ssize_t;
#endif

View File

@ -1,8 +0,0 @@
#ifndef __wasilibc___typedef_suseconds_t_h
#define __wasilibc___typedef_suseconds_t_h
/* Define this to be 64-bit as its main use is in struct timeval where the
extra space would otherwise be padding. */
typedef long long suseconds_t;
#endif

View File

@ -1,7 +0,0 @@
#ifndef __wasilibc___typedef_time_t_h
#define __wasilibc___typedef_time_t_h
/* Define this as a 64-bit signed integer to avoid the 2038 bug. */
typedef long long time_t;
#endif

View File

@ -1,6 +0,0 @@
#ifndef __wasilibc___typedef_uid_t_h
#define __wasilibc___typedef_uid_t_h
typedef unsigned uid_t;
#endif

View File

@ -1,10 +0,0 @@
#ifndef __wasilibc_dirent_h
#define __wasilibc_dirent_h
/*
* Include the real implementation, which is factored into a separate file so
* that it can be reused by other libc dirent implementations.
*/
#include <__header_dirent.h>
#endif

View File

@ -1,7 +0,0 @@
#ifndef __wasilibc_errno_h
#define __wasilibc_errno_h
#include <__errno.h>
#include <__errno_values.h>
#endif

View File

@ -1,10 +0,0 @@
#ifndef __wasilibc_fcntl_h
#define __wasilibc_fcntl_h
/*
* Include the real implementation, which is factored into a separate file so
* that it can be reused by other libc fcntl implementations.
*/
#include <__header_fcntl.h>
#endif

View File

@ -1,10 +0,0 @@
#ifndef __wasilibc_inttypes_h
#define __wasilibc_inttypes_h
/*
* Include the real implementation, which is factored into a separate file so
* that it can be reused by other libc stdlib implementations.
*/
#include <__header_inttypes.h>
#endif

View File

@ -1,6 +0,0 @@
#ifndef __wasilibc_netinet_in_h
#define __wasilibc_netinet_in_h
#include <__header_netinet_in.h>
#endif

View File

@ -1,10 +0,0 @@
#ifndef __wasilibc_poll_h
#define __wasilibc_poll_h
/*
* Include the real implementation, which is factored into a separate file so
* that it can be reused by other libc poll implementations.
*/
#include <__header_poll.h>
#endif

View File

@ -1,10 +0,0 @@
#ifndef __wasilibc_stdlib_h
#define __wasilibc_stdlib_h
/*
* Include the real implementation, which is factored into a separate file so
* that it can be reused by other libc stdlib implementations.
*/
#include <__functions_malloc.h>
#endif

View File

@ -1,10 +0,0 @@
#ifndef __wasilibc_string_h
#define __wasilibc_string_h
/*
* Include the real implementation, which is factored into a separate file so
* that it can be reused by other libc string implementations.
*/
#include <__header_string.h>
#endif

View File

@ -1,10 +0,0 @@
#ifndef __wasilibc_sys_ioctl_h
#define __wasilibc_sys_ioctl_h
/*
* Include the real implementation, which is factored into a separate file so
* that it can be reused by other libc ioctl implementations.
*/
#include <__header_sys_ioctl.h>
#endif

View File

@ -1,10 +0,0 @@
#ifndef __wasilibc_sys_resource_h
#define __wasilibc_sys_resource_h
/*
* Include the real implementation, which is factored into a separate file so
* that it can be reused by other libc resource implementations.
*/
#include <__header_sys_resource.h>
#endif

View File

@ -1,18 +0,0 @@
#ifndef __wasilibc_sys_select_h
#define __wasilibc_sys_select_h
#include <__fd_set.h>
#include <__struct_timespec.h>
#include <__struct_timeval.h>
#ifdef __cplusplus
extern "C" {
#endif
int pselect(int, fd_set *, fd_set *, fd_set *, const struct timespec *, const sigset_t *);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,6 +0,0 @@
#ifndef __wasilibc_sys_socket_h
#define __wasilibc_sys_socket_h
#include <__header_sys_socket.h>
#endif

View File

@ -1,10 +0,0 @@
#ifndef __wasilibc_sys_stat_h
#define __wasilibc_sys_stat_h
/*
* Include the real implementation, which is factored into a separate file so
* that it can be reused by other libc stat implementations.
*/
#include <__header_sys_stat.h>
#endif

View File

@ -1,6 +0,0 @@
#ifndef __wasilibc_sys_time_h
#define __wasilibc_sys_time_h
#include <__struct_timeval.h>
#endif

View File

@ -1,6 +0,0 @@
#ifndef __wasilibc_sys_times_h
#define __wasilibc_sys_times_h
#include <__struct_tms.h>
#endif

View File

@ -1,16 +0,0 @@
#ifndef __wasilibc_sys_types_h
#define __wasilibc_sys_types_h
#define __need_size_t
#include <stddef.h>
#include <__typedef_clock_t.h>
#include <__typedef_time_t.h>
#include <__typedef_blksize_t.h>
#include <__typedef_off_t.h>
#include <__typedef_ssize_t.h>
#include <__typedef_suseconds_t.h>
#include <__typedef_nlink_t.h>
#include <__typedef_clockid_t.h>
#endif

View File

@ -1,6 +0,0 @@
#ifndef __wasilibc_sys_uio_h
#define __wasilibc_sys_uio_h
#include <__struct_iovec.h>
#endif

View File

@ -1,6 +0,0 @@
#ifndef __wasilibc_sys_un_h
#define __wasilibc_sys_un_h
#include <__struct_sockaddr_un.h>
#endif

View File

@ -1,10 +0,0 @@
#ifndef __wasilibc_time_h
#define __wasilibc_time_h
/*
* Include the real implementation, which is factored into a separate file so
* that it can be reused by other libc time implementations.
*/
#include <__header_time.h>
#endif

View File

@ -1,10 +0,0 @@
#ifndef __wasilibc_unistd_h
#define __wasilibc_unistd_h
/*
* Include the real implementation, which is factored into a separate file so
* that it can be reused by other libc unistd implementations.
*/
#include <__header_unistd.h>
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +0,0 @@
#ifndef __wasi_libc_environ_h
#define __wasi_libc_environ_h
#ifdef __cplusplus
extern "C" {
#endif
/// Initialize the global environment variable state. Only needs to be
/// called once; most users should call `__wasilibc_ensure_environ` instead.
void __wasilibc_initialize_environ(void);
/// If `__wasilibc_initialize_environ` has not yet been called, call it.
void __wasilibc_ensure_environ(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,79 +0,0 @@
#ifndef __wasi_libc_find_relpath_h
#define __wasi_libc_find_relpath_h
#ifdef __cplusplus
extern "C" {
#endif
/**
* Look up the given `path`, relative to the cwd, in the preopened directory
* map. If a suitable entry is found, then the file descriptor for that entry
* is returned. Additionally the absolute path of the directory's file
* descriptor is returned in `abs_prefix` and the relative portion that needs
* to be opened is stored in `*relative_path`.
*
* The `relative_path` argument must be a pointer to a buffer valid for
* `relative_path_len` bytes, and this may be used as storage for the relative
* portion of the path being returned through `*relative_path`.
*
* See documentation on `__wasilibc_find_abspath` for more info about what the
* paths look like.
*
* Returns -1 on failure. Errno is set to either:
*
* * ENOMEM - failed to allocate memory for internal routines.
* * ENOENT - the `path` could not be found relative to any preopened dir.
* * ERANGE - the `relative_path` buffer is too small to hold the relative path.
*/
int __wasilibc_find_relpath(const char *path,
const char **__restrict__ abs_prefix,
char **relative_path,
size_t relative_path_len);
/**
* Look up the given `path`, which is interpreted as absolute, in the preopened
* directory map. If a suitable entry is found, then the file descriptor for
* that entry is returned. Additionally the relative portion of the path to
* where the fd is opened is returned through `relative_path`, the absolute
* prefix which was matched is stored to `abs_prefix`, and `relative_path` may
* be an interior pointer to the `abspath` string.
*
* The `abs_prefix` returned string will not contain a leading `/`. Note that
* this may be the empty string. Additionally the returned `relative_path` will
* not contain a leading `/`. The `relative_path` return will not return an
* empty string, it will return `"."` instead if it would otherwise do so.
*
* Returns -1 on failure. Errno is set to either:
*
* * ENOMEM - failed to allocate memory for internal routines.
* * ENOENT - the `path` could not be found relative to any preopened dir.
*/
int __wasilibc_find_abspath(const char *abspath,
const char **__restrict__ abs_prefix,
const char **__restrict__ relative_path);
/**
* Same as `__wasilibc_find_relpath`, except that this function will interpret
* `relative` as a malloc'd buffer that will be `realloc`'d to the appropriate
* size to contain the relative path.
*
* Note that this is a weak symbol and if it's not defined you can use
* `__wasilibc_find_relpath`. The weak-nature of this symbols means that if it's
* not otherwise included in the compilation then `chdir` wasn't used an there's
* no need for this symbol.
*
* See documentation on `__wasilibc_find_relpath` for more information.
*/
int __wasilibc_find_relpath_alloc(
const char *path,
const char **abs,
char **relative,
size_t *relative_len,
int can_realloc
) __attribute__((weak));
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,58 +0,0 @@
#ifndef __wasi_libc_nocwd_h
#define __wasi_libc_nocwd_h
/*
* In order to support AT_FDCWD, we need to wrap the *at functions to handle
* it by calling back into the non-at versions which perform libpreopen
* queries. These __wasilibc_nocwd_* forms are the underlying calls which
* assume AT_FDCWD has already been resolved.
*/
#define __need_size_t
#include <stddef.h>
#include <__typedef_ssize_t.h>
#include <__typedef_mode_t.h>
#include <__typedef_DIR.h>
#ifdef __cplusplus
extern "C" {
#endif
struct timespec;
struct stat;
struct dirent;
int __wasilibc_nocwd___wasilibc_unlinkat(int, const char *)
__attribute__((__warn_unused_result__));
int __wasilibc_nocwd___wasilibc_rmdirat(int, const char *)
__attribute__((__warn_unused_result__));
int __wasilibc_nocwd_linkat(int, const char *, int, const char *, int)
__attribute__((__warn_unused_result__));
int __wasilibc_nocwd_symlinkat(const char *, int, const char *)
__attribute__((__warn_unused_result__));
ssize_t __wasilibc_nocwd_readlinkat(int, const char *__restrict, char *__restrict, size_t)
__attribute__((__warn_unused_result__));
int __wasilibc_nocwd_faccessat(int, const char *, int, int)
__attribute__((__warn_unused_result__));
int __wasilibc_nocwd_renameat(int, const char *, int, const char *)
__attribute__((__warn_unused_result__));
int __wasilibc_nocwd_openat_nomode(int, const char *, int)
__attribute__((__warn_unused_result__));
int __wasilibc_nocwd_fstatat(int, const char *__restrict, struct stat *__restrict, int)
__attribute__((__warn_unused_result__));
int __wasilibc_nocwd_mkdirat_nomode(int, const char *)
__attribute__((__warn_unused_result__));
int __wasilibc_nocwd_utimensat(int, const char *, const struct timespec [2], int)
__attribute__((__warn_unused_result__));
DIR *__wasilibc_nocwd_opendirat(int, const char *)
__attribute__((__warn_unused_result__));
int __wasilibc_nocwd_scandirat(int, const char *, struct dirent ***,
int (*)(const struct dirent *),
int (*)(const struct dirent **, const struct dirent **))
__attribute__((__warn_unused_result__));
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,65 +0,0 @@
#ifndef __wasi_libc_h
#define __wasi_libc_h
#include <__typedef_off_t.h>
#include <__struct_timespec.h>
#ifdef __cplusplus
extern "C" {
#endif
struct stat;
struct timespec;
/// Register the given pre-opened file descriptor under the given path.
///
/// This function does not take ownership of `prefix` (it makes its own copy).
int __wasilibc_register_preopened_fd(int fd, const char *prefix);
/// Renumber `fd` to `newfd`; similar to `dup2` but does a move rather than a
/// copy.
int __wasilibc_fd_renumber(int fd, int newfd)
__attribute__((__warn_unused_result__));
/// Like `unlinkat`, but without depending on `__wasi_path_remove_directory`.
int __wasilibc_unlinkat(int fd, const char *path)
__attribute__((__warn_unused_result__));
/// An `*at` version of rmdir.
int __wasilibc_rmdirat(int fd, const char *path)
__attribute__((__warn_unused_result__));
/// Like `open`, but without the varargs in the signature.
int __wasilibc_open_nomode(const char *path, int oflag);
/// Like `openat`, but without the varargs in the signature.
int __wasilibc_openat_nomode(int fd, const char *path, int oflag);
/// Return the current file offset. Like `lseek(fd, 0, SEEK_CUR)`, but without
/// depending on `lseek`.
off_t __wasilibc_tell(int fd)
__attribute__((__warn_unused_result__));
/* Non-`at` forms of various `*at` functions. */
int __wasilibc_access(const char *pathname, int mode, int flags)
__attribute__((__warn_unused_result__));
int __wasilibc_stat(const char *__restrict pathname, struct stat *__restrict statbuf, int flags)
__attribute__((__warn_unused_result__));
int __wasilibc_utimens(const char *pathname, const struct timespec times[2], int flags)
__attribute__((__warn_unused_result__));
int __wasilibc_link(const char *oldpath, const char *newpath, int flags)
__attribute__((__warn_unused_result__));
int __wasilibc_link_oldat(int olddirfd, const char *oldpath, const char *newpath, int flags)
__attribute__((__warn_unused_result__));
int __wasilibc_link_newat(const char *oldpath, int newdirfd, const char *newpath, int flags)
__attribute__((__warn_unused_result__));
int __wasilibc_rename_oldat(int olddirfd, const char *oldpath, const char *newpath)
__attribute__((__warn_unused_result__));
int __wasilibc_rename_newat(const char *oldpath, int newdirfd, const char *newpath)
__attribute__((__warn_unused_result__));
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,9 +0,0 @@
#ifndef __wasilibc_wchar_h
#define __wasilibc_wchar_h
#define __need_size_t
#define __need_wchar_t
#define __need_NULL
#include <stddef.h>
#endif

View File

@ -1,25 +0,0 @@
# WASI libc "top half".
The WASI libc "top half" is conceptually the upper half of a traditional libc
implementation, consisting of C standard library and other relatively
higher-level functionality.
Code in the musl directory is based on musl revision
040c1d16b468c50c04fc94edff521f1637708328, which is v1.2.0, from
git://git.musl-libc.org/musl.
Whole files which are unused are omitted. Changes to upstream code are wrapped
in preprocessor directives controlled by the macro `__wasilibc_unmodified_upstream`.
Some major known missing areas include:
- threads
- aio
- setjmp
- signals
- ipc
- termios
- nss
- timezones
- non-builtin locales
- TIOCGWINSZ (because cloudabi lacks it; affects isatty, line buffering for stdout)
- O\_CLOEXEC, O\_NOCTTY (because cloudabi lacks them)

View File

@ -1,191 +0,0 @@
Quick Installation Guide for musl libc
======================================
There are many different ways to install musl depending on your usage
case. This document covers only the build and installation of musl by
itself, which is useful for upgrading an existing musl-based system or
compiler toolchain, or for using the provided musl-gcc wrapper with an
existing non-musl-based compiler.
Building complete native or cross-compiler toolchains is outside the
scope of this INSTALL file. More information can be found on the musl
website and community wiki.
Build Prerequisites
-------------------
The only build-time prerequisites for musl are GNU Make and a
freestanding C99 compiler toolchain targeting the desired instruction
set architecture and ABI, with support for a minimal subset of "GNU C"
extensions consisting mainly of gcc-style inline assembly, weak
aliases, hidden visibility, and stand-alone assembly source files.
GCC, LLVM/clang, Firm/cparser, and PCC have all successfully built
musl, but GCC is the most widely used/tested. Recent compiler (and
binutils) versions should be used if possible since some older
versions have bugs which affect musl.
The system used to build musl does not need to be Linux-based, nor do
the Linux kernel headers need to be available.
Supported Targets
-----------------
musl can be built for the following CPU instruction set architecture
and ABI combinations:
* i386
* Minimum CPU model is actually 80486 unless kernel emulation of
the `cmpxchg` instruction is added
* x86_64
* ILP32 ABI (x32) is available as a separate arch but is still
experimental
* ARM
* EABI, standard or hard-float VFP variant
* Little-endian default; big-endian variants also supported
* Compiler toolchains only support armv4t and later
* AArch64
* Little-endian default; big-endian variants also supported
* MIPS
* ABI is o32, fp32/fpxx (except on r6 which is fp64)
* Big-endian default; little-endian variants also supported
* Default ABI variant uses FPU registers; alternate soft-float ABI
that does not use FPU registers or instructions is available
* MIPS2 or later, or kernel emulation of ll/sc (standard in Linux)
is required
* MIPS32r6, an incompatible ISA, is supported as a variant "mipsr6"
* MIPS64
* ABI is n64 (LP64) or n32 (ILP32)
* Big-endian default; little-endian variants also supported
* Default ABI variant uses FPU registers; alternate soft-float ABI
that does not use FPU registers or instructions is available
* PowerPC
* Compiler toolchain must provide 64-bit long double, not IBM
double-double or IEEE quad
* For dynamic linking, compiler toolchain must be configured for
"secure PLT" variant
* PowerPC64
* Both little and big endian variants are supported
* Compiler toolchain must provide 64-bit long double, not IBM
double-double or IEEE quad
* Compiler toolchain must use the new (ELFv2) ABI regardless of
whether it is for little or big endian
* S390X (64-bit S390)
* SuperH (SH)
* Standard ELF ABI or FDPIC ABI (shared-text without MMU)
* Little-endian by default; big-endian variant also supported
* Full FPU ABI or soft-float ABI is supported, but the
single-precision-only FPU ABI is not
* Microblaze
* Big-endian default; little-endian variants also supported
* Soft-float
* Requires support for lwx/swx instructions
* OpenRISC 1000 (or1k)
* RISC-V 64
* Little endian
* Hard, soft, and hard-single/soft-double floating point ABIs
* Standard ELF; no shared-text NOMMU support
Build and Installation Procedure
--------------------------------
To build and install musl:
1. Run the provided configure script from the top-level source
directory, passing on its command line any desired options.
2. Run "make" to compile.
3. Run "make install" with appropriate privileges to write to the
target locations.
The configure script attempts to determine automatically the correct
target architecture based on the compiler being used. For some
compilers, this may not be possible. If detection fails or selects the
wrong architecture, you can provide an explicit selection on the
configure command line.
By default, configure installs to a prefix of "/usr/local/musl". This
differs from the behavior of most configure scripts, and is chosen
specifically to avoid clashing with libraries already present on the
system. DO NOT set the prefix to "/usr", "/usr/local", or "/" unless
you're upgrading libc on an existing musl-based system. Doing so will
break your existing system when you run "make install" and it may be
difficult to recover.
Notes on Dynamic Linking
------------------------
If dynamic linking is enabled, one file needs to be installed outside
of the installation prefix: /lib/ld-musl-$ARCH.so.1. This is the
dynamic linker. Its pathname is hard-coded into all dynamic-linked
programs, so for the sake of being able to share binaries between
systems, a consistent location should be used everywhere. Note that
the same applies to glibc and its dynamic linker, which is named
/lib/ld-linux.so.2 on i386 systems.
If for some reason it is impossible to install the dynamic linker in
its standard location (for example, if you are installing without root
privileges), the --syslibdir option to configure can be used to
provide a different location
At runtime, the dynamic linker needs to know the paths to search for
shared libraries. You should create a text file named
/etc/ld-musl-$ARCH.path (where $ARCH matches the architecture name
used in the dynamic linker) containing a list of directories where you
want the dynamic linker to search for shared libraries, separated by
colons or newlines. If the dynamic linker has been installed in a
non-default location, the path file also needs to reside at that
location (../etc relative to the chosen syslibdir).
If you do not intend to use dynamic linking, you may disable it by
passing --disable-shared to configure; this also cuts the build time
in half.
Checking for Successful Installation
------------------------------------
After installing, you should be able to use musl via the musl-gcc
wrapper. For example:
cat > hello.c <<EOF
#include <stdio.h>
int main()
{
printf("hello, world!\n");
return 0;
}
EOF
/usr/local/musl/bin/musl-gcc hello.c
./a.out
To configure autoconf-based program to compile and link against musl,
set the CC variable to musl-gcc when running configure, as in:
CC=musl-gcc ./configure ...
You will probably also want to use --prefix when building libraries to
ensure that they are installed under the musl prefix and not in the
main host system library directories.

View File

@ -1,237 +0,0 @@
#
# Makefile for musl (requires GNU make)
#
# This is how simple every makefile should be...
# No, I take that back - actually most should be less than half this size.
#
# Use config.mak to override any of the following variables.
# Do not make changes here.
#
srcdir = .
exec_prefix = /usr/local
bindir = $(exec_prefix)/bin
prefix = /usr/local/musl
includedir = $(prefix)/include
libdir = $(prefix)/lib
syslibdir = /lib
MALLOC_DIR = mallocng
SRC_DIRS = $(addprefix $(srcdir)/,src/* src/malloc/$(MALLOC_DIR) crt ldso $(COMPAT_SRC_DIRS))
BASE_GLOBS = $(addsuffix /*.c,$(SRC_DIRS))
ARCH_GLOBS = $(addsuffix /$(ARCH)/*.[csS],$(SRC_DIRS))
BASE_SRCS = $(sort $(wildcard $(BASE_GLOBS)))
ARCH_SRCS = $(sort $(wildcard $(ARCH_GLOBS)))
BASE_OBJS = $(patsubst $(srcdir)/%,%.o,$(basename $(BASE_SRCS)))
ARCH_OBJS = $(patsubst $(srcdir)/%,%.o,$(basename $(ARCH_SRCS)))
REPLACED_OBJS = $(sort $(subst /$(ARCH)/,/,$(ARCH_OBJS)))
ALL_OBJS = $(addprefix obj/, $(filter-out $(REPLACED_OBJS), $(sort $(BASE_OBJS) $(ARCH_OBJS))))
LIBC_OBJS = $(filter obj/src/%,$(ALL_OBJS)) $(filter obj/compat/%,$(ALL_OBJS))
LDSO_OBJS = $(filter obj/ldso/%,$(ALL_OBJS:%.o=%.lo))
CRT_OBJS = $(filter obj/crt/%,$(ALL_OBJS))
AOBJS = $(LIBC_OBJS)
LOBJS = $(LIBC_OBJS:.o=.lo)
GENH = obj/include/bits/alltypes.h obj/include/bits/syscall.h
GENH_INT = obj/src/internal/version.h
IMPH = $(addprefix $(srcdir)/, src/internal/stdio_impl.h src/internal/pthread_impl.h src/internal/locale_impl.h src/internal/libc.h)
LDFLAGS =
LDFLAGS_AUTO =
LIBCC = -lgcc
CPPFLAGS =
CFLAGS =
CFLAGS_AUTO = -Os -pipe
CFLAGS_C99FSE = -std=c99 -ffreestanding -nostdinc
CFLAGS_ALL = $(CFLAGS_C99FSE)
CFLAGS_ALL += -D_XOPEN_SOURCE=700 -I$(srcdir)/arch/$(ARCH) -I$(srcdir)/arch/generic -Iobj/src/internal -I$(srcdir)/src/include -I$(srcdir)/src/internal -Iobj/include -I$(srcdir)/include
CFLAGS_ALL += $(CPPFLAGS) $(CFLAGS_AUTO) $(CFLAGS)
LDFLAGS_ALL = $(LDFLAGS_AUTO) $(LDFLAGS)
AR = $(CROSS_COMPILE)ar
RANLIB = $(CROSS_COMPILE)ranlib
INSTALL = $(srcdir)/tools/install.sh
ARCH_INCLUDES = $(wildcard $(srcdir)/arch/$(ARCH)/bits/*.h)
GENERIC_INCLUDES = $(wildcard $(srcdir)/arch/generic/bits/*.h)
INCLUDES = $(wildcard $(srcdir)/include/*.h $(srcdir)/include/*/*.h)
ALL_INCLUDES = $(sort $(INCLUDES:$(srcdir)/%=%) $(GENH:obj/%=%) $(ARCH_INCLUDES:$(srcdir)/arch/$(ARCH)/%=include/%) $(GENERIC_INCLUDES:$(srcdir)/arch/generic/%=include/%))
EMPTY_LIB_NAMES = m rt pthread crypt util xnet resolv dl
EMPTY_LIBS = $(EMPTY_LIB_NAMES:%=lib/lib%.a)
CRT_LIBS = $(addprefix lib/,$(notdir $(CRT_OBJS)))
STATIC_LIBS = lib/libc.a
SHARED_LIBS = lib/libc.so
TOOL_LIBS = lib/musl-gcc.specs
ALL_LIBS = $(CRT_LIBS) $(STATIC_LIBS) $(SHARED_LIBS) $(EMPTY_LIBS) $(TOOL_LIBS)
ALL_TOOLS = obj/musl-gcc
WRAPCC_GCC = gcc
WRAPCC_CLANG = clang
LDSO_PATHNAME = $(syslibdir)/ld-musl-$(ARCH)$(SUBARCH).so.1
-include config.mak
-include $(srcdir)/arch/$(ARCH)/arch.mak
ifeq ($(ARCH),)
all:
@echo "Please set ARCH in config.mak before running make."
@exit 1
else
all: $(ALL_LIBS) $(ALL_TOOLS)
OBJ_DIRS = $(sort $(patsubst %/,%,$(dir $(ALL_LIBS) $(ALL_TOOLS) $(ALL_OBJS) $(GENH) $(GENH_INT))) obj/include)
$(ALL_LIBS) $(ALL_TOOLS) $(ALL_OBJS) $(ALL_OBJS:%.o=%.lo) $(GENH) $(GENH_INT): | $(OBJ_DIRS)
$(OBJ_DIRS):
mkdir -p $@
obj/include/bits/alltypes.h: $(srcdir)/arch/$(ARCH)/bits/alltypes.h.in $(srcdir)/include/alltypes.h.in $(srcdir)/tools/mkalltypes.sed
sed -f $(srcdir)/tools/mkalltypes.sed $(srcdir)/arch/$(ARCH)/bits/alltypes.h.in $(srcdir)/include/alltypes.h.in > $@
obj/include/bits/syscall.h: $(srcdir)/arch/$(ARCH)/bits/syscall.h.in
cp $< $@
sed -n -e s/__NR_/SYS_/p < $< >> $@
obj/src/internal/version.h: $(wildcard $(srcdir)/VERSION $(srcdir)/.git)
printf '#define VERSION "%s"\n' "$$(cd $(srcdir); sh tools/version.sh)" > $@
obj/src/internal/version.o obj/src/internal/version.lo: obj/src/internal/version.h
obj/crt/rcrt1.o obj/ldso/dlstart.lo obj/ldso/dynlink.lo: $(srcdir)/src/internal/dynlink.h $(srcdir)/arch/$(ARCH)/reloc.h
obj/crt/crt1.o obj/crt/scrt1.o obj/crt/rcrt1.o obj/ldso/dlstart.lo: $(srcdir)/arch/$(ARCH)/crt_arch.h
obj/crt/rcrt1.o: $(srcdir)/ldso/dlstart.c
obj/crt/Scrt1.o obj/crt/rcrt1.o: CFLAGS_ALL += -fPIC
OPTIMIZE_SRCS = $(wildcard $(OPTIMIZE_GLOBS:%=$(srcdir)/src/%))
$(OPTIMIZE_SRCS:$(srcdir)/%.c=obj/%.o) $(OPTIMIZE_SRCS:$(srcdir)/%.c=obj/%.lo): CFLAGS += -O3
MEMOPS_OBJS = $(filter %/memcpy.o %/memmove.o %/memcmp.o %/memset.o, $(LIBC_OBJS))
$(MEMOPS_OBJS) $(MEMOPS_OBJS:%.o=%.lo): CFLAGS_ALL += $(CFLAGS_MEMOPS)
NOSSP_OBJS = $(CRT_OBJS) $(LDSO_OBJS) $(filter \
%/__libc_start_main.o %/__init_tls.o %/__stack_chk_fail.o \
%/__set_thread_area.o %/memset.o %/memcpy.o \
, $(LIBC_OBJS))
$(NOSSP_OBJS) $(NOSSP_OBJS:%.o=%.lo): CFLAGS_ALL += $(CFLAGS_NOSSP)
$(CRT_OBJS): CFLAGS_ALL += -DCRT
$(LOBJS) $(LDSO_OBJS): CFLAGS_ALL += -fPIC
CC_CMD = $(CC) $(CFLAGS_ALL) -c -o $@ $<
# Choose invocation of assembler to be used
ifeq ($(ADD_CFI),yes)
AS_CMD = LC_ALL=C awk -f $(srcdir)/tools/add-cfi.common.awk -f $(srcdir)/tools/add-cfi.$(ARCH).awk $< | $(CC) $(CFLAGS_ALL) -x assembler -c -o $@ -
else
AS_CMD = $(CC_CMD)
endif
obj/%.o: $(srcdir)/%.s
$(AS_CMD)
obj/%.o: $(srcdir)/%.S
$(CC_CMD)
obj/%.o: $(srcdir)/%.c $(GENH) $(IMPH)
$(CC_CMD)
obj/%.lo: $(srcdir)/%.s
$(AS_CMD)
obj/%.lo: $(srcdir)/%.S
$(CC_CMD)
obj/%.lo: $(srcdir)/%.c $(GENH) $(IMPH)
$(CC_CMD)
lib/libc.so: $(LOBJS) $(LDSO_OBJS)
$(CC) $(CFLAGS_ALL) $(LDFLAGS_ALL) -nostdlib -shared \
-Wl,-e,_dlstart -o $@ $(LOBJS) $(LDSO_OBJS) $(LIBCC)
lib/libc.a: $(AOBJS)
rm -f $@
$(AR) rc $@ $(AOBJS)
$(RANLIB) $@
$(EMPTY_LIBS):
rm -f $@
$(AR) rc $@
lib/%.o: obj/crt/$(ARCH)/%.o
cp $< $@
lib/%.o: obj/crt/%.o
cp $< $@
lib/musl-gcc.specs: $(srcdir)/tools/musl-gcc.specs.sh config.mak
sh $< "$(includedir)" "$(libdir)" "$(LDSO_PATHNAME)" > $@
obj/musl-gcc: config.mak
printf '#!/bin/sh\nexec "$${REALGCC:-$(WRAPCC_GCC)}" "$$@" -specs "%s/musl-gcc.specs"\n' "$(libdir)" > $@
chmod +x $@
obj/%-clang: $(srcdir)/tools/%-clang.in config.mak
sed -e 's!@CC@!$(WRAPCC_CLANG)!g' -e 's!@PREFIX@!$(prefix)!g' -e 's!@INCDIR@!$(includedir)!g' -e 's!@LIBDIR@!$(libdir)!g' -e 's!@LDSO@!$(LDSO_PATHNAME)!g' $< > $@
chmod +x $@
$(DESTDIR)$(bindir)/%: obj/%
$(INSTALL) -D $< $@
$(DESTDIR)$(libdir)/%.so: lib/%.so
$(INSTALL) -D -m 755 $< $@
$(DESTDIR)$(libdir)/%: lib/%
$(INSTALL) -D -m 644 $< $@
$(DESTDIR)$(includedir)/bits/%: $(srcdir)/arch/$(ARCH)/bits/%
$(INSTALL) -D -m 644 $< $@
$(DESTDIR)$(includedir)/bits/%: $(srcdir)/arch/generic/bits/%
$(INSTALL) -D -m 644 $< $@
$(DESTDIR)$(includedir)/bits/%: obj/include/bits/%
$(INSTALL) -D -m 644 $< $@
$(DESTDIR)$(includedir)/%: $(srcdir)/include/%
$(INSTALL) -D -m 644 $< $@
$(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(libdir)/libc.so
$(INSTALL) -D -l $(libdir)/libc.so $@ || true
install-libs: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(if $(SHARED_LIBS),$(DESTDIR)$(LDSO_PATHNAME),)
install-headers: $(ALL_INCLUDES:include/%=$(DESTDIR)$(includedir)/%)
install-tools: $(ALL_TOOLS:obj/%=$(DESTDIR)$(bindir)/%)
install: install-libs install-headers install-tools
musl-git-%.tar.gz: .git
git --git-dir=$(srcdir)/.git archive --format=tar.gz --prefix=$(patsubst %.tar.gz,%,$@)/ -o $@ $(patsubst musl-git-%.tar.gz,%,$@)
musl-%.tar.gz: .git
git --git-dir=$(srcdir)/.git archive --format=tar.gz --prefix=$(patsubst %.tar.gz,%,$@)/ -o $@ v$(patsubst musl-%.tar.gz,%,$@)
endif
clean:
rm -rf obj lib
distclean: clean
rm -f config.mak
.PHONY: all clean install install-libs install-headers install-tools

View File

@ -1,23 +0,0 @@
musl libc
musl, pronounced like the word "mussel", is an MIT-licensed
implementation of the standard C library targetting the Linux syscall
API, suitable for use in a wide range of deployment environments. musl
offers efficient static and dynamic linking support, lightweight code
and low runtime overhead, strong fail-safe guarantees under correct
usage, and correctness in the sense of standards conformance and
safety. musl is built on the principle that these goals are best
achieved through simple code that is easy to understand and maintain.
The 1.1 release series for musl features coverage for all interfaces
defined in ISO C99 and POSIX 2008 base, along with a number of
non-standardized interfaces for compatibility with Linux, BSD, and
glibc functionality.
For basic installation instructions, see the included INSTALL file.
Information on full musl-targeted compiler toolchains, system
bootstrapping, and Linux distributions built on musl can be found on
the project website:
https://musl.libc.org/

View File

@ -1 +0,0 @@
1.2.2

File diff suppressed because it is too large Load Diff

View File

@ -1,82 +0,0 @@
#define a_ll a_ll
static inline int a_ll(volatile int *p)
{
int v;
__asm__ __volatile__ ("ldaxr %w0,%1" : "=r"(v) : "Q"(*p));
return v;
}
#define a_sc a_sc
static inline int a_sc(volatile int *p, int v)
{
int r;
__asm__ __volatile__ ("stlxr %w0,%w2,%1" : "=&r"(r), "=Q"(*p) : "r"(v) : "memory");
return !r;
}
#define a_barrier a_barrier
static inline void a_barrier()
{
__asm__ __volatile__ ("dmb ish" : : : "memory");
}
#define a_cas a_cas
static inline int a_cas(volatile int *p, int t, int s)
{
int old;
do {
old = a_ll(p);
if (old != t) {
a_barrier();
break;
}
} while (!a_sc(p, s));
return old;
}
#define a_ll_p a_ll_p
static inline void *a_ll_p(volatile void *p)
{
void *v;
__asm__ __volatile__ ("ldaxr %0, %1" : "=r"(v) : "Q"(*(void *volatile *)p));
return v;
}
#define a_sc_p a_sc_p
static inline int a_sc_p(volatile int *p, void *v)
{
int r;
__asm__ __volatile__ ("stlxr %w0,%2,%1" : "=&r"(r), "=Q"(*(void *volatile *)p) : "r"(v) : "memory");
return !r;
}
#define a_cas_p a_cas_p
static inline void *a_cas_p(volatile void *p, void *t, void *s)
{
void *old;
do {
old = a_ll_p(p);
if (old != t) {
a_barrier();
break;
}
} while (!a_sc_p(p, s));
return old;
}
#define a_ctz_64 a_ctz_64
static inline int a_ctz_64(uint64_t x)
{
__asm__(
" rbit %0, %1\n"
" clz %0, %0\n"
: "=r"(x) : "r"(x));
return x;
}
#define a_clz_64 a_clz_64
static inline int a_clz_64(uint64_t x)
{
__asm__("clz %0, %1" : "=r"(x) : "r"(x));
return x;
}

View File

@ -1,24 +0,0 @@
#define _Addr long
#define _Int64 long
#define _Reg long
#if __AARCH64EB__
#define __BYTE_ORDER 4321
#else
#define __BYTE_ORDER 1234
#endif
#define __LONG_MAX 0x7fffffffffffffffL
#ifndef __cplusplus
TYPEDEF unsigned wchar_t;
#endif
TYPEDEF unsigned wint_t;
TYPEDEF int blksize_t;
TYPEDEF unsigned int nlink_t;
TYPEDEF float float_t;
TYPEDEF double double_t;
TYPEDEF struct { long long __ll; long double __ld; } max_align_t;

Some files were not shown because too many files have changed in this diff Show More