On 17.11.2025 14:33, Herman ten Brugge via Tinycc-devel wrote:
Op 16-11-2025 om 11:07 schreef DFP:
It seems like when -run is used with -nostdlib, the tcc_run() function calls 
the _start symbol as-if it was a function. Which is not correct ...
I pushed a fix for this.

     Herman

Hi Herman,

I'd think you could make better patches if you would take yourself
more time:

1) More time before you even start, because not everything what people
want is also reasonable, generally as well as specifically in tinycc.

2) Also more time before you push the patch on the public mob branch,
because usually the first idea is not the best idea.

For example with
    "Allow -nostdlib -run"
I'd rather remove the feature completely than have that patch in tinycc
code.  Instead we can simply require 'main' with tcc -run always and
have 100 lines ugliness less.

Note the original commit was this one
https://repo.or.cz/tinycc.git/commitdiff/fa0ef91a247d68df919cfe11f2c7eaad7dc7e75c
Obviously it was incomplete.  But nobody says that we have to fix it.

In principle one could make it much more cleanly, say with a "runstart.o"
using a combination of alloca() and an indirect goto (goto *&_start);

But it isn't worth even that, I think.

As to
    Move lib/va_list.c into include/tccdefs.h
    This makes code with va_arg work with -nostdlib on x86_64.

Sure, but who says it needs to work without libtcc1.a?  There are
many features that don't work without the support library, such
as int <-> float conversions, long long div, etc.  Also structure
init & copy do require memset/memmove from libc.  What's special
with va_arg then?

Also:
   "Free all preprocessor memmory in case of error."
that's more complicated than it needs to be. You could simply
replace tcc_realloc/free() in the original implementation
by calls to tcc_realloc/free_impl() and don't need those ugly
macros.

Also
    Relaxed the 'incompatible pointer type' warning a bit
not from you, but I think it's wrong and should be reverted.

-- gr

_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to