Compiling lua without a C standard library

This commit is contained in:
Thomas Oltmann 2025-03-15 23:33:20 +01:00
parent 8a7e8d6240
commit 0960df714d
2 changed files with 18 additions and 3 deletions

14
libc/include/string.h Normal file
View file

@ -0,0 +1,14 @@
#pragma once
#include <stddef.h>
char *strchr(const char *s, int c);
int strcmp(const char *s1, const char *s2);
char *strcpy(char *restrict d, const char *restrict s);
size_t strlen(const char *s);
size_t strspn(const char *s, const char *a);
char *strpbrk(const char *s, const char *a);
int strcoll(const char *s1, const char *s2);
void *memcpy(void *restrict dest, const void *restrict src, size_t n);
int memcmp(const void *s1, const void *s2, size_t n);

View file

@ -6,8 +6,9 @@
# Your platform. See PLATS for possible values. # Your platform. See PLATS for possible values.
PLAT= generic PLAT= generic
CC= gcc -std=gnu99 CROSS_PATH = /home/thomas/karlos/gcc-14.2.0-nolibc/x86_64-linux/bin
CFLAGS= -O2 -Wall -Wextra $(SYSCFLAGS) $(MYCFLAGS) CC = $(CROSS_PATH)/x86_64-linux-gcc
CFLAGS= -std=gnu99 -O2 -Wall -Wextra $(SYSCFLAGS) $(MYCFLAGS)
LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS) LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS)
LIBS= -lm $(SYSLIBS) $(MYLIBS) LIBS= -lm $(SYSLIBS) $(MYLIBS)
@ -16,7 +17,7 @@ RANLIB= ranlib
RM= rm -f RM= rm -f
UNAME= uname UNAME= uname
SYSCFLAGS= SYSCFLAGS=-nostdlib -ffreestanding -fpic -fno-stack-protector -fno-stack-check -fshort-wchar -mno-red-zone -maccumulate-outgoing-args -I ../../libc/include
SYSLDFLAGS= SYSLDFLAGS=
SYSLIBS= SYSLIBS=