If I understood correctly the https://github.com/Kray-G/kcs#architecture it's possible to build this project without JIT and I've got it to build without JITX86 but then I'm getting a segfault.
If possible I'll try to build it with emscriptem and load it in a playground similar to https://mingodad.github.io/parsertl-playground/playground/ .
Here is the output of the build:
cd 'kcs/kcs-nb'
/usr/bin/make -f Makefile CONF=Debug clean
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .clean-conf
make[1]: Entering directory 'kcs/kcs-nb'
rm -f -r build/Debug
make[1]: Leaving directory 'kcs/kcs-nb'
CLEAN SUCCESSFUL (total time: 106ms)
cd 'kcs/kcs-nb'
/usr/bin/make -f Makefile CONF=Debug
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory 'kcs/kcs-nb'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux/kcs-nb
make[2]: Entering directory 'kcs/kcs-nb'
mkdir -p build/Debug/GNU-Linux/_ext/6f5954da
rm -f "build/Debug/GNU-Linux/_ext/6f5954da/aesx.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/6f5954da/aesx.o.d" -o build/Debug/GNU-Linux/_ext/6f5954da/aesx.o ../src/_extdll/ext/aesx.c
mkdir -p build/Debug/GNU-Linux/_ext/6f5954da
rm -f "build/Debug/GNU-Linux/_ext/6f5954da/fileio.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/6f5954da/fileio.o.d" -o build/Debug/GNU-Linux/_ext/6f5954da/fileio.o ../src/_extdll/ext/fileio.c
mkdir -p build/Debug/GNU-Linux/_ext/6f5954da
rm -f "build/Debug/GNU-Linux/_ext/6f5954da/sqlite3x.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/6f5954da/sqlite3x.o.d" -o build/Debug/GNU-Linux/_ext/6f5954da/sqlite3x.o ../src/_extdll/ext/sqlite3x.c
mkdir -p build/Debug/GNU-Linux/_ext/6f5954da
rm -f "build/Debug/GNU-Linux/_ext/6f5954da/timer.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/6f5954da/timer.o.d" -o build/Debug/GNU-Linux/_ext/6f5954da/timer.o ../src/_extdll/ext/timer.c
mkdir -p build/Debug/GNU-Linux/_ext/6f5954da
rm -f "build/Debug/GNU-Linux/_ext/6f5954da/zip_unzip.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/6f5954da/zip_unzip.o.d" -o build/Debug/GNU-Linux/_ext/6f5954da/zip_unzip.o ../src/_extdll/ext/zip_unzip.c
mkdir -p build/Debug/GNU-Linux/_ext/1e5b747e
rm -f "build/Debug/GNU-Linux/_ext/1e5b747e/aes.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/1e5b747e/aes.o.d" -o build/Debug/GNU-Linux/_ext/1e5b747e/aes.o ../src/_extdll/lib/aes/aes.c
mkdir -p build/Debug/GNU-Linux/_ext/bd784593
rm -f "build/Debug/GNU-Linux/_ext/bd784593/_fileio.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/bd784593/_fileio.o.d" -o build/Debug/GNU-Linux/_ext/bd784593/_fileio.o ../src/_extdll/lib/fileio/_fileio.c
mkdir -p build/Debug/GNU-Linux/_ext/bd784593
rm -f "build/Debug/GNU-Linux/_ext/bd784593/fclose.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/bd784593/fclose.o.d" -o build/Debug/GNU-Linux/_ext/bd784593/fclose.o ../src/_extdll/lib/fileio/fclose.c
mkdir -p build/Debug/GNU-Linux/_ext/bd784593
rm -f "build/Debug/GNU-Linux/_ext/bd784593/feof.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/bd784593/feof.o.d" -o build/Debug/GNU-Linux/_ext/bd784593/feof.o ../src/_extdll/lib/fileio/feof.c
mkdir -p build/Debug/GNU-Linux/_ext/bd784593
rm -f "build/Debug/GNU-Linux/_ext/bd784593/fflush.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/bd784593/fflush.o.d" -o build/Debug/GNU-Linux/_ext/bd784593/fflush.o ../src/_extdll/lib/fileio/fflush.c
mkdir -p build/Debug/GNU-Linux/_ext/bd784593
rm -f "build/Debug/GNU-Linux/_ext/bd784593/fgetc.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/bd784593/fgetc.o.d" -o build/Debug/GNU-Linux/_ext/bd784593/fgetc.o ../src/_extdll/lib/fileio/fgetc.c
mkdir -p build/Debug/GNU-Linux/_ext/bd784593
rm -f "build/Debug/GNU-Linux/_ext/bd784593/fgetpos.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/bd784593/fgetpos.o.d" -o build/Debug/GNU-Linux/_ext/bd784593/fgetpos.o ../src/_extdll/lib/fileio/fgetpos.c
mkdir -p build/Debug/GNU-Linux/_ext/bd784593
rm -f "build/Debug/GNU-Linux/_ext/bd784593/fgets.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/bd784593/fgets.o.d" -o build/Debug/GNU-Linux/_ext/bd784593/fgets.o ../src/_extdll/lib/fileio/fgets.c
mkdir -p build/Debug/GNU-Linux/_ext/bd784593
rm -f "build/Debug/GNU-Linux/_ext/bd784593/fopen.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/bd784593/fopen.o.d" -o build/Debug/GNU-Linux/_ext/bd784593/fopen.o ../src/_extdll/lib/fileio/fopen.c
mkdir -p build/Debug/GNU-Linux/_ext/bd784593
rm -f "build/Debug/GNU-Linux/_ext/bd784593/fprintf.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/bd784593/fprintf.o.d" -o build/Debug/GNU-Linux/_ext/bd784593/fprintf.o ../src/_extdll/lib/fileio/fprintf.c
mkdir -p build/Debug/GNU-Linux/_ext/bd784593
rm -f "build/Debug/GNU-Linux/_ext/bd784593/fputc.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/bd784593/fputc.o.d" -o build/Debug/GNU-Linux/_ext/bd784593/fputc.o ../src/_extdll/lib/fileio/fputc.c
mkdir -p build/Debug/GNU-Linux/_ext/bd784593
rm -f "build/Debug/GNU-Linux/_ext/bd784593/fputs.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/bd784593/fputs.o.d" -o build/Debug/GNU-Linux/_ext/bd784593/fputs.o ../src/_extdll/lib/fileio/fputs.c
mkdir -p build/Debug/GNU-Linux/_ext/bd784593
rm -f "build/Debug/GNU-Linux/_ext/bd784593/fread.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/bd784593/fread.o.d" -o build/Debug/GNU-Linux/_ext/bd784593/fread.o ../src/_extdll/lib/fileio/fread.c
mkdir -p build/Debug/GNU-Linux/_ext/bd784593
rm -f "build/Debug/GNU-Linux/_ext/bd784593/fseek.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/bd784593/fseek.o.d" -o build/Debug/GNU-Linux/_ext/bd784593/fseek.o ../src/_extdll/lib/fileio/fseek.c
mkdir -p build/Debug/GNU-Linux/_ext/bd784593
rm -f "build/Debug/GNU-Linux/_ext/bd784593/fsetpos.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/bd784593/fsetpos.o.d" -o build/Debug/GNU-Linux/_ext/bd784593/fsetpos.o ../src/_extdll/lib/fileio/fsetpos.c
mkdir -p build/Debug/GNU-Linux/_ext/bd784593
rm -f "build/Debug/GNU-Linux/_ext/bd784593/ftell.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/bd784593/ftell.o.d" -o build/Debug/GNU-Linux/_ext/bd784593/ftell.o ../src/_extdll/lib/fileio/ftell.c
mkdir -p build/Debug/GNU-Linux/_ext/bd784593
rm -f "build/Debug/GNU-Linux/_ext/bd784593/fwrite.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/bd784593/fwrite.o.d" -o build/Debug/GNU-Linux/_ext/bd784593/fwrite.o ../src/_extdll/lib/fileio/fwrite.c
mkdir -p build/Debug/GNU-Linux/_ext/bd784593
rm -f "build/Debug/GNU-Linux/_ext/bd784593/rewind.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/bd784593/rewind.o.d" -o build/Debug/GNU-Linux/_ext/bd784593/rewind.o ../src/_extdll/lib/fileio/rewind.c
mkdir -p build/Debug/GNU-Linux/_ext/bd784593
rm -f "build/Debug/GNU-Linux/_ext/bd784593/ungetc.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/bd784593/ungetc.o.d" -o build/Debug/GNU-Linux/_ext/bd784593/ungetc.o ../src/_extdll/lib/fileio/ungetc.c
mkdir -p build/Debug/GNU-Linux/_ext/bd784593
rm -f "build/Debug/GNU-Linux/_ext/bd784593/vfprintf.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/bd784593/vfprintf.o.d" -o build/Debug/GNU-Linux/_ext/bd784593/vfprintf.o ../src/_extdll/lib/fileio/vfprintf.c
mkdir -p build/Debug/GNU-Linux/_ext/bd784593
rm -f "build/Debug/GNU-Linux/_ext/bd784593/vprintf.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/bd784593/vprintf.o.d" -o build/Debug/GNU-Linux/_ext/bd784593/vprintf.o ../src/_extdll/lib/fileio/vprintf.c
mkdir -p build/Debug/GNU-Linux/_ext/aeea2dd6
rm -f "build/Debug/GNU-Linux/_ext/aeea2dd6/sqlite3.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/aeea2dd6/sqlite3.o.d" -o build/Debug/GNU-Linux/_ext/aeea2dd6/sqlite3.o ../src/_extdll/lib/sqlite3/sqlite3.c
mkdir -p build/Debug/GNU-Linux/_ext/1e5bd2d0
rm -f "build/Debug/GNU-Linux/_ext/1e5bd2d0/miniz.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/1e5bd2d0/miniz.o.d" -o build/Debug/GNU-Linux/_ext/1e5bd2d0/miniz.o ../src/_extdll/lib/zip/miniz.c
mkdir -p build/Debug/GNU-Linux/_ext/da8f9f9a
rm -f "build/Debug/GNU-Linux/_ext/da8f9f9a/compile.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/da8f9f9a/compile.o.d" -o build/Debug/GNU-Linux/_ext/da8f9f9a/compile.o ../src/backend/compile.c
mkdir -p build/Debug/GNU-Linux/_ext/66528aee
rm -f "build/Debug/GNU-Linux/_ext/66528aee/dot.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/66528aee/dot.o.d" -o build/Debug/GNU-Linux/_ext/66528aee/dot.o ../src/backend/graphviz/dot.c
../src/backend/graphviz/dot.c: In function ‘vartostr’:
../src/backend/graphviz/dot.c:91:41: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘const long unsigned int’} [-Wformat=]
91 | n = sprintf(buffer, "%llu", var.imm.u);
| ~~~^ ~~~~~~~~~
| | |
| | uint64_t {aka const long unsigned int}
| long long unsigned int
| %lu
../src/backend/graphviz/dot.c:93:41: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘int64_t’ {aka ‘const long int’} [-Wformat=]
93 | n = sprintf(buffer, "%lld", var.imm.i);
| ~~~^ ~~~~~~~~~
| | |
| | int64_t {aka const long int}
| long long int
| %ld
../src/backend/graphviz/dot.c:103:36: warning: format ‘%Lf’ expects argument of type ‘long double’, but argument 3 has type ‘double’ [-Wformat=]
103 | n = sprintf(buffer, "%LfL", var.imm.ld);
| ~~^ ~~~~~~~~~~
| | |
| long double double
| %f
mkdir -p build/Debug/GNU-Linux/_ext/da8f9f9a
rm -f "build/Debug/GNU-Linux/_ext/da8f9f9a/linker.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/da8f9f9a/linker.o.d" -o build/Debug/GNU-Linux/_ext/da8f9f9a/linker.o ../src/backend/linker.c
mkdir -p build/Debug/GNU-Linux/_ext/6dba1e60
rm -f "build/Debug/GNU-Linux/_ext/6dba1e60/vmacpconv.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/6dba1e60/vmacpconv.o.d" -o build/Debug/GNU-Linux/_ext/6dba1e60/vmacpconv.o ../src/backend/vm/builtin/vmacpconv.c
mkdir -p build/Debug/GNU-Linux/_ext/6dba1e60
rm -f "build/Debug/GNU-Linux/_ext/6dba1e60/vmbuiltin.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/6dba1e60/vmbuiltin.o.d" -o build/Debug/GNU-Linux/_ext/6dba1e60/vmbuiltin.o ../src/backend/vm/builtin/vmbuiltin.c
mkdir -p build/Debug/GNU-Linux/_ext/2f9ec14c
rm -f "build/Debug/GNU-Linux/_ext/2f9ec14c/vmdump.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/2f9ec14c/vmdump.o.d" -o build/Debug/GNU-Linux/_ext/2f9ec14c/vmdump.o ../src/backend/vm/vmdump.c
../src/backend/vm/vmdump.c: In function ‘print_vm_imm’:
../src/backend/vm/vmdump.c:11:14: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘long int’ [-Wformat=]
11 | #define IDT4 " "
| ^~~~~~
../src/backend/vm/vmdump.c:68:32: note: in expansion of macro ‘IDT4’
68 | case VMOP_INT64: printf(IDT4 "%-24s%lld (0x%llx)\n", opname, (int64_t)imm.qword, (int64_t)imm.qword); break;
| ^~~~
../src/backend/vm/vmdump.c:68:46: note: format string is defined here
68 | case VMOP_INT64: printf(IDT4 "%-24s%lld (0x%llx)\n", opname, (int64_t)imm.qword, (int64_t)imm.qword); break;
| ~~~^
| |
| long long int
| %ld
../src/backend/vm/vmdump.c:11:14: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 4 has type ‘long int’ [-Wformat=]
11 | #define IDT4 " "
| ^~~~~~
../src/backend/vm/vmdump.c:68:32: note: in expansion of macro ‘IDT4’
68 | case VMOP_INT64: printf(IDT4 "%-24s%lld (0x%llx)\n", opname, (int64_t)imm.qword, (int64_t)imm.qword); break;
| ^~~~
../src/backend/vm/vmdump.c:68:54: note: format string is defined here
68 | case VMOP_INT64: printf(IDT4 "%-24s%lld (0x%llx)\n", opname, (int64_t)imm.qword, (int64_t)imm.qword); break;
| ~~~^
| |
| long long unsigned int
| %lx
../src/backend/vm/vmdump.c:11:14: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
11 | #define IDT4 " "
| ^~~~~~
../src/backend/vm/vmdump.c:72:32: note: in expansion of macro ‘IDT4’
72 | case VMOP_UINT64: printf(IDT4 "%-24s%llu (0x%llx)\n", opname, imm.qword, imm.qword); break;
| ^~~~
../src/backend/vm/vmdump.c:72:46: note: format string is defined here
72 | case VMOP_UINT64: printf(IDT4 "%-24s%llu (0x%llx)\n", opname, imm.qword, imm.qword); break;
| ~~~^
| |
| long long unsigned int
| %lu
../src/backend/vm/vmdump.c:11:14: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 4 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
11 | #define IDT4 " "
| ^~~~~~
../src/backend/vm/vmdump.c:72:32: note: in expansion of macro ‘IDT4’
72 | case VMOP_UINT64: printf(IDT4 "%-24s%llu (0x%llx)\n", opname, imm.qword, imm.qword); break;
| ^~~~
../src/backend/vm/vmdump.c:72:54: note: format string is defined here
72 | case VMOP_UINT64: printf(IDT4 "%-24s%llu (0x%llx)\n", opname, imm.qword, imm.qword); break;
| ~~~^
| |
| long long unsigned int
| %lx
mkdir -p build/Debug/GNU-Linux/_ext/2f9ec14c
rm -f "build/Debug/GNU-Linux/_ext/2f9ec14c/vmimplir.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/2f9ec14c/vmimplir.o.d" -o build/Debug/GNU-Linux/_ext/2f9ec14c/vmimplir.o ../src/backend/vm/vmimplir.c
mkdir -p build/Debug/GNU-Linux/_ext/2f9ec14c
rm -f "build/Debug/GNU-Linux/_ext/2f9ec14c/vminstr.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/2f9ec14c/vminstr.o.d" -o build/Debug/GNU-Linux/_ext/2f9ec14c/vminstr.o ../src/backend/vm/vminstr.c
mkdir -p build/Debug/GNU-Linux/_ext/2f9ec14c
rm -f "build/Debug/GNU-Linux/_ext/2f9ec14c/vmrunlir.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/2f9ec14c/vmrunlir.o.d" -o build/Debug/GNU-Linux/_ext/2f9ec14c/vmrunlir.o ../src/backend/vm/vmrunlir.c
../src/backend/vm/vmrunlir.c: In function ‘print_stack’:
../src/backend/vm/vmrunlir.c:135:25: warning: '0' flag used with ‘%p’ gnu_printf format [-Wformat=]
135 | printf(" [%08p] ", stack+i);
| ^
../src/backend/vm/vmrunlir.c: In function ‘print_register’:
../src/backend/vm/vmrunlir.c:154:22: warning: '0' flag used with ‘%p’ gnu_printf format [-Wformat=]
154 | printf("gp = %016p\n", stack+gp);
| ^
../src/backend/vm/vmrunlir.c:155:22: warning: '0' flag used with ‘%p’ gnu_printf format [-Wformat=]
155 | printf("bp = %016p\n", stack+bp);
| ^
../src/backend/vm/vmrunlir.c:156:22: warning: '0' flag used with ‘%p’ gnu_printf format [-Wformat=]
156 | printf("sp = %016p\n", stack+sp);
| ^
mkdir -p build/Debug/GNU-Linux/_ext/2f9ec14c
rm -f "build/Debug/GNU-Linux/_ext/2f9ec14c/vmsevelir.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/2f9ec14c/vmsevelir.o.d" -o build/Debug/GNU-Linux/_ext/2f9ec14c/vmsevelir.o ../src/backend/vm/vmsevelir.c
mkdir -p build/Debug/GNU-Linux/_ext/d51e063c
rm -f "build/Debug/GNU-Linux/_ext/d51e063c/abi.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/d51e063c/abi.o.d" -o build/Debug/GNU-Linux/_ext/d51e063c/abi.o ../src/backend/x86_64/abi.c
mkdir -p build/Debug/GNU-Linux/_ext/511e4115
rm -f "build/Debug/GNU-Linux/_ext/511e4115/context.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/511e4115/context.o.d" -o build/Debug/GNU-Linux/_ext/511e4115/context.o ../src/context.c
../src/context.c: In function ‘vfprintf_cc’:
../src/context.c:59:50: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
59 | n += fprintf(stream, "%llu", va_arg(ap, uint64_t));
| ~~~^
| |
| long long unsigned int
| %lu
../src/context.c:62:50: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘int64_t’ {aka ‘long int’} [-Wformat=]
62 | n += fprintf(stream, "%lld", va_arg(ap, int64_t));
| ~~~^
| |
| long long int
| %ld
mkdir -p build/Debug/GNU-Linux/_ext/511e4115
rm -f "build/Debug/GNU-Linux/_ext/511e4115/kcs.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/511e4115/kcs.o.d" -o build/Debug/GNU-Linux/_ext/511e4115/kcs.o ../src/kcs.c
mkdir -p build/Debug/GNU-Linux/_ext/511e4115
rm -f "build/Debug/GNU-Linux/_ext/511e4115/kcsmain.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/511e4115/kcsmain.o.d" -o build/Debug/GNU-Linux/_ext/511e4115/kcsmain.o ../src/kcsmain.c
mkdir -p build/Debug/GNU-Linux/_ext/511e4115
rm -f "build/Debug/GNU-Linux/_ext/511e4115/kcsutil.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/511e4115/kcsutil.o.d" -o build/Debug/GNU-Linux/_ext/511e4115/kcsutil.o ../src/kcsutil.c
mkdir -p build/Debug/GNU-Linux/_ext/932078bb
rm -f "build/Debug/GNU-Linux/_ext/932078bb/liveness.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/932078bb/liveness.o.d" -o build/Debug/GNU-Linux/_ext/932078bb/liveness.o ../src/optimizer/liveness.c
mkdir -p build/Debug/GNU-Linux/_ext/932078bb
rm -f "build/Debug/GNU-Linux/_ext/932078bb/optimize.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/932078bb/optimize.o.d" -o build/Debug/GNU-Linux/_ext/932078bb/optimize.o ../src/optimizer/optimize.c
mkdir -p build/Debug/GNU-Linux/_ext/932078bb
rm -f "build/Debug/GNU-Linux/_ext/932078bb/transform.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/932078bb/transform.o.d" -o build/Debug/GNU-Linux/_ext/932078bb/transform.o ../src/optimizer/transform.c
mkdir -p build/Debug/GNU-Linux/_ext/fdef6a59
rm -f "build/Debug/GNU-Linux/_ext/fdef6a59/declaration.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/fdef6a59/declaration.o.d" -o build/Debug/GNU-Linux/_ext/fdef6a59/declaration.o ../src/parser/declaration.c
mkdir -p build/Debug/GNU-Linux/_ext/fdef6a59
rm -f "build/Debug/GNU-Linux/_ext/fdef6a59/eval.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/fdef6a59/eval.o.d" -o build/Debug/GNU-Linux/_ext/fdef6a59/eval.o ../src/parser/eval.c
mkdir -p build/Debug/GNU-Linux/_ext/fdef6a59
rm -f "build/Debug/GNU-Linux/_ext/fdef6a59/expression.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/fdef6a59/expression.o.d" -o build/Debug/GNU-Linux/_ext/fdef6a59/expression.o ../src/parser/expression.c
mkdir -p build/Debug/GNU-Linux/_ext/fdef6a59
rm -f "build/Debug/GNU-Linux/_ext/fdef6a59/initializer.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/fdef6a59/initializer.o.d" -o build/Debug/GNU-Linux/_ext/fdef6a59/initializer.o ../src/parser/initializer.c
mkdir -p build/Debug/GNU-Linux/_ext/fdef6a59
rm -f "build/Debug/GNU-Linux/_ext/fdef6a59/parse.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/fdef6a59/parse.o.d" -o build/Debug/GNU-Linux/_ext/fdef6a59/parse.o ../src/parser/parse.c
mkdir -p build/Debug/GNU-Linux/_ext/fdef6a59
rm -f "build/Debug/GNU-Linux/_ext/fdef6a59/statement.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/fdef6a59/statement.o.d" -o build/Debug/GNU-Linux/_ext/fdef6a59/statement.o ../src/parser/statement.c
mkdir -p build/Debug/GNU-Linux/_ext/fdef6a59
rm -f "build/Debug/GNU-Linux/_ext/fdef6a59/symtab.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/fdef6a59/symtab.o.d" -o build/Debug/GNU-Linux/_ext/fdef6a59/symtab.o ../src/parser/symtab.c
../src/parser/symtab.c: In function ‘print_symbol’:
../src/parser/symtab.c:726:41: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘int64_t’ {aka ‘const long int’} [-Wformat=]
726 | fprintf(stream, ", value=%lld", sym->value.constant.i);
| ~~~^ ~~~~~~~~~~~~~~~~~~~~~
| | |
| long long int int64_t {aka const long int}
| %ld
../src/parser/symtab.c:728:41: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘const long unsigned int’} [-Wformat=]
728 | fprintf(stream, ", value=%llu", sym->value.constant.u);
| ~~~^ ~~~~~~~~~~~~~~~~~~~~~
| | |
| long long unsigned int uint64_t {aka const long unsigned int}
| %lu
../src/parser/symtab.c:735:40: warning: format ‘%Lf’ expects argument of type ‘long double’, but argument 3 has type ‘double’ [-Wformat=]
735 | fprintf(stream, ", value=%Lf", sym->value.constant.ld);
| ~~^ ~~~~~~~~~~~~~~~~~~~~~~
| | |
| long double double
| %f
mkdir -p build/Debug/GNU-Linux/_ext/fdef6a59
rm -f "build/Debug/GNU-Linux/_ext/fdef6a59/typetree.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/fdef6a59/typetree.o.d" -o build/Debug/GNU-Linux/_ext/fdef6a59/typetree.o ../src/parser/typetree.c
mkdir -p build/Debug/GNU-Linux/_ext/5c5bfc09
rm -f "build/Debug/GNU-Linux/_ext/5c5bfc09/directive.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/5c5bfc09/directive.o.d" -o build/Debug/GNU-Linux/_ext/5c5bfc09/directive.o ../src/preprocessor/directive.c
mkdir -p build/Debug/GNU-Linux/_ext/5c5bfc09
rm -f "build/Debug/GNU-Linux/_ext/5c5bfc09/input.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/5c5bfc09/input.o.d" -o build/Debug/GNU-Linux/_ext/5c5bfc09/input.o ../src/preprocessor/input.c
mkdir -p build/Debug/GNU-Linux/_ext/5c5bfc09
rm -f "build/Debug/GNU-Linux/_ext/5c5bfc09/macro.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/5c5bfc09/macro.o.d" -o build/Debug/GNU-Linux/_ext/5c5bfc09/macro.o ../src/preprocessor/macro.c
../src/preprocessor/macro.c: In function ‘print_token_array’:
../src/preprocessor/macro.c:244:31: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘int64_t’ {aka ‘long int’} [-Wformat=]
244 | printf("<param %lld>", t.d.val.i);
| ~~~^ ~~~~~~~~~
| | |
| | int64_t {aka long int}
| long long int
| %ld
mkdir -p build/Debug/GNU-Linux/_ext/5c5bfc09
rm -f "build/Debug/GNU-Linux/_ext/5c5bfc09/preprocess.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/5c5bfc09/preprocess.o.d" -o build/Debug/GNU-Linux/_ext/5c5bfc09/preprocess.o ../src/preprocessor/preprocess.c
../src/preprocessor/preprocess.c: In function ‘stringify_token’:
../src/preprocessor/preprocess.c:360:34: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘const long unsigned int’} [-Wformat=]
360 | sprintf(buf, "%llul", t->d.val.u);
| ~~~^ ~~~~~~~~~~
| | |
| | uint64_t {aka const long unsigned int}
| long long unsigned int
| %lu
../src/preprocessor/preprocess.c:362:34: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘const long unsigned int’} [-Wformat=]
362 | sprintf(buf, "%llu", t->d.val.u);
| ~~~^ ~~~~~~~~~~
| | |
| | uint64_t {aka const long unsigned int}
| long long unsigned int
| %lu
../src/preprocessor/preprocess.c:366:34: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘int64_t’ {aka ‘const long int’} [-Wformat=]
366 | sprintf(buf, "%lld", t->d.val.i);
| ~~~^ ~~~~~~~~~~
| | |
| | int64_t {aka const long int}
| long long int
| %ld
../src/preprocessor/preprocess.c:368:34: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘int64_t’ {aka ‘const long int’} [-Wformat=]
368 | sprintf(buf, "%lld", t->d.val.i);
| ~~~^ ~~~~~~~~~~
| | |
| | int64_t {aka const long int}
| long long int
| %ld
../src/preprocessor/preprocess.c:376:29: warning: format ‘%Lf’ expects argument of type ‘long double’, but argument 3 has type ‘double’ [-Wformat=]
376 | sprintf(buf, "%Lf", t->d.val.ld);
| ~~^ ~~~~~~~~~~~
| | |
| long double double
| %f
mkdir -p build/Debug/GNU-Linux/_ext/5c5bfc09
rm -f "build/Debug/GNU-Linux/_ext/5c5bfc09/strtab.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/5c5bfc09/strtab.o.d" -o build/Debug/GNU-Linux/_ext/5c5bfc09/strtab.o ../src/preprocessor/strtab.c
mkdir -p build/Debug/GNU-Linux/_ext/5c5bfc09
rm -f "build/Debug/GNU-Linux/_ext/5c5bfc09/tokenize.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/5c5bfc09/tokenize.o.d" -o build/Debug/GNU-Linux/_ext/5c5bfc09/tokenize.o ../src/preprocessor/tokenize.c
mkdir -p build/Debug/GNU-Linux/_ext/c34564bc
rm -f "build/Debug/GNU-Linux/_ext/c34564bc/argparse.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/c34564bc/argparse.o.d" -o build/Debug/GNU-Linux/_ext/c34564bc/argparse.o ../src/util/argparse.c
mkdir -p build/Debug/GNU-Linux/_ext/c34564bc
rm -f "build/Debug/GNU-Linux/_ext/c34564bc/fmemopen.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/c34564bc/fmemopen.o.d" -o build/Debug/GNU-Linux/_ext/c34564bc/fmemopen.o ../src/util/fmemopen.c
mkdir -p build/Debug/GNU-Linux/_ext/c34564bc
rm -f "build/Debug/GNU-Linux/_ext/c34564bc/hash.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/c34564bc/hash.o.d" -o build/Debug/GNU-Linux/_ext/c34564bc/hash.o ../src/util/hash.c
mkdir -p build/Debug/GNU-Linux/_ext/c34564bc
rm -f "build/Debug/GNU-Linux/_ext/c34564bc/string.o.d"
gcc -DNO_X86JIT -DAES256=1 -c -g -I../include -MMD -MP -MF "build/Debug/GNU-Linux/_ext/c34564bc/string.o.d" -o build/Debug/GNU-Linux/_ext/c34564bc/string.o ../src/util/string.c
mkdir -p dist/Debug/GNU-Linux
gcc -DNO_X86JIT -DAES256=1 -o dist/Debug/GNU-Linux/kcs-nb build/Debug/GNU-Linux/_ext/6f5954da/aesx.o build/Debug/GNU-Linux/_ext/6f5954da/fileio.o build/Debug/GNU-Linux/_ext/6f5954da/sqlite3x.o build/Debug/GNU-Linux/_ext/6f5954da/timer.o build/Debug/GNU-Linux/_ext/6f5954da/zip_unzip.o build/Debug/GNU-Linux/_ext/1e5b747e/aes.o build/Debug/GNU-Linux/_ext/bd784593/_fileio.o build/Debug/GNU-Linux/_ext/bd784593/fclose.o build/Debug/GNU-Linux/_ext/bd784593/feof.o build/Debug/GNU-Linux/_ext/bd784593/fflush.o build/Debug/GNU-Linux/_ext/bd784593/fgetc.o build/Debug/GNU-Linux/_ext/bd784593/fgetpos.o build/Debug/GNU-Linux/_ext/bd784593/fgets.o build/Debug/GNU-Linux/_ext/bd784593/fopen.o build/Debug/GNU-Linux/_ext/bd784593/fprintf.o build/Debug/GNU-Linux/_ext/bd784593/fputc.o build/Debug/GNU-Linux/_ext/bd784593/fputs.o build/Debug/GNU-Linux/_ext/bd784593/fread.o build/Debug/GNU-Linux/_ext/bd784593/fseek.o build/Debug/GNU-Linux/_ext/bd784593/fsetpos.o build/Debug/GNU-Linux/_ext/bd784593/ftell.o build/Debug/GNU-Linux/_ext/bd784593/fwrite.o build/Debug/GNU-Linux/_ext/bd784593/rewind.o build/Debug/GNU-Linux/_ext/bd784593/ungetc.o build/Debug/GNU-Linux/_ext/bd784593/vfprintf.o build/Debug/GNU-Linux/_ext/bd784593/vprintf.o build/Debug/GNU-Linux/_ext/aeea2dd6/sqlite3.o build/Debug/GNU-Linux/_ext/1e5bd2d0/miniz.o build/Debug/GNU-Linux/_ext/da8f9f9a/compile.o build/Debug/GNU-Linux/_ext/66528aee/dot.o build/Debug/GNU-Linux/_ext/da8f9f9a/linker.o build/Debug/GNU-Linux/_ext/6dba1e60/vmacpconv.o build/Debug/GNU-Linux/_ext/6dba1e60/vmbuiltin.o build/Debug/GNU-Linux/_ext/2f9ec14c/vmdump.o build/Debug/GNU-Linux/_ext/2f9ec14c/vmimplir.o build/Debug/GNU-Linux/_ext/2f9ec14c/vminstr.o build/Debug/GNU-Linux/_ext/2f9ec14c/vmrunlir.o build/Debug/GNU-Linux/_ext/2f9ec14c/vmsevelir.o build/Debug/GNU-Linux/_ext/d51e063c/abi.o build/Debug/GNU-Linux/_ext/511e4115/context.o build/Debug/GNU-Linux/_ext/511e4115/kcs.o build/Debug/GNU-Linux/_ext/511e4115/kcsmain.o build/Debug/GNU-Linux/_ext/511e4115/kcsutil.o build/Debug/GNU-Linux/_ext/932078bb/liveness.o build/Debug/GNU-Linux/_ext/932078bb/optimize.o build/Debug/GNU-Linux/_ext/932078bb/transform.o build/Debug/GNU-Linux/_ext/fdef6a59/declaration.o build/Debug/GNU-Linux/_ext/fdef6a59/eval.o build/Debug/GNU-Linux/_ext/fdef6a59/expression.o build/Debug/GNU-Linux/_ext/fdef6a59/initializer.o build/Debug/GNU-Linux/_ext/fdef6a59/parse.o build/Debug/GNU-Linux/_ext/fdef6a59/statement.o build/Debug/GNU-Linux/_ext/fdef6a59/symtab.o build/Debug/GNU-Linux/_ext/fdef6a59/typetree.o build/Debug/GNU-Linux/_ext/5c5bfc09/directive.o build/Debug/GNU-Linux/_ext/5c5bfc09/input.o build/Debug/GNU-Linux/_ext/5c5bfc09/macro.o build/Debug/GNU-Linux/_ext/5c5bfc09/preprocess.o build/Debug/GNU-Linux/_ext/5c5bfc09/strtab.o build/Debug/GNU-Linux/_ext/5c5bfc09/tokenize.o build/Debug/GNU-Linux/_ext/c34564bc/argparse.o build/Debug/GNU-Linux/_ext/c34564bc/fmemopen.o build/Debug/GNU-Linux/_ext/c34564bc/hash.o build/Debug/GNU-Linux/_ext/c34564bc/string.o -lm -ldl -lpthread
make[2]: Leaving directory 'kcs/kcs-nb'
make[1]: Leaving directory 'kcs/kcs-nb'
BUILD SUCCESSFUL (total time: 8s)
Here is the output of valgrind:
==11393== Memcheck, a memory error detector
==11393== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==11393== Using Valgrind-3.21.0 and LibVEX; rerun with -h for copyright info
==11393== Command: ../kcs-nb/dist/Debug/GNU-Linux/kcs-nb test.c
==11393==
==11393== Invalid write of size 8
==11393== at 0x4C3D2F3: memmove (vg_replace_strmem.c:1400)
==11393== by 0x20E920: emit_vm_push_string (vminstr.c:245)
==11393== by 0x21303D: vm_load_var (vminstr.c:586)
==11393== by 0x2136E0: vm_gen_expr (vminstr.c:698)
==11393== by 0x21596A: vm_gen_node (vminstr.c:855)
==11393== by 0x216467: vm_gen_node (vminstr.c:923)
==11393== by 0x216467: vm_gen_node (vminstr.c:923)
==11393== by 0x218EE6: vm_gen_lir (vminstr.c:1280)
==11393== by 0x201D4B: compile (compile.c:3401)
==11393== by 0x226C08: process_file (kcsmain.c:604)
==11393== by 0x226E31: kcsmain (kcsmain.c:669)
==11393== by 0x2259FD: main (kcs.c:6)
==11393== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==11393==
==11393==
==11393== Process terminating with default action of signal 11 (SIGSEGV)
==11393== Access not within mapped region at address 0x0
==11393== at 0x4C3D2F3: memmove (vg_replace_strmem.c:1400)
==11393== by 0x20E920: emit_vm_push_string (vminstr.c:245)
==11393== by 0x21303D: vm_load_var (vminstr.c:586)
==11393== by 0x2136E0: vm_gen_expr (vminstr.c:698)
==11393== by 0x21596A: vm_gen_node (vminstr.c:855)
==11393== by 0x216467: vm_gen_node (vminstr.c:923)
==11393== by 0x216467: vm_gen_node (vminstr.c:923)
==11393== by 0x218EE6: vm_gen_lir (vminstr.c:1280)
==11393== by 0x201D4B: compile (compile.c:3401)
==11393== by 0x226C08: process_file (kcsmain.c:604)
==11393== by 0x226E31: kcsmain (kcsmain.c:669)
==11393== by 0x2259FD: main (kcs.c:6)
==11393== If you believe this happened as a result of a stack
==11393== overflow in your program's main thread (unlikely but
==11393== possible), you can try to increase the size of the
==11393== main thread stack using the --main-stacksize= flag.
==11393== The main thread stack size used in this run was 8388608.
==11393==
==11393== HEAP SUMMARY:
==11393== in use at exit: 240,285 bytes in 596 blocks
==11393== total heap usage: 623 allocs, 27 frees, 259,379 bytes allocated
==11393==
==11393== LEAK SUMMARY:
==11393== definitely lost: 0 bytes in 0 blocks
==11393== indirectly lost: 0 bytes in 0 blocks
==11393== possibly lost: 0 bytes in 0 blocks
==11393== still reachable: 240,285 bytes in 596 blocks
==11393== suppressed: 0 bytes in 0 blocks
==11393== Rerun with --leak-check=full to see details of leaked memory
==11393==
==11393== For lists of detected and suppressed errors, rerun with: -s
==11393== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Segmentation fault (core dumped)
test.c:
Here is the changes made to Makefile to be able to execute the tests (because in Ubuntu 18.04 the default sh isn't bash and the actual built binary is kcs instead of kcc):
----------------------------------- Makefile -----------------------------------
index bf71833..187cbbb 100644
@@ -148,18 +148,18 @@ bin/bootstrap/libonig.a:
cp -f src/_extdll/lib/onig/src/.libs/libonig.a $(@D)/libonig.a
test-8cc: $(TARGET)
- sh ./test/test-8cc/test.sh
+ bash ./test/test-8cc/test.sh
test-qcc: $(TARGET)
- sh ./test/test-qcc/test.sh
+ bash ./test/test-qcc/test.sh
test-lacc: $(TARGET)
- sh ./test/test-lacc/test.sh
+ bash ./test/test-lacc/test.sh
test-picoc: $(TARGET)
- sh ./test/test-picoc/test.sh
- sh ./test/test-picoc/csmith.sh
- sh ./test/test-picoc/csmith.sh -j
+ bash ./test/test-picoc/test.sh
+ bash ./test/test-picoc/csmith.sh
+ bash ./test/test-picoc/csmith.sh -j
test: test-8cc test-qcc test-lacc test-picoc
---------------------------- test/test-8cc/test.sh ----------------------------
index 6d0f7f0..9fc2782 100644
@@ -1,8 +1,8 @@
#!/bin/sh
if [ "$1" = "-j" ]; then
- CC="../../kcc -j";
+ CC="../../kcs -j";
else
- CC="../../kcc -x"
+ CC="../../kcs -x"
fi
pushd `dirname $0`
---------------------------- test/test-lacc/test.sh ----------------------------
index ac5ceec..889af8c 100644
@@ -1,6 +1,6 @@
#!/bin/sh
-CC="../../kcc -x"
+CC="../../kcs -x"
if [ "$CC" = "" ]; then
exit 1
fi
-------------------------- test/test-picoc/csmith.sh --------------------------
index b782ac0..121a65f 100644
@@ -1,8 +1,8 @@
#!/bin/sh
if [ "$1" = "-j" ]; then
- CC="../../kcc -j";
+ CC="../../kcs -j";
else
- CC="../../kcc -x"
+ CC="../../kcs -x"
fi
if [ "$CC" = "" ]; then
--------------------------- test/test-picoc/test.sh ---------------------------
index cdad7ed..c0e29bd 100644
@@ -1,8 +1,8 @@
#!/bin/sh
if [ "$1" = "-j" ]; then
- CC="../../kcc -j";
+ CC="../../kcs -j";
else
- CC="../../kcc -x"
+ CC="../../kcs -x"
fi
if [ "$CC" = "" ]; then
---------------------------- test/test-qcc/test.sh ----------------------------
index 461e474..b442347 100644
@@ -1,8 +1,8 @@
#!/bin/sh
if [ "$1" = "-j" ]; then
- CC="../../kcc -j";
+ CC="../../kcs -j";
else
- CC="../../kcc -x"
+ CC="../../kcs -x"
fi
function do_test() {
---------------------------- src/backend/compile.c ----------------------------
index 937a3d9..95b5777 100644
@@ -1945,7 +1945,12 @@ static enum reg compile_call(struct var target, struct var ptr)
if (ptr.kind == ADDRESS) {
assert(!ptr.offset);
- void *builtin = jit_get_builtin_function(sym_name(ptr.symbol));
+ void *builtin =
+#ifndef NO_X86JIT
+ jit_get_builtin_function(sym_name(ptr.symbol));
+#else
+ NULL;
+#endif
if (builtin) {
#if defined(KCC_WINDOWS)
/*
@@ -3348,6 +3353,7 @@ INTERNAL void set_compile_target(FILE *stream, const char *file)
case TARGET_IR_DOT:
dot_init(stream);
break;
+#ifndef NO_X86JIT
case TARGET_x86_64_ASM:
asm_init(stream, file);
enter_context = asm_symbol;
@@ -3374,6 +3380,7 @@ INTERNAL void set_compile_target(FILE *stream, const char *file)
flush_backend = elf_flush;
finalize_backend = elf_finalize;
break;
+#endif
}
}
@@ -3395,6 +3402,7 @@ INTERNAL int compile(struct definition *def)
break;
case TARGET_PREPROCESS:
break;
+#ifndef NO_X86JIT
case TARGET_x86_64_ASM:
case TARGET_x86_64_JIT:
case TARGET_x86_64_JIT_ASM:
@@ -3411,8 +3419,8 @@ INTERNAL int compile(struct definition *def)
compile_data(def);
}
break;
+#endif
}
-
assert(x87_stack == 0);
return 0;
}
-------------------------------- src/kcsmain.c --------------------------------
index b67de62..cc75136 100644
@@ -670,7 +670,7 @@ DLLEXPORT int kcsmain(int argc, char *argv[])
goto end;
}
}
-
+#ifndef NO_X86JIT
if (context.target == TARGET_x86_64_EXE) {
ret = invoke_linker();
} else if (context.target == TARGET_IR_RUN) {
@@ -678,7 +678,7 @@ DLLEXPORT int kcsmain(int argc, char *argv[])
} else if (context.target == TARGET_x86_64_JIT) {
ret = jit_get_return_value();
}
-
+#endif
end:
finalize();
parse_finalize();
-------------------------------- src/kcsutil.c --------------------------------
index afc51bc..fc1b4b2 100644
@@ -51,13 +51,11 @@ char* get_exe_path(void)
char* get_exe_path(void)
{
- static char s_result[2048] = {0};
+ static char s_result[PATH_MAX] = {0};
if (!s_result[0]) {
char* p;
- char exe_full_path[PATH_MAX];
- readlink("/proc/self/exe", exe_full_path, PATH_MAX);
- strncpy(s_result, exe_full_path, 2040);
+ readlink("/proc/self/exe", s_result, PATH_MAX-2);
p = strrchr(s_result, '/');
if (p) *p = 0;
}
If I understood correctly the https://github.com/Kray-G/kcs#architecture it's possible to build this project without
JITand I've got it to build withoutJITX86but then I'm getting a segfault.If possible I'll try to build it with
emscriptemand load it in a playground similar to https://mingodad.github.io/parsertl-playground/playground/ .Here is the output of the build:
Here is the output of
valgrind:test.c:
Here is the changes made to
Makefileto be able to execute the tests (because in Ubuntu 18.04 the defaultshisn'tbashand the actual built binary iskcsinstead ofkcc):