From 8d4b47298b6c9eeb9a3f79a5b80d894f80ed4a45 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Sat, 27 Dec 2025 03:05:05 +0000 Subject: Do away with memcpy/memset/memcmp Now everything is either explicitly a rep thing, or explicitly some other small run of reasonably efficient instructions. No library calls or function call overhead of any kind. Code size remains nice and small. Ban a few other bad libc functions while we're at it. More can be added later if we decide that's a useful idea. This will require some discipline and workarounds to cope with Clang's tendency to shove mem* calls in places you don't want them even when you tell it not to. Well, c'est la vie. I'm a little nervous that the __builtin_memmove() usage in shuntvars() could still one day emit actual library calls. It appears we're not importing memmove() from anywhere at the moment, though. So I guess it's good enough for now. Also I had to get rid of alloca() in con_.c but that was kind of bad anyway, so that's fine. --- compile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'compile') diff --git a/compile b/compile index ca8fa0c..3ede107 100755 --- a/compile +++ b/compile @@ -28,8 +28,8 @@ if [ "$dbg" = 1 ]; then cflags="-O0 -g3 -masm=intel -fsanitize-trap=undefined -DSST_DBG" ldflags="-O0 -g3" else - cflags="-O2 -fvisibility=hidden -masm=intel" - ldflags="-O2 -s" + cflags="-O2 -fvisibility=hidden -masm=intel -ffreestanding" + ldflags="-O2 -s -ffreestanding" fi objs= @@ -40,8 +40,8 @@ cc() { # ugly annoying special case if [ "$_mn" = " -DMODULE_NAME=con_" ]; then _mn=" -DMODULE_NAME=con" elif [ "$_mn" = "-DMODULE_NAME=sst" ]; then _mn=; fi - $CC -c -flto -fpic -fno-ident $cflags $warnings -I.build/include \ - $stdflags$_mn -o ".build/${_bn%%.c}.o" "src/$1" + $CC -c -flto -fpic -fno-ident $cflags $warnings -include src/1.h \ + -I.build/include $stdflags$_mn -o ".build/${_bn%%.c}.o" "src/$1" } ld() { -- cgit v1.2.3-54-g00ecf