tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Tinycc-devel] win32 port


From: TK
Subject: RE: [Tinycc-devel] win32 port
Date: Wed, 13 Oct 2004 23:53:34 -0700

Fabrice,

Good news!  The C67 port seems to compile, run, and generate correct C67
code.

Below is a diff of the directory I was testing in.

The changes to tcccoff.c I belive are all straighforward bugs and should be
incorporated.

The rest are make/header/compiler issues which you may have a better way to
address.  There are a couple of linux headers that don't seem to be required
by tcc but give problems for MinGW (or MS VC++).  Similarly there are
references to "long long".  Also a few minor compiler issues.

I couldn't find a good way to debug the MinGW generated exe.  Is there one?
The only thing I could find is a command line gdb.  So I resorted back to MS
VC++ to compile and debug.  It seemed too easy.  I just made an empty
project, inserted tcc.c and it compiled an ran!



Here is the process I went through on my Windows Machine (possibly useful to
someone as ignorant of Linux as me):

1 - Install Cygwin (including development tools)
2 - Install MinGW
3 - from Cygwin prompt checkout tcc with:
        cvs -z3 -d:ext:address@hidden:/cvsroot/tinycc co tinycc
4 - I resorted to editing the configure script to force mingw32="yes"
5 - from Cygwin prompt: configure
6 - from windows cmd prompt: cd to where CVS put the files (cd
C:\cygwin\home\TK\tinycc)
6 - from windows cmd prompt: put Mingw\bin in your path=$path$;c:\mingw\bin
7 - from windows cmd prompt: mingw32-make.exe C67-tcc.exe
8 - from windows cmd prompt: C67-tcc.exe -g -nostdlib test.c -o test.out


Let me know your thoughts.

Thanks

TK


Index: configure
===================================================================
RCS file: /cvsroot/tinycc/tinycc/configure,v
retrieving revision 1.4
diff -r1.4 configure
64,66c64,66
< targetos=`uname -s`
< case $targetos in
< MINGW32*)
---
> #targetos=`uname -s`
> #case $targetos in
> #MINGW32*)
68,70c68,70
< ;;
< *) ;;
< esac
---
> #;;
> #*) ;;
> #esac
Index: elf.h
===================================================================
RCS file: /cvsroot/tinycc/tinycc/elf.h,v
retrieving revision 1.2
diff -r1.2 elf.h
32c32,33
< typedef long long int int64_t;
---
> //tktk typedef long long int int64_t;
> typedef __int64 int64_t;
38c39,40
< typedef unsigned long long int        uint64_t;
---
> //tktk typedef unsigned long long int uint64_t;
> typedef unsigned __int64      uint64_t;
Index: i386-asm.c
===================================================================
RCS file: /cvsroot/tinycc/tinycc/i386-asm.c,v
retrieving revision 1.4
diff -r1.4 i386-asm.c
111,115c111,116
< static const uint8_t reg_to_size[5] = {
<     [OP_REG8] = 0,
<     [OP_REG16] = 1,
<     [OP_REG32] = 2,
< };
---
> //static const uint8_t reg_to_size[5] = {
> //    [OP_REG8] = 0,
> //    [OP_REG16] = 1,
> //    [OP_REG32] = 2,
> //};
> static const uint8_t reg_to_size[5] = {0,0,1,0,2};
Index: tcc.c
===================================================================
RCS file: /cvsroot/tinycc/tinycc/tcc.c,v
retrieving revision 1.156
diff -r1.156 tcc.c
29,31c29,33
< #include <unistd.h>
< #include <signal.h>
< #include <unistd.h>
---
> //#include <unistd.h>
> //#include <signal.h>
> //#include <unistd.h>
> #include <direct.h>
>
35c37,38
< #ifdef WIN32
---
> #ifdef WIN32
> #include <io.h>
93c96,97
< typedef int BOOL;
---
> typedef int BOOL;
> #define inline
143,144c147,148
<     long long ll;
<     unsigned long long ull;
---
>     int64_t ll;
>     uint64_t ull;
1690c1694
<     fd = open(filename, O_RDONLY);
---
>     fd = _open(filename, O_RDONLY);
3181c3185
<         unsigned long long n, n1;
---
>         uint64_t n, n1;
3215c3219
<         if ((n & 0xffffffff00000000LL) != 0) {
---
>         if ((n & ((int64_t)0xffffffff00000000)) != 0) {
4529c4533
<     unsigned long long ll;
---
>     uint64_t ll;
8011c8015
<     unsigned long long bit_mask;
---
>     uint64_t bit_mask;
8046c8050
<             bit_mask = -1LL;
---
>             bit_mask = (int64_t)(-1);
8050c8054
<             bit_mask = (1LL << bit_size) - 1;
---
>             bit_mask = (((int64_t)1) << bit_size) - 1;
8074c8078
<             *(long long *)ptr |= (vtop->c.ll & bit_mask) << bit_pos;
---
>             *(int64_t *)ptr |= (vtop->c.ll & bit_mask) << bit_pos;
9829c9833
<     return (tb.time * 1000LL + tb.millitm) * 1000LL;
---
>     return (tb.time * ((int64_t)1000) + tb.millitm) * ((int64_t)1000);
Index: tcccoff.c
===================================================================
RCS file: /cvsroot/tinycc/tinycc/tcccoff.c,v
retrieving revision 1.1
diff -r1.1 tcccoff.c
20c20,21
<  */
---
>  */
>
77a79
>     int i, NSectionsToOutput;
118c120
<     int i, NSectionsToOutput = 0;
---
>     NSectionsToOutput = 0;
240c242
<                            LineNoFilePtr[nFuncs]) / LINESZ;
---
>                            LineNoFilePtr[nFuncs]) / LINESZ - 1;
855c857
<     if (s == ".text")
---
>     if (strcmp(s,".text")==0)
857c859
<     else if (s == ".data")
---
>     else if (strcmp(s,".data")==0)
865c867
<     if (s == ".text")
---
>     if (strcmp(s,".text")==0)
867c869
<     else if (s == ".data")
---
>     else if (strcmp(s,".data")==0)
869c871
<     else if (s == ".bss")
---
>     else if (strcmp(s,".bss")==0)
871c873
<     else if (s == ".stack")
---
>     else if (strcmp(s,".stack")==0)
873c875
<     else if (s == ".cinit")
---
>     else if (strcmp(s,".cinit")==0)
Index: tccelf.c
===================================================================
RCS file: /cvsroot/tinycc/tinycc/tccelf.c,v
retrieving revision 1.22
diff -r1.22 tccelf.c
2152c2152,2153
<     int c;
---
>     int c;
>       char c_a_z;
2155,2156c2156,2162
<  redo:
<     switch(ch) {
---
>  redo:
>
>
>       if ((ch>='a' && ch<='z')||(ch>='A' && ch<='Z')) c_a_z='a';
>       else c_a_z = ch;
>
>     switch(c_a_z) {
2177,2178c2183,2184
<     case 'a' ... 'z':
<     case 'A' ... 'Z':
---
>     case 'a':
>     case 'A':

-----Original Message-----
From: address@hidden
[mailto:address@hidden Behalf Of
Fabrice Bellard
Sent: Thursday, October 07, 2004 2:15 PM
To: address@hidden
Subject: [Tinycc-devel] win32 port


I commited an initial support for win32 in the configure script and in
the Makefile. You must use the mingw32 tools to compile TCC. Feel free
to send any improvement.

Fabrice.



_______________________________________________
Tinycc-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/tinycc-devel





reply via email to

[Prev in Thread] Current Thread [Next in Thread]