tinycc-devel
[Top][All Lists]
Advanced

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

[Tinycc-devel] Re: Tinycc-devel Digest, Vol 19, Issue 4


From: BUDI ARIEF GUSANDI
Subject: [Tinycc-devel] Re: Tinycc-devel Digest, Vol 19, Issue 4
Date: Fri, 15 Oct 2004 10:01:19 +0700 (SE Asia Standard Time)

Will it run from pure DOS Shell without windows?
 
-------Original Message-------
 
From: address@hidden
Date: Thursday, October 14, 2004 22:56:07
To: address@hidden
Subject: Tinycc-devel Digest, Vol 19, Issue 4
 
Send Tinycc-devel mailing list submissions to
address@hidden
 
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.nongnu.org/mailman/listinfo/tinycc-devel
or, via email, send a message with subject or body 'help' to
address@hidden
 
You can reach the person managing the list at
address@hidden
 
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Tinycc-devel digest..."
 
 
Today's Topics:
 
1. RE: win32 port (TK)
2. Re: win32 port (Philippe Ribet)
3. Re: win32 port (Fabrice Bellard)
 
 
----------------------------------------------------------------------
 
Message: 1
Date: Wed, 13 Oct 2004 23:53:34 -0700
From: "TK" <address@hidden>
Subject: RE: [Tinycc-devel] win32 port
To: <address@hidden>
Message-ID: <address@hidden>
Content-Type: text/plain; charset="us-ascii"
 
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
 
 
 
 
 
------------------------------
 
Message: 2
Date: Thu, 14 Oct 2004 11:24:24 +0200
From: Philippe Ribet <address@hidden>
Subject: Re: [Tinycc-devel] win32 port
To: address@hidden
Message-ID: <address@hidden>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 
TK wrote:
 
 
< unsigned long long n, n1;
---
> uint64_t n, n1;
 
 
It's ok. BTW, Fabrice, if you're intrested, I can offer you macro which
defines intxx_t types for compilers who don't defines it.
 
< if ((n & 0xffffffff00000000LL) != 0) {
---
> if ((n & ((int64_t)0xffffffff00000000)) != 0) {
 
This code is wrong. You try to cast into int64_t in order to get some 64
bits value, this means you consider you have a 32 bits one. If the constant
is 32 bits, this means you lost half the bits and the cast won't recover
them.
 
The good definition is: if ((n & INT64_C(0xffffffff00000000)) != 0) {
 
The definitions I proposed defines INTxx_C too for old compilers which
use their own syntax.
 
Best regards,
 
--
Philippe Ribet
 
 
 
The README file said
"Requires Windows 95, NT 4.0, or better."
So... I installed it on Linux!
 
 
 
 
 
------------------------------
 
Message: 3
Date: Thu, 14 Oct 2004 12:07:07 +0200
From: Fabrice Bellard <address@hidden>
Subject: Re: [Tinycc-devel] win32 port
To: address@hidden
Message-ID: <address@hidden>
Content-Type: text/plain; charset=us-ascii; format=flowed
 
Hi,
 
Unless more people want MS VC++ support, I am relunctant to merge VC++
specific patches as I cannot test them. Why do you use _open() instead
of open() ? Would the O_BINARY flag improve things ?
 
Now that there is an example to output another format than ELF, maybe
someone will add PECOFF support !
 
Fabrice.
 
PS: Try to send 'diff -u' patches, they are easier to read...
 
TK wrote:
> 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
 
 
 
 
------------------------------
 
_______________________________________________
Tinycc-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/tinycc-devel
 
 
End of Tinycc-devel Digest, Vol 19, Issue 4
*******************************************
 
__________ NOD32 1.894 (20041014) Information __________
 
This message was checked by NOD32 antivirus system.
http://www.nod32.com
 
 
.




reply via email to

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