From owner-freebsd-ports@freebsd.org Tue Aug 4 23:04:04 2015 Return-Path: Delivered-To: freebsd-ports@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A4009B36A3 for ; Tue, 4 Aug 2015 23:04:04 +0000 (UTC) (envelope-from cpm@fbsd.es) Received: from imap11-3.ox.privateemail.com (imap11-3.ox.privateemail.com [198.187.29.245]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "privateemail.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6E674F6B; Tue, 4 Aug 2015 23:04:04 +0000 (UTC) (envelope-from cpm@fbsd.es) Received: from localhost (localhost [127.0.0.1]) by imap11.ox.privateemail.com (Postfix) with ESMTP id 6B68A8800F2; Tue, 4 Aug 2015 19:03:57 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap11.ox.privateemail.com Received: from imap11.ox.privateemail.com ([127.0.0.1]) by localhost (imap11.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id g1TEs1C_7iBv; Tue, 4 Aug 2015 19:03:57 -0400 (EDT) Received: from daemonlab (120.Red-83-58-115.dynamicIP.rima-tde.net [83.58.115.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by imap11.ox.privateemail.com (Postfix) with ESMTPSA id 983058800E5; Tue, 4 Aug 2015 19:03:56 -0400 (EDT) Message-ID: <1438729431.17293.13.camel@fbsd.es> Subject: Re: lang/tcc unusable From: Carlos Jacobo Puga Medina To: Jung-uk Kim , "freebsd-ports@freebsd.org" Date: Wed, 05 Aug 2015 01:03:51 +0200 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> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-LffhXOm94KK6Q57nfmnl" X-Mailer: Evolution 3.16.4 (3.16.4-2.fc22) Mime-Version: 1.0 X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Aug 2015 23:04:04 -0000 --=-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 > > > > > > > > > > > >=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 >=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 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--