custom memset since clang ignores fno-builtin/nostdlib/ffreestanding

This commit is contained in:
NukeBird 2025-12-05 23:09:19 +03:00
parent e015927089
commit 035de52e31
2 changed files with 11 additions and 6 deletions

13
main.c
View file

@ -5,6 +5,11 @@
#include "axl_vlq.h"
#include <windows.h>
void *memset(void *s, int c, size_t n)
{
return axl_memset(s, (i8)c, n);
}
int _start(void)
{
SetConsoleOutputCP(CP_UTF8);
@ -38,11 +43,11 @@ int _start(void)
axl_puts("{");
for(int base = 2; base < 17; ++base)
{
i8 buff[32];
axl_memset(buff, '\0', 32);
i8 buff[32] = {'\0'};
//axl_memset(buff, '\0', 32);
i8 text[256];
axl_memset(text, '\0', 256);
i8 text[256] = {'\0'};
//axl_memset(text, '\0', 256);
axl_strcat(text, axl_itoa(i, buff, 10));
axl_strcat(text, "\tof base\t");

View file

@ -1,8 +1,8 @@
CC = clang
AXL_SOURCES = $(filter-out main.c %_test.c, $(wildcard *.c))
TEST_EXES = $(patsubst %.c,%.exe,$(wildcard *_test.c))
TEST_CFLAGS = -Wall -Wextra -Werror -pedantic -std=c11 -static -Oz -fsigned-char
CFLAGS = $(TEST_CFLAGS) -nostdlib -ffreestanding
TEST_CFLAGS = -Wall -Wextra -Werror -pedantic -std=c17 -static -Oz -fsigned-char
CFLAGS = $(TEST_CFLAGS) -nostdlib -ffreestanding -fno-builtin
LDFLAGS = -Wl,/SUBSYSTEM:CONSOLE,/ENTRY:_start -fuse-ld=lld
LIBS = -lkernel32
SOURCES = $(AXL_SOURCES) main.c