El vie, 24-07-2015 a las 01:50 +0200, Carlos Jacobo Puga Medina
escribió:
> El mié, 22-07-2015 a las 03:25 +0200, Carlos Jacobo Puga Medina
> escribió:
> > El mar, 21-07-2015 a las 18:47 +0200, Carlos Jacobo Puga Medina
> > escribió:
> > > El mar, 21-07-2015 a las 14:14 +0200, Carlos Jacobo Puga Medina
> > > escribió:
> > > > El mar, 21-07-2015 a las 08:34 +0100, Edmund Grimley Evans 
> > > > escribió:
> > > > > > ../tcc -B.. -c bcheck.c -o x86_64/bcheck.o -I..  -Wall -g 
> > > > > > -O0
> > > > > > -Wdeclaration-after-statement -Wno-deprecated-declarations 
> > > > > > -Wno
> > > > > > -strict
> > > > > > -aliasing -Wno-pointer-sign -Wno-sign-compare -Wno-unused
> > > > > > -result 
> > > > > > -Wno
> > > > > > -uninitialized -fno-strict-aliasing -fPIC 
> > > > > > -DTCC_TARGET_X86_64
> > > > > > In file included from bcheck.c:21:
> > > > > > /usr/include/stdio.h:63: error: ';' expected (got 
> > > > > > "va_list")
> > > > > > Makefile:116: recipe for target 'x86_64/bcheck.o' failed
> > > > > > gmake[1]: *** [x86_64/bcheck.o] Error 1
> > > > > > gmake[1]: Leaving directory 
> > > > > > '/usr/home/cjpm/github/tinycc/lib'
> > > > > > Makefile:259: recipe for target 'libtcc1.a' failed
> > > > > > gmake: *** [libtcc1.a] Error 2
> > > > > > 
> > > > > > Any thoughts about how to handle this?
> > > > > 
> > > > > Take a look at the preprocessed source, bcheck.i, generated 
> > > > > by:
> > > > > 
> > > > > ../tcc -B.. -E bcheck.c -I..  -Wall -g -O0
> > > > > -Wdeclaration-after-statement -Wno-deprecated-declarations
> > > > > -Wno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare
> > > > > -Wno-unused-result -Wno-uninitialized -fno-strict-aliasing 
> > > > > -fPIC
> > > > > -DTCC_TARGET_X86_64 -o bcheck.i
> > > > 
> > > > Yes, I checked it.
> > > > 
> > > > It builds fine on i386, but I'm not sure why it spits out this 
> > > > error 
> > > > on
> > > > amd64:
> > > > 
> > > > In file included from bcheck.c:22:
> > > > In file included from /usr/include/stdarg.h:6:
> > > > /usr/include/x86/stdarg.h:74: error: #error this file needs to 
> > > > be
> > > > ported to your compiler
> > > > 
> > > I tried on FreeBSD/i386 and it also fails to compile properly 
> > > with 
> > > the
> > > above error.
> > > 
> > > Note that last time that TCC worked like a charm was on FreeBSD
> > > -9.1/i386 release.
> > > 
> > Finally I compiled TCC on amd64
> > 
> > tcc version 0.9.26 (x86-64)
> > install: /usr/local/lib/tcc/
> > crt:
> >   /usr/lib
> > libraries:
> >   /usr/lib
> >   /lib
> >   /usr/local/lib
> > include:
> >   /usr/local/include
> >   /usr/include
> >   /usr/local/lib/tcc/include
> > elfinterp:
> >   /libexec/ld-elf.so.1
> > 
> > Trying to compile hello.c
> > % tcc -o hello hello.c
> > In file included from hello.c:1:
> > /usr/include/stdio.h:63: error: ';' expected (got "va_list")
> > 
> 
> hello.c
> =======
> extern int printf(char *, ...);
> int main(){
>       printf("hello, world!\n);
>       return 0;
> }
> =======
> 
> % tcc -run hello.c
> hello, world!
> 
> It seems that stdio.h is the culprit.

After a week, we are able to compile with TCC but it fails to link.
Patch is attached to this msg.

Here it is the proof:

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

int main(){
        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!

So we guess that linking is broken.
-- 
Carlos Jacobo Puga Medina <[email protected]>
PGP fingerprint = C60E 9497 5302 793B CC2D  BB89 A1F3 5D66 E6D0 5453
Index: lang/tcc/files/patch-configure
===================================================================
--- lang/tcc/files/patch-configure	(revision 0)
+++ lang/tcc/files/patch-configure	(working copy)
@@ -0,0 +1,30 @@
+--- configure.orig	2013-02-15 14:24:00 UTC
++++ configure
+@@ -45,6 +45,7 @@ tcc_crtprefix=""
+ tcc_elfinterp=""
+ tcc_lddir=
+ confvars=
++define_va_list=""
+ 
+ cpu=`uname -m`
+ 
+@@ -332,6 +333,9 @@ if test -z "$cross_prefix" ; then
+ 
+     fi
+   fi
++  if ! $cc -o $CONFTEST -c $source_path/va_list.c 2>/dev/null ; then
++    define_va_list="yes"
++  fi
+ else
+   # if cross compiling, cannot launch a program, so make a static guess
+   case $cpu in
+@@ -483,6 +487,9 @@ if test "$have_selinux" = "yes" ; then
+   echo "#define HAVE_SELINUX" >> $TMPH
+   echo "HAVE_SELINUX=yes" >> config.mak
+ fi
++if test "$define_va_list" = "yes" ; then
++  echo "#define DEFINE_VA_LIST" >> $TMPH
++fi
+ 
+ version=`head $source_path/VERSION`
+ echo "VERSION=$version" >>config.mak

Property changes on: lang/tcc/files/patch-configure
___________________________________________________________________
Added: fbsd:nokeywords
## -0,0 +1 ##
+yes
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: lang/tcc/files/patch-libtcc.c
===================================================================
--- lang/tcc/files/patch-libtcc.c	(revision 0)
+++ lang/tcc/files/patch-libtcc.c	(working copy)
@@ -0,0 +1,28 @@
+--- libtcc.c.orig	2013-02-15 14:24:00 UTC
++++ libtcc.c
+@@ -931,7 +931,11 @@ LIBTCCAPI TCCState *tcc_new(void)
+     tcc_define_symbol(s, "__i386", NULL);
+     tcc_define_symbol(s, "i386", NULL);
+ #elif defined(TCC_TARGET_X86_64)
++# if defined(__FreeBSD__)
++    tcc_define_symbol(s, "__amd64__", NULL);
++# endif
+     tcc_define_symbol(s, "__x86_64__", NULL);
++    tcc_define_symbol(s, "__LP64__", NULL);
+ #elif defined(TCC_TARGET_ARM)
+     tcc_define_symbol(s, "__ARM_ARCH_4__", NULL);
+     tcc_define_symbol(s, "__arm_elf__", NULL);
+@@ -957,6 +961,13 @@ LIBTCCAPI TCCState *tcc_new(void)
+     tcc_define_symbol(s, "__linux", NULL);
+ # endif
+ # if defined(__FreeBSD__)
++#  if defined(DEFINE_VA_LIST)
++#   if defined(TCC_TARGET_X86_64)
++    tcc_define_symbol(s, "__va_list", "struct { long pad[3]; }");
++#   else
++    tcc_define_symbol(s, "__va_list", "char *");
++#   endif
++#  endif
+ #  define str(s) #s
+     tcc_define_symbol(s, "__FreeBSD__", str( __FreeBSD__));
+ #  undef str

Property changes on: lang/tcc/files/patch-libtcc.c
___________________________________________________________________
Added: fbsd:nokeywords
## -0,0 +1 ##
+yes
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: lang/tcc/files/patch-va__list.c
===================================================================
--- lang/tcc/files/patch-va__list.c	(revision 0)
+++ lang/tcc/files/patch-va__list.c	(working copy)
@@ -0,0 +1,9 @@
+--- va_list.c.orig	2015-08-04 21:20:18 UTC
++++ va_list.c
+@@ -0,0 +1,6 @@
++#ifdef __FreeBSD__
++#undef __GNUC__
++#undef __GNUC_MINOR__
++#include <sys/types.h>
++void foo(__va_list);
++#endif

Property changes on: lang/tcc/files/patch-va__list.c
___________________________________________________________________
Added: fbsd:nokeywords
## -0,0 +1 ##
+yes
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property

Attachment: signature.asc
Description: This is a digitally signed message part

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

Reply via email to