From 7a07c08abe46f97f2412f06c77204e9015f97a47 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Thu, 18 Dec 2025 21:35:50 +0000 Subject: Move to a shared static RWX section Does away with the need to mark a region as executable on load. Also allows the self-modified stuff and hook trampolines to fit in the same page, so we take up ever-so-slightly less memory. Unfortunately I had issues getting the test binary to build correctly and eventually decided to give up as it wasn't testing much of value anyway. Also note that the build now allows for .c and .S files with the same basename, which required renaming the .o files, so you might want to clean out your .build/ directory before building this one. --- compile | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'compile') diff --git a/compile b/compile index 6e36880..67eebdf 100755 --- a/compile +++ b/compile @@ -35,8 +35,8 @@ fi objs= cc() { _bn="`basename "$1"`" - objs="$objs .build/${_bn%%.c}.o" - _mn=" -DMODULE_NAME=${_bn%%.c}" + objs="$objs .build/$_bn.o" + _mn=" -DMODULE_NAME=${_bn%%.*}" # ugly annoying special case if [ "$_mn" = " -DMODULE_NAME=con_" ]; then _mn=" -DMODULE_NAME=con" elif [ "$_mn" = "-DMODULE_NAME=sst" ]; then _mn=; fi @@ -61,6 +61,7 @@ src="\ chunklets/x86.c clientcon.c con_.c + con_.S crypto.c democustom.c demorec.c @@ -75,6 +76,7 @@ src="\ gameserver.c hexcolour.c hook.c + hook.S hud.c inputhud.c kvsys.c @@ -99,7 +101,8 @@ $HOSTCC -O2 -fuse-ld=lld $warnings $stdflags \ -o .build/mkgamedata src/build/mkgamedata.c src/os.c $HOSTCC -O2 -fuse-ld=lld $warnings $stdflags \ -o .build/mkentprops src/build/mkentprops.c src/os.c -.build/gluegen `for s in $src; do echo "src/$s"; done` +# pass only .c files to gluegen (ignore .S) +.build/gluegen `for s in $src; do if [ "${s##*.}" = "c" ]; then echo "src/$s"; fi; done` .build/mkgamedata gamedata/engine.txt gamedata/gamelib.txt gamedata/inputsystem.txt \ gamedata/matchmaking.txt gamedata/vgui2.txt gamedata/vguimatsurface.txt gamedata/vphysics.txt .build/mkentprops gamedata/entprops.txt @@ -110,11 +113,6 @@ ld $HOSTCC -O2 -g3 $warnings $stdflags -include test/test.h -o .build/bitbuf.test test/bitbuf.test.c .build/bitbuf.test -# XXX: skipping this test on linux for now but should enable when we can test it -#$HOSTCC -m32 -O2 -g3 -include test/test.h -o .build/hook.test test/hook.test.c -#.build/hook.test -$HOSTCC -O2 -g3 $warnings $stdflags -include test/test.h -o .build/kv.test test/kv.test.c -.build/kv.test $HOSTCC -O2 -g3 $warnings $stdflags -include test/test.h -o .build/x86.test test/x86.test.c .build/x86.test -- cgit v1.2.3-54-g00ecf