Op 01-11-2025 om 11:29 schreef DFP:
When compiling a program with -nostdlib and using va_arg(), TCC complains about 
'__va_arg' being undefined:

$ tcc -nostdlib -D__STDC_HOSTED__=0 test.c
tcc: error: undefined symbol '__va_arg'

This is not fixed by telling it to link with libtcc1:

$ tcc -nostdlib -ltcc1 -D__STDC_HOSTED__=0 test.c
tcc: error: undefined symbol '__va_arg'

This is on amd64 (x86_64), using the mob version.

Another (minor) issue is __STDC_HOSTED__ macro not being defined. As specified 
by C98 standard, 6.10.8 p1, it should be defined as 1 if the implementation is 
a hosted implementation, and 0 if not. (Not sure if it is specified in C89.) In 
GCC and CLang, it is 1 by default, and there is a helpful -ffreestanding switch 
that toggles it to 0. I think it should be defined in TCC, and set to 0 when 
-nostdlib switch is supplied, so my program can detect whether to provide the 
'_start' entry point. But tell me what you think.

Both problems should be fixed now.

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

Reply via email to