Hi,

On my current WIP project, I generate a static PIE executable with binutils
2.41 on x86_64 using a glibc 2.38 (compiled with gcc 13.2.0).

If in that project, if I have code using variable arguments (stdarg.h), I will
have to link with libtcc1, but then binutils ld will generate a corrupted
executable which segfaults immediately.

Everything is fine if I use gcc or cproc/qbe.

I did a bit of narrowing, and here is my current state: in va_list.c/__va_arg
implementation in libtcc1, if I have a memcpy call site, the executable binary
will be corrupted.

I tried to change to memset, etc, I currently could not find another function
to call to make it crash like memcpy.  If I replace the memcpy with a basic 8
bytes copy using an unsigned long, the executable will be fine again.

In other words it seems related to the specificities of this memcpy call site
at link time.

If it does not ring any bells to anybody, I suggest to quick-fix it replacing
the memcpy with an unsigned long copy and documenting the issue in the code
until somebody is brave enough to really get at it.

Best regards,

-- 
Sylvain


_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to