[CM] S7 questions and libc issue

Fernando Oleo Blanco irvise_ml at irvise.xyz
Sat May 14 15:18:25 PDT 2022

Am Sat, 14 May 2022 21:52:40 +0000
schrieb "Fernando Oleo Blanco" <irvise_ml at irvise.xyz>:

> Though do not take this as a bug report. It may be just TCC being TCC.
> I tried with no optimisations (-O0) and the same error was produced.

Maybe it is a bug... I looked for GCC in the s7.c source code to try
and find whether GCC was being hard-coded as the compiler (when
generating the .so). I quickly found the WITH_GCC flag. I noticed that
it is automatically turned off if the compiler is not GCC nor Clang. So
I patched it to also allow TINYC (see below) and recompiled the "repl"
and tried running it... And it works!!! Though there is a warning and
some things may need some more review (such as complex number support).

fernando at linux:~/Builds/S7-scheme/s7> ../../tcc-0.9.27-master/tcc s7.c -o repl -DWITH_MAIN -I. -O0 -g -ldl -lm -Wl,-export-dynamic -Wno-stringop-overflow -DWITH_GCC
s7.c:52107: warning: function might return no value: 'g_abort'
fernando at linux:~/Builds/S7-scheme/s7> rm libc_s7.*
rm: das Entfernen von 'libc_s7.*' ist nicht möglich: No such file or directory
fernando at linux:~/Builds/S7-scheme/s7> ./repl r7rs.scm
s7: 16-May-2022
load r7rs.scm
writing libc_s7.c
loading libc_s7.so
fernando at linux:~/Builds/S7-scheme/s7>


The patch is:

diff --git a/s7.c b/s7.c
index 2a7cce7..5c0f737 100644
--- a/s7.c
+++ b/s7.c
@@ -119,7 +119,7 @@
  * this code doesn't compile anymore in gcc 4.3 -- c11 might be needed

-#if (defined(__GNUC__) || defined(__clang__)) /* s7 uses PRId64 so (for example) g++ 4.4 is too old */
+#if (defined(__GNUC__) || defined(__clang__) || defined(__TINYC__)) /* s7 uses PRId64 so (for example) g++ 4.4 is too old */
   #define WITH_GCC 1
   #define WITH_GCC 0


More information about the Cmdist mailing list