[Top][All Lists]

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

Re: [Tinycc-devel] TCC very interesting error

From: grischka
Subject: Re: [Tinycc-devel] TCC very interesting error
Date: Tue, 27 Oct 2009 19:57:11 +0100

Adding this one more variable causes the local stack grow over 4096.  This
requires the usage of __chkstk on windows (because there, unlike on linux,
each new stack page needs to be touched explicitely to make sure it gets
physically mapped)

However there seems a problem with latest TCC having problems to assemble
its own __chkstk function.  In particular there are some 66 prefixes that should
not be there.  See below.

Mr. Frederic Feret, would you look into it ?

--- grischka

004010A0     66:872C24         xchg [esp],bp
004010A4     55                push ebp
004010A5     66:8D6C24 04      lea bp,[esp+4]
004010AA     51                push ecx
004010AB     89E9              mov ecx,ebp
004010AD     66:81E9 0010      sub cx,1000
004010B2     66:8501           test [ecx],ax
004010B5     66:2D 0010        sub ax,1000
004010B9     66:3D 0010        cmp ax,1000
004010BD   - 66:7D ED          jge short 000010AD
004010C0     29C1              sub ecx,eax
004010C2     66:8501           test [ecx],ax
004010C5     89E0              mov eax,esp
004010C7     89CC              mov esp,ecx
004010C9     66:8B08           mov cx,[eax]
004010CC     66:FF60 04        jmp near [eax+4]

----- Original Message ----- From: Rutenis Turcinas
To: address@hidden
Sent: Tuesday, October 27, 2009 6:26 PM
Subject: [Tinycc-devel] TCC very interesting error

Hello. Im working on MS windows 7, I have latest tinycc version.

I'm trying to compile simple program, it runs OK. But, when it has a lot of 
variables it fails.
This is the function, that I tried to compile: http://www.turcinas.lt/testas.c
TCC compiles it and I receive any errors. It can run, everything is OK. But if I change last line from: "int _3308,_369;" to: "int _3308,_369,variable;" (just add one more variable) and it doesn't run (prints error). This is console code:
C:\tcc>tcc -c testas.c
C:\tcc>tcc -run testas.o
tcc: undefined symbol '__chkstk'

This one additional variable trick maby wont arise on your machines, because of different platforms, memories and so, but the thing is, that I have faced very strange situation.

I found on google, that such error arises when code tries to combine MSVC libs with gcc/mingw libs. But in my case there is only one simple function with many int type variables... No libs, just simple function. I don't know whats wrong, help me.

Tinycc-devel mailing list

reply via email to

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