diff --git a/sysdeps/squiid/crt-x86_64/crt0.S b/sysdeps/squiid/crt-x86_64/crt0.S new file mode 100644 index 00000000..e646a57c --- /dev/null +++ b/sysdeps/squiid/crt-x86_64/crt0.S @@ -0,0 +1,6 @@ +.section .text + +.global _start +_start: + movq $main, %rdi + callq __mlibc_entry diff --git a/sysdeps/squiid/generic/entry.cpp b/sysdeps/squiid/generic/entry.cpp new file mode 100644 index 00000000..bf0bfb28 --- /dev/null +++ b/sysdeps/squiid/generic/entry.cpp @@ -0,0 +1,31 @@ +#include +#include +#include + +// defined by the POSIX library +void __mlibc_initLocale(); + +extern "C" uintptr_t *__dlapi_entrystack(); + +extern char **environ; +static mlibc::exec_stack_data __mlibc_stack_data; + +struct LibraryGuard { + LibraryGuard(); +}; + +static LibraryGuard guard; + +LibraryGuard::LibraryGuard() { + __mlibc_initLocale(); + + // Parse the exec() stack. + mlibc::parse_exec_stack(__dlapi_entrystack(), &__mlibc_stack_data); + mlibc::set_startup_data(__mlibc_stack_data.argc, __mlibc_stack_data.argv, + __mlibc_stack_data.envp); +} + +extern "C" void __mlibc_entry(int (*main_fn)(int argc, char *argv[], char *env[])) { + int result = main_fn(__mlibc_stack_data.argc, __mlibc_stack_data.argv, environ); + exit(result); +} diff --git a/sysdeps/squiid/generic/syscalls.cpp b/sysdeps/squiid/generic/syscalls.cpp new file mode 100644 index 00000000..ffc74553 --- /dev/null +++ b/sysdeps/squiid/generic/syscalls.cpp @@ -0,0 +1,231 @@ +#include +#include +#include +#include + +#include +#include +#include +#include + +#define STUB_ONLY { __ensure(!"STUB_ONLY function was called"); __builtin_unreachable(); } + +namespace mlibc { + +void sys_libc_log(const char *msg) { + ssize_t written; + sys_write(STDERR_FILENO, msg, strlen(msg), &written); + sys_write(STDERR_FILENO, "\n", 1, &written); +} + +void sys_libc_panic() { + sys_libc_log("mlibc panic!\n"); + __builtin_trap(); +} + +int sys_tcb_set(void *pointer) { + return __sq_syscall2(SQ_SYS_prctl, SQ_PR_ARCH_X86_64_SET_FS, (__sq_u64)pointer); +} + +int sys_futex_wait(int *pointer, int expected) { + return __sq_syscall3(SQ_SYS_futex, SQ_FUTEX_WAIT, (__sq_u64)pointer, expected); +} + +int sys_futex_wake(int *pointer) { + return __sq_syscall3(SQ_SYS_futex, SQ_FUTEX_WAKE, (__sq_u64)pointer, 0); +} + +int sys_close(int fd) { + return __sq_syscall1(SQ_SYS_close, fd); +} + +int sys_open(const char *path, int flags, int *fd) { + /* TODO: convert flags */ + int ret = __sq_syscall3(SQ_SYS_open, (__sq_u64)path, flags, 0); + + if (ret < 0) { + return ret; + } + + *fd = ret; + return 0; +} + +int sys_read(int fd, void *buffer, size_t size, ssize_t *bytes_read) { + ssize_t ret = __sq_syscall3(SQ_SYS_read, fd, (__sq_u64)buffer, size); + + if (ret < 0) { + return ret; + } + + *bytes_read = ret; + return 0; +} + +int sys_write(int fd, const void *buffer, size_t size, ssize_t *bytes_written) { + ssize_t ret = __sq_syscall3(SQ_SYS_write, fd, (__sq_u64)buffer, size); + + if (ret < 0) { + return ret; + } + + *bytes_written = ret; + return 0; +} + +int sys_seek(int fd, off_t offset, int whence, off_t *new_offset) { + switch (whence) { + case SEEK_SET: + whence = SQ_SEEK_SET; + break; + + case SEEK_CUR: + whence = SQ_SEEK_RELATIVE; + break; + + case SEEK_END: + __ensure(!"SEEK_END not implemented yet"); + break; + + default: + __ensure(!"Unknown seek-whence value"); + break; + } + + ssize_t ret = __sq_syscall3(SQ_SYS_seek, fd, (__sq_u64)offset, whence); + + if (ret < 0) { + return ret; + } + + *new_offset = ret; + return 0; +} + +int sys_vm_map(void *hint, size_t size, int prot, int flags, int fd, + off_t offset, void **window +) { + /* our SQ_PROT_* are the same as defined in abis/mlibc/vm-flags.h, + * so no need to convert them + */ + + /* this flag is not supported yet */ + __ensure(!(flags & MAP_SHARED)); + + int sq_flags = 0; + if (flags & MAP_FIXED) { + sq_flags |= SQ_MMAP_FIXED; + } + + if (flags & MAP_ANONYMOUS) { + sq_flags |= SQ_MMAP_ANONYMOUS; + } + + if (flags & MAP_PRIVATE) { + /* for now is implicit */ + } + + ssize_t ret = __sq_syscall6(SQ_SYS_mmap, fd, (__sq_u64)hint, offset, size, prot, sq_flags); + + if (ret < 0) { + return ret; + } + + *window = reinterpret_cast(ret); + return 0; +} + +int sys_vm_unmap(void *pointer, size_t size) { + return __sq_syscall6(SQ_SYS_mmap, SQ_MMAP_FD_NONE, (__sq_u64)pointer, + 0, size, 0, SQ_MMAP_UNMAP | SQ_MMAP_FIXED); +} + +int sys_anon_allocate(size_t size, void **pointer) { + ssize_t ret = __sq_syscall6(SQ_SYS_mmap, SQ_MMAP_FD_NONE, 0, 0, + (__sq_u32)size, SQ_PROT_READ | SQ_PROT_WRITE, + SQ_MMAP_ANONYMOUS | SQ_MMAP_ADJUST_HEAP); + + if (ret < 0) { + return ret; + } + + *pointer = reinterpret_cast(ret); + return 0; +} + +int sys_anon_free(void *pointer, size_t size) { + return sys_vm_unmap(pointer, size); +} + +#ifndef MLIBC_BUILDING_RTDL + +int sys_fork(pid_t *child) { + int ret = __sq_syscall1(SQ_SYS_clone, 0); + + if (ret < 0) { + return ret; + } + + *child = ret; + return 0; +} + +int sys_execve(const char *path, char *const argv[], char *const envp[]) { + return __sq_syscall3(SQ_SYS_execve, (__sq_u64)path, (__sq_u64)argv, (__sq_u64)envp); +} + +void sys_exit(int code) { + __sq_syscall1(SQ_SYS_exit, code); + __builtin_trap(); +} + +pid_t sys_getpid() { + return __sq_syscall0(SQ_SYS_getpid); +} + +int sys_clock_get(int clock, time_t *secs, long *nanos) { + *secs = 0; + *nanos = 0; + + return 0; +} + +int sys_isatty(int fd) { + // TODO: not supported yet + return 0; +} + +int sys_ttyname(int fd, char *buf, size_t size) { + // TODO: not supported yet + strncpy(buf, "/dev/console", size); + + return 0; +} + +uid_t sys_getuid() +{ + // TODO: not supported yet + return 0; +} + +gid_t sys_getgid() +{ + // TODO: not supported yet + return 0; +} + +uid_t sys_geteuid() +{ + // TODO: not supported yet + return sys_getuid(); +} + +gid_t sys_getegid() +{ + // TODO: not supported yet + return sys_getgid(); +} + +#endif // !MLIBC_BUILDING_RTDL + +} // namespace mlibc diff --git a/sysdeps/squiid/include/abi-bits/abi.h b/sysdeps/squiid/include/abi-bits/abi.h new file mode 120000 index 00000000..c9458601 --- /dev/null +++ b/sysdeps/squiid/include/abi-bits/abi.h @@ -0,0 +1 @@ +../../../../abis/mlibc/abi.h \ No newline at end of file diff --git a/sysdeps/squiid/include/abi-bits/auxv.h b/sysdeps/squiid/include/abi-bits/auxv.h new file mode 120000 index 00000000..ff7c3d08 --- /dev/null +++ b/sysdeps/squiid/include/abi-bits/auxv.h @@ -0,0 +1 @@ +../../../../abis/squiid/auxv.h \ No newline at end of file diff --git a/sysdeps/squiid/include/abi-bits/blkcnt_t.h b/sysdeps/squiid/include/abi-bits/blkcnt_t.h new file mode 120000 index 00000000..e9d9f1b4 --- /dev/null +++ b/sysdeps/squiid/include/abi-bits/blkcnt_t.h @@ -0,0 +1 @@ +../../../../abis/mlibc/blkcnt_t.h \ No newline at end of file diff --git a/sysdeps/squiid/include/abi-bits/blksize_t.h b/sysdeps/squiid/include/abi-bits/blksize_t.h new file mode 120000 index 00000000..c6dfb6e0 --- /dev/null +++ b/sysdeps/squiid/include/abi-bits/blksize_t.h @@ -0,0 +1 @@ +../../../../abis/mlibc/blksize_t.h \ No newline at end of file diff --git a/sysdeps/squiid/include/abi-bits/dev_t.h b/sysdeps/squiid/include/abi-bits/dev_t.h new file mode 120000 index 00000000..0c1143b9 --- /dev/null +++ b/sysdeps/squiid/include/abi-bits/dev_t.h @@ -0,0 +1 @@ +../../../../abis/mlibc/dev_t.h \ No newline at end of file diff --git a/sysdeps/squiid/include/abi-bits/errno.h b/sysdeps/squiid/include/abi-bits/errno.h new file mode 120000 index 00000000..589859fb --- /dev/null +++ b/sysdeps/squiid/include/abi-bits/errno.h @@ -0,0 +1 @@ +../../../../abis/mlibc/errno.h \ No newline at end of file diff --git a/sysdeps/squiid/include/abi-bits/fcntl.h b/sysdeps/squiid/include/abi-bits/fcntl.h new file mode 120000 index 00000000..ea5323ad --- /dev/null +++ b/sysdeps/squiid/include/abi-bits/fcntl.h @@ -0,0 +1 @@ +../../../../abis/mlibc/fcntl.h \ No newline at end of file diff --git a/sysdeps/squiid/include/abi-bits/gid_t.h b/sysdeps/squiid/include/abi-bits/gid_t.h new file mode 120000 index 00000000..6a772180 --- /dev/null +++ b/sysdeps/squiid/include/abi-bits/gid_t.h @@ -0,0 +1 @@ +../../../../abis/mlibc/gid_t.h \ No newline at end of file diff --git a/sysdeps/squiid/include/abi-bits/in.h b/sysdeps/squiid/include/abi-bits/in.h new file mode 120000 index 00000000..b58c683f --- /dev/null +++ b/sysdeps/squiid/include/abi-bits/in.h @@ -0,0 +1 @@ +../../../../abis/mlibc/in.h \ No newline at end of file diff --git a/sysdeps/squiid/include/abi-bits/ino_t.h b/sysdeps/squiid/include/abi-bits/ino_t.h new file mode 120000 index 00000000..10d644e7 --- /dev/null +++ b/sysdeps/squiid/include/abi-bits/ino_t.h @@ -0,0 +1 @@ +../../../../abis/mlibc/ino_t.h \ No newline at end of file diff --git a/sysdeps/squiid/include/abi-bits/mode_t.h b/sysdeps/squiid/include/abi-bits/mode_t.h new file mode 120000 index 00000000..29d77331 --- /dev/null +++ b/sysdeps/squiid/include/abi-bits/mode_t.h @@ -0,0 +1 @@ +../../../../abis/mlibc/mode_t.h \ No newline at end of file diff --git a/sysdeps/squiid/include/abi-bits/nlink_t.h b/sysdeps/squiid/include/abi-bits/nlink_t.h new file mode 120000 index 00000000..7618c27f --- /dev/null +++ b/sysdeps/squiid/include/abi-bits/nlink_t.h @@ -0,0 +1 @@ +../../../../abis/mlibc/nlink_t.h \ No newline at end of file diff --git a/sysdeps/squiid/include/abi-bits/pid_t.h b/sysdeps/squiid/include/abi-bits/pid_t.h new file mode 120000 index 00000000..3fd26a7f --- /dev/null +++ b/sysdeps/squiid/include/abi-bits/pid_t.h @@ -0,0 +1 @@ +../../../../abis/mlibc/pid_t.h \ No newline at end of file diff --git a/sysdeps/squiid/include/abi-bits/resource.h b/sysdeps/squiid/include/abi-bits/resource.h new file mode 120000 index 00000000..3e59c750 --- /dev/null +++ b/sysdeps/squiid/include/abi-bits/resource.h @@ -0,0 +1 @@ +../../../../abis/mlibc/resource.h \ No newline at end of file diff --git a/sysdeps/squiid/include/abi-bits/seek-whence.h b/sysdeps/squiid/include/abi-bits/seek-whence.h new file mode 120000 index 00000000..3bd41efd --- /dev/null +++ b/sysdeps/squiid/include/abi-bits/seek-whence.h @@ -0,0 +1 @@ +../../../../abis/mlibc/seek-whence.h \ No newline at end of file diff --git a/sysdeps/squiid/include/abi-bits/signal.h b/sysdeps/squiid/include/abi-bits/signal.h new file mode 120000 index 00000000..b20e5119 --- /dev/null +++ b/sysdeps/squiid/include/abi-bits/signal.h @@ -0,0 +1 @@ +../../../../abis/mlibc/signal.h \ No newline at end of file diff --git a/sysdeps/squiid/include/abi-bits/socket.h b/sysdeps/squiid/include/abi-bits/socket.h new file mode 120000 index 00000000..0e1d6be9 --- /dev/null +++ b/sysdeps/squiid/include/abi-bits/socket.h @@ -0,0 +1 @@ +../../../../abis/mlibc/socket.h \ No newline at end of file diff --git a/sysdeps/squiid/include/abi-bits/stat.h b/sysdeps/squiid/include/abi-bits/stat.h new file mode 120000 index 00000000..82642c3c --- /dev/null +++ b/sysdeps/squiid/include/abi-bits/stat.h @@ -0,0 +1 @@ +../../../../abis/mlibc/stat.h \ No newline at end of file diff --git a/sysdeps/squiid/include/abi-bits/termios.h b/sysdeps/squiid/include/abi-bits/termios.h new file mode 120000 index 00000000..cfcfe763 --- /dev/null +++ b/sysdeps/squiid/include/abi-bits/termios.h @@ -0,0 +1 @@ +../../../../abis/mlibc/termios.h \ No newline at end of file diff --git a/sysdeps/squiid/include/abi-bits/time.h b/sysdeps/squiid/include/abi-bits/time.h new file mode 120000 index 00000000..97f3d52d --- /dev/null +++ b/sysdeps/squiid/include/abi-bits/time.h @@ -0,0 +1 @@ +../../../../abis/mlibc/time.h \ No newline at end of file diff --git a/sysdeps/squiid/include/abi-bits/uid_t.h b/sysdeps/squiid/include/abi-bits/uid_t.h new file mode 120000 index 00000000..1113eba6 --- /dev/null +++ b/sysdeps/squiid/include/abi-bits/uid_t.h @@ -0,0 +1 @@ +../../../../abis/mlibc/uid_t.h \ No newline at end of file diff --git a/sysdeps/squiid/include/abi-bits/vm-flags.h b/sysdeps/squiid/include/abi-bits/vm-flags.h new file mode 120000 index 00000000..f1a985e6 --- /dev/null +++ b/sysdeps/squiid/include/abi-bits/vm-flags.h @@ -0,0 +1 @@ +../../../../abis/mlibc/vm-flags.h \ No newline at end of file diff --git a/sysdeps/squiid/include/squiid/auxv.h b/sysdeps/squiid/include/squiid/auxv.h new file mode 100644 index 00000000..fd214f75 --- /dev/null +++ b/sysdeps/squiid/include/squiid/auxv.h @@ -0,0 +1,12 @@ +#ifndef __SQUIID_USER_AUXV_H__ +#define __SQUIID_USER_AUXV_H__ + +#define SQ_AT_NULL 0 /* end of auxv */ +#define SQ_AT_PHDR 1 /* program headers */ +#define SQ_AT_PHENT 2 /* size of program header entry */ +#define SQ_AT_PHNUM 3 /* number of program headers */ +#define SQ_AT_ENTRY 4 /* entry pointer */ +#define SQ_AT_EXECFN 5 /* pointer to exec pathname */ +#define SQ_AT_RANDOM 6 /* pointer to random 16-byte value */ + +#endif /* __SQUIID_USER_AUXV_H__ */ diff --git a/sysdeps/squiid/include/squiid/mmap.h b/sysdeps/squiid/include/squiid/mmap.h new file mode 100644 index 00000000..65a83e37 --- /dev/null +++ b/sysdeps/squiid/include/squiid/mmap.h @@ -0,0 +1,19 @@ +#ifndef __SQUIID_USER_MMAP_H__ +#define __SQUIID_USER_MMAP_H__ + +/* SQ_SYS_mmap fd */ +#define SQ_MMAP_FD_NONE -1 + +/* SQ_SYS_mmap protection */ +#define SQ_PROT_NONE 0 +#define SQ_PROT_READ 0x1 +#define SQ_PROT_WRITE 0x2 +#define SQ_PROT_EXEC 0x4 + +/* SQ_SYS_mmap flags */ +#define SQ_MMAP_ANONYMOUS 0x1 +#define SQ_MMAP_ADJUST_HEAP 0x2 +#define SQ_MMAP_UNMAP 0x4 +#define SQ_MMAP_FIXED 0x8 + +#endif /* __SQUIID_USER_MMAP_H__ */ diff --git a/sysdeps/squiid/include/squiid/process.h b/sysdeps/squiid/include/squiid/process.h new file mode 100644 index 00000000..4e9162c8 --- /dev/null +++ b/sysdeps/squiid/include/squiid/process.h @@ -0,0 +1,17 @@ +#ifndef __SQUIID_USER_PROCESS_H__ +#define __SQUIID_USER_PROCESS_H__ + +/* SQ_SYS_clone flags */ +#define SQ_CLONE_THREAD 0x1 + +/* SQ_SYS_prctl operations */ +#define __SQ_PR_ARCH_BASE 0x400 + +#define SQ_PR_ARCH_X86_64_SET_FS __SQ_PR_ARCH_BASE +#define SQ_PR_ARCH_X86_64_SET_GS (__SQ_PR_ARCH_BASE+1) + +/* SYS_futex operations */ +#define SQ_FUTEX_WAIT 1 +#define SQ_FUTEX_WAKE 2 + +#endif /* __SQUIID_USER_PROCESS_H__ */ diff --git a/sysdeps/squiid/include/squiid/stat.h b/sysdeps/squiid/include/squiid/stat.h new file mode 100644 index 00000000..2dc876c1 --- /dev/null +++ b/sysdeps/squiid/include/squiid/stat.h @@ -0,0 +1,38 @@ +#ifndef __SQUIID_USER_STAT_H__ +#define __SQUIID_USER_STAT_H__ + +#include "syscalls.h" + +/* open() flags */ +#define SQ_OPEN_WRITEONLY 0x02 +#define SQ_OPEN_READWRITE 0x04 +#define SQ_OPEN_APPEND 0x08 +#define SQ_OPEN_CREATE 0x10 +#define SQ_OPEN_EXCLUSIVE 0x20 +#define SQ_OPEN_TRUNCATE 0x40 +#define SQ_OPEN_NOATIME 0x80 + +/* seek() flags */ +#define SQ_SEEK_SET 1 +#define SQ_SEEK_RELATIVE 2 + +/* sys_dirent type */ +#define SQ_DT_REG 0 +#define SQ_DT_DIR 1 +#define SQ_DT_CHR 2 +#define SQ_DT_BLK 3 + +#define _SQ_PATH_MAX 1024 + +#ifndef __ASSEMBLER__ + +struct sq_sys_dirent { + __sq_u32 type; + + __sq_u32 name_len; + __sq_u8 name[0]; +}; + +#endif /* __ASSEMBLER__ */ + +#endif /* __SQUIID_USER_STAT_H__ */ diff --git a/sysdeps/squiid/include/squiid/syscall_wrappers_x86_64.h b/sysdeps/squiid/include/squiid/syscall_wrappers_x86_64.h new file mode 100644 index 00000000..c33ce8dc --- /dev/null +++ b/sysdeps/squiid/include/squiid/syscall_wrappers_x86_64.h @@ -0,0 +1,86 @@ +#ifndef __SQUIID_USER_SYSCALL_WRAPPERS_H__ +#define __SQUIID_USER_SYSCALL_WRAPPERS_H__ + +#include "syscalls.h" + +#define __sq_always_inline __attribute__((always_inline)) inline + +static __sq_always_inline __sq_u64 __sq_syscall0(__sq_u64 nr) +{ + __sq_u64 result; + + asm volatile ( + "syscall" + : "=a"(result) + : "a"(nr) + : "cc", "memory", "rcx", "r11", "rdi", "rsi", "rdx", "r10", "r8", "r9" + ); + + return result; +} + +static __sq_always_inline __sq_u64 __sq_syscall1(__sq_u64 nr, __sq_u64 arg1) +{ + __sq_u64 result; + + asm volatile ( + "syscall" + : "=a"(result) + : "a"(nr), "D"(arg1) + : "cc", "memory", "rcx", "r11", "rsi", "rdx", "r10", "r8", "r9" + ); + + return result; +} + +static __sq_always_inline __sq_u64 __sq_syscall2(__sq_u64 nr, __sq_u64 arg1, __sq_u64 arg2) +{ + __sq_u64 result; + + asm volatile ( + "syscall" + : "=a"(result) + : "a"(nr), "D"(arg1), "S"(arg2) + : "cc", "memory", "rcx", "r11", "rdx", "r10", "r8", "r9" + ); + + return result; +} + +static __sq_always_inline __sq_u64 __sq_syscall3( + __sq_u64 nr, __sq_u64 arg1, __sq_u64 arg2, __sq_u64 arg3 +) { + __sq_u64 result; + + asm volatile ( + "syscall" + : "=a"(result) + : "a"(nr), "D"(arg1), "S"(arg2), "d"(arg3) + : "cc", "memory", "rcx", "r11", "r10", "r8", "r9" + ); + + return result; +} + +static __sq_always_inline __sq_u64 __sq_syscall6( + __sq_u64 nr, + __sq_u64 arg1, __sq_u64 arg2, __sq_u64 arg3, + __sq_u64 arg4, __sq_u64 arg5, __sq_u64 arg6 +) { + __sq_u64 result; + + register __sq_u64 r10 asm("r10") = arg4; + register __sq_u64 r8 asm("r8") = arg5; + register __sq_u64 r9 asm("r9") = arg6; + + asm volatile ( + "syscall" + : "=a"(result) + : "a"(nr), "D"(arg1), "S"(arg2), "d"(arg3), "r"(r10), "r"(r8), "r"(r9) + : "cc", "memory", "rcx", "r11" + ); + + return result; +} + +#endif /* __SQUIID_USER_SYSCALL_WRAPPERS_H__ */ diff --git a/sysdeps/squiid/include/squiid/syscalls.h b/sysdeps/squiid/include/squiid/syscalls.h new file mode 100644 index 00000000..a9ed5458 --- /dev/null +++ b/sysdeps/squiid/include/squiid/syscalls.h @@ -0,0 +1,33 @@ +#ifndef __SQUIID_USER_SYSCALLS_H__ +#define __SQUIID_USER_SYSCALLS_H__ + +#define SQ_SYS_open 0 +#define SQ_SYS_close 1 +#define SQ_SYS_read 2 +#define SQ_SYS_write 3 +#define SQ_SYS_seek 4 +#define SQ_SYS_exit 5 +#define SQ_SYS_execve 6 +#define SQ_SYS_clone 7 +#define SQ_SYS_getpid 8 +#define SQ_SYS_mmap 9 +#define SQ_SYS_prctl 10 +#define SQ_SYS_futex 11 + +#define __SQ_SYS_LAST SQ_SYS_futex +#define __SQ_SYS_NUM (__SQ_SYS_LAST+1) + +#ifndef __ASSEMBLER__ + +typedef signed char __sq_s8; +typedef unsigned char __sq_u8; +typedef signed short __sq_s16; +typedef unsigned short __sq_u16; +typedef signed int __sq_s32; +typedef unsigned int __sq_u32; +typedef signed long long __sq_s64; +typedef unsigned long long __sq_u64; + +#endif /* __ASSEMBLER__ */ + +#endif /* __SQUIID_USER_SYSCALLS_H__ */ diff --git a/sysdeps/squiid/meson.build b/sysdeps/squiid/meson.build new file mode 100644 index 00000000..73eb6d92 --- /dev/null +++ b/sysdeps/squiid/meson.build @@ -0,0 +1,59 @@ +if not static + rtdl_sources += files( + 'generic/syscalls.cpp', + ) +endif + +libc_sources += files( + 'generic/entry.cpp', + 'generic/syscalls.cpp', +) + +if not no_headers + install_headers( + 'include/abi-bits/abi.h', + 'include/abi-bits/auxv.h', + 'include/abi-bits/seek-whence.h', + 'include/abi-bits/vm-flags.h', + 'include/abi-bits/errno.h', + 'include/abi-bits/fcntl.h', + 'include/abi-bits/in.h', + 'include/abi-bits/resource.h', + 'include/abi-bits/stat.h', + 'include/abi-bits/signal.h', + 'include/abi-bits/socket.h', + 'include/abi-bits/termios.h', + 'include/abi-bits/time.h', + 'include/abi-bits/blkcnt_t.h', + 'include/abi-bits/blksize_t.h', + 'include/abi-bits/dev_t.h', + 'include/abi-bits/gid_t.h', + 'include/abi-bits/ino_t.h', + 'include/abi-bits/mode_t.h', + 'include/abi-bits/nlink_t.h', + 'include/abi-bits/pid_t.h', + 'include/abi-bits/uid_t.h', + subdir: 'abi-bits' + ) + install_headers( + 'include/squiid/auxv.h', + 'include/squiid/mmap.h', + 'include/squiid/process.h', + 'include/squiid/stat.h', + 'include/squiid/syscalls.h', + 'include/squiid/syscall_wrappers_x86_64.h', + subdir: 'squiid' + ) +endif + +if not headers_only + custom_target('crt0', + build_by_default: true, + command: c_compiler.cmd_array() + ['-c', '-o', '@OUTPUT@', '@INPUT@'], + input: 'crt-x86_64/crt0.S', + output: 'crt0.o', + install: true, + install_dir: get_option('libdir') + ) +endif +