Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 05 Aug 2015 01:03:51 +0200
From:      Carlos Jacobo Puga Medina <cpm@fbsd.es>
To:        Jung-uk Kim <jkim@FreeBSD.org>, "freebsd-ports@freebsd.org" <freebsd-ports@freebsd.org>
Subject:   Re: lang/tcc unusable
Message-ID:  <1438729431.17293.13.camel@fbsd.es>
In-Reply-To: <55C140C5.1010404@FreeBSD.org>
References:  <1438633579.6572.13.camel@fbsd.es> <55BFD033.8070507@FreeBSD.org> <1438634467.7343.2.camel@fbsd.es> <55BFDCA0.8040006@FreeBSD.org> <1438638022.7343.7.camel@fbsd.es> <55BFEAAA.4070008@FreeBSD.org> <1438644237.7343.13.camel@fbsd.es> <55C005D7.3050103@FreeBSD.org> <1438700587.2911.4.camel@fbsd.es> <55C13155.3070500@FreeBSD.org> <1438726953.17293.9.camel@fbsd.es> <55C140C5.1010404@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--=-LffhXOm94KK6Q57nfmnl
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

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

Exact! This seems to be a link-related problem, because `tcc -c
hello.c' produces a working hello.o file, which can be (for testing
purposes) linked with gcc, and which results in a correctly running
executable.

I'm investigating this further...
--=20
Carlos Jacobo Puga Medina <cpm@fbsd.es>
PGP fingerprint =3D C60E 9497 5302 793B CC2D  BB89 A1F3 5D66 E6D0 5453
--=-LffhXOm94KK6Q57nfmnl
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAABCAAGBQJVwUTXAAoJEKHzXWbm0FRTyrYIAIXpIzSGswS7VByCSyByJ9BK
swQ6qLQ67fpoGjduvXdpMW7bLKxpaI2lnnjEY8Zq6FFEO5VFlARAxhh/hc1f2M++
2U3rVnR/kNZUJ2Gl4o2/WBvnveBruHrFGxc2Cr7yHf5aRh62zphmqv6BkWb8YUer
O9BOaNIuuuhZYfpCnkYD/bb0Pw2TzfM4hLve3HoK7LY8pQyMhX/A7EdvmIGYdPcz
1rdXqq/ElwqUO2NOxLC0fvYFm+6Q7RujjFQFgOvzbYe+2P0+xyeEprUGp6vArNxt
iqtXus3rktKQ2SdFqRiPgHG6MpeSax0Jp8B5SAHA95jzE2U6SYv9NCmvdFpYj5A=
=w2tF
-----END PGP SIGNATURE-----

--=-LffhXOm94KK6Q57nfmnl--




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1438729431.17293.13.camel>