liblinux++

A hosted C++ runtime without any libc.
git clone git://henryandlizzy.uk/liblinux++
Log | Files | Refs

commit 425b3d5b90285ddc473d7bfb92c898d6fd62bb13
parent 2abb614c632657f830b07459434c8e9bb231141c
Author: Henry Wilson <henry@henryandlizzy.uk>
Date:   Tue, 23 Dec 2025 15:50:12 +0000

Remove C support

Diffstat:
MTupfile | 1-
Dlinux.h | 74--------------------------------------------------------------------------
2 files changed, 0 insertions(+), 75 deletions(-)

diff --git a/Tupfile b/Tupfile @@ -4,7 +4,6 @@ LDFLAGS = -static -nostartfiles -nolibc -nodefaultlibs -nostdlib -fno-pic -fno-p !cc = |> cc $(CFLAGS) -c -o %o %f |> obj/%B.o !c++ = |> c++ $(CFLAGS) -c -o %o %f |> obj/%B.o -: foreach *.c |> !cc |> {objs} : foreach *.cpp |> !c++ |> {objs} run ./gen.sh diff --git a/linux.h b/linux.h @@ -1,74 +0,0 @@ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -typedef unsigned long long size_t; -typedef signed long long ssize_t; -typedef unsigned long long uintptr_t; -typedef signed long long intptr_t; -typedef unsigned long long ino64_t; -typedef signed long long off64_t; - -enum { - AT_FDCWD = -100, - - O_RDONLY = 0, - O_WRONLY = 1, - O_RDWR = 2, - - PROT_READ = 0x1, - PROT_WRITE = 0x2, - PROT_EXEC = 0x4, - MAP_FIXED = 0x10, - MAP_ANONYMOUS = 0x20, - MAP_SHARED = 0x1, - MAP_PRIVATE = 0x2, - - DT_UNKNOWN = 0, - DT_FIFO = 1, - DT_CHR = 2, - DT_DIR = 4, - DT_BLK = 6, - DT_REG = 8, - DT_LNK = 10, - DT_SOCK = 12, - DT_WHT = 14, -}; - -struct iovecc -{ - char const* data; - size_t len; -}; - -__attribute__((noreturn)) -extern void exit(int error_code); -extern int read(int fd, char* data, size_t count); -extern int write(int fd, char const* data, size_t count); -extern ssize_t writev(int fd, struct iovecc const* iov, size_t count); -extern int openat(int fd, char const* name, int flags, int mode); -extern int close(int fd); - -struct linux_dirent64 { - ino64_t d_ino; /* 64-bit inode number */ - off64_t d_off; /* Not an offset; see getdents() */ - unsigned short d_reclen; /* Size of this dirent */ - unsigned char d_type; /* File type */ - char d_name[]; /* Filename (null-terminated) */ -}; -extern ssize_t getdents64(int fd, struct linux_dirent64 dirp[], size_t count); - -extern intptr_t mmap(void* addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long fd, unsigned long off); - -static unsigned get_errno(ssize_t ret) -{ - if (0 > ret && ret >= -0xFFFF) - return -ret; - return 0; -} - -#ifdef __cplusplus -} -#endif