lang/tcc unusable

Jung-uk Kim jkim at FreeBSD.org
Tue Aug 4 22:46:30 UTC 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 08/04/2015 18:22, Carlos Jacobo Puga Medina wrote:
> El mar, 04-08-2015 a las 17:40 -0400, Jung-uk Kim escribió:
>> On 08/04/2015 11:03, Carlos Jacobo Puga Medina wrote:
>>> El lun, 03-08-2015 a las 20:22 -0400, Jung-uk Kim escribió:
>>>> On 08/03/2015 19:23, Carlos Jacobo Puga Medina wrote:
>>>>> El lun, 03-08-2015 a las 18:26 -0400, Jung-uk Kim
>>>>> escribió:
>>>>>> On 08/03/2015 17:40, Carlos Jacobo Puga Medina wrote:
>>>>>>> El lun, 03-08-2015 a las 17:26 -0400, Jung-uk Kim 
>>>>>>> escribió:
>>>>>>>> On 08/03/2015 16:41, Carlos Jacobo Puga Medina
>>>>>>>> wrote:
>>>>>>>>> El lun, 03-08-2015 a las 16:33 -0400, Jung-uk Kim 
>>>>>>>>> escribió:
>>>>>>>>> 
>>>>>>>>> Hi Jung-uk,
>>> 
>>>>>>>>>> On 08/03/2015 16:26, Carlos Jacobo Puga Medina 
>>>>>>>>>> wrote:
>>>>>>>>>>> Hi people,
>>>>>>>>>>> 
>>>>>>>>>>> Recently I added amd64 support to TinyCC, but I
>>>>>>>>>>>  encounter the following problem trying to
>>>>>>>>>>> compile a simple code.
>>>>>>>>>>> 
>>>>>>>>>>> #include <stdio.h>
>>>>>>>>>>> 
>>>>>>>>>>> int main(){ printf("hello, world!\n); return 0;
>>>>>>>>>>> }
>>>>>>>>>>> 
>>>>>>>>>>> % tcc -o hello hello.c In file included from 
>>>>>>>>>>> hello.c:1: /usr/include/stdio.h:63: error: ';' 
>>>>>>>>>>> expected (got "va_list")
>>>>>>>>>>> 
>>>>>>>>>>> I guess that some change introduced in
>>>>>>>>>>> 'stdio.h' causes this weird behaviour. Last
>>>>>>>>>>> time that TCC worked fine was on FreeBSD 9.1
>>>>>>>>>>> -RELEASE/i386.
>>>>>>>>>>> 
>>>>>>>>>>> Also I reported this problem in the
>>>>>>>>>>> tinycc-devel mailing list [1]
>>>>>>>>>>> 
>>>>>>>>>>> Any thoughts?
>>>>>>>>>> 
>>>>>>>>>> I haven't tried tcc but '"' is missing for the 
>>>>>>>>>> printf().
>>>>>>>>> 
>>>>>>>>> Yes, it was a typo here :)
>>>>>>>> 
>>>>>>>> It seems it's a known tcc bug:
>>>>>>>> 
>>>>>>>> http://savannah.nongnu.org/bugs/?30966
>>>>>>>> 
>>>>>>> 
>>>>>>> Is there something that we can do about it?
>>>>>>> 
>>>>>>> Thanks for pointing me, jkim@
>>>>>> 
>>>>>> It seems there is no easy way to fix this problem without
>>>>>>  touching src tree, e.g.,
>>>>>> 
>>>>>> --- sys/x86/include/_types.h	(revision 286256) +++ 
>>>>>> sys/x86/include/_types.h	(working copy) @@ -152,7 +152,7
>>>>>> @@ */ #ifdef __GNUCLIKE_BUILTIN_VARARGS typedef 
>>>>>> __builtin_va_lis t __va_list;	/* internally known to gcc
>>>>>> */ -#elif defined(lint) +#elif defined(__TINYC__) || 
>>>>>> defined(lint) typedef	char * __va_list;	/* pretend */
>>>>>> #endif #if defined(__GNUC_VA_LIST_COMPATIBILITY) && 
>>>>>> !defined(__GNUC_VA_LIST) \
>>>>>> 
>>>>> 
>>>>> If you need doing some changes into the src tree.
>>>> 
>>>> https://svnweb.freebsd.org/changeset/base/286265
>>>> 
>>> 
>>> That's OK!
>>> 
>>>>> So, what do you recommend in such case? Would it be much 
>>>>> trouble add the necessary changes to run TCC again? 
>>>>> Furthermore, TinyCC developer has ignored this issue 
>>>>> completely.
>>>> 
>>>> The only hack I see is defining __va_list as a macro from 
>>>> libtcc.c but it is ugly.
>>>> 
>>> 
>>> Probably this should be discussed in the tinycc-devel ML. In
>>> the meanwhile we can try your dirty hack :-)
>> 
>> See the attached patch.  Yes, it is ugly. ;-)
> 
> It works :)
> 
> If I compile some c file it generates a coredump (Bus error)
> 
> /* traditional way */
> 
> % tcc -o hello hello.c % ./hello Bus error (core dumped)
> 
> Although, it works using '-run' option
> 
> % tcc -run hello.c hello, world!

Yes, I saw that, too.

% cat hello.c
#include <stdio.h>

int
main(void)
{

	printf("Hello, world!\n");
	return (0);
}
% tcc -c hello.c
% tcc -o hello hello.o
% ./hello
Bus error (core dumped)
% cc -o hello hello.o
% ./hello
Hello, world!

In other words, tcc can compile but linking is broken, I guess.

Jung-uk Kim
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJVwUC/AAoJEHyflib82/FGJHkH/3Pi3cKj3nSZD6iNg4T0JY2/
BIo0FM2kkKbzdcKJfpYd8kxwqb3zeEkyL9Bq6JAHNkQo7ehPjBTgJHb7hMr8uyYa
VCXhSjJI/jTFsSuey6000XA6Rj6q6oPB22L9Ojgdca+dN0RShNeUTcuT6lB637uj
TyPjkBFvOGBNEZti+/uJmmOlwn3d/xB1j9voYaq1oIXwUb7Zof178aBvWGdPCPNu
owBuPJ/dYodh5j4hWpxOsQspeRWJkRMa1i9FGg/rByb6dR4YL5Go/7RciCc5AXn7
hbRUwKvnyZihUnE0AHqBWndgLdYkP8OHYprBVqD0Zdj5YR+gqA4lXsthR9vOi2w=
=nFtd
-----END PGP SIGNATURE-----


More information about the freebsd-ports mailing list