What I do notice is that using i386-win32-tcc.exe (compiled with gcc or tcc) I
get identical output to before my commit.
With tcc.exe (compiled with gcc or tcc, which in turns was built with
build-tcc.bat -x), I get the situation that ecx is stored in the stack and then
moved into eax. Very strange.
So the x86_64 build is affected. Before I start digging into the code
(misplaced #ifdef somewhere?) I want to verify the byte code with you to make
sure we are talking about the same issue.
Can you post yours (objdump -D) ?
Compiled with version on branch mob after my commit:
00401000 <.text>:
401000: 55 push %ebp
401001: 89 e5 mov %esp,%ebp
401003: 81 ec 04 00 00 00 sub $0x4,%esp
401009: 90 nop
40100a: 89 4d fc mov %ecx,-0x4(%ebp)
40100d: 8b 45 fc mov -0x4(%ebp),%eax
401010: 50 push %eax
401011: b8 00 20 40 00 mov $0x402000,%eax
401016: 50 push %eax
401017: e8 54 02 00 00 call 0x401270
40101c: 83 c4 08 add $0x8,%esp
40101f: b8 0b 20 40 00 mov $0x40200b,%eax
401024: 50 push %eax
401025: e8 4e 02 00 00 call 0x401278
40102a: 83 c4 04 add $0x4,%esp
40102d: b8 00 00 00 00 mov $0x0,%eax
401032: c9 leave
401033: c3 ret
Compiled with version on branch mob before my commit:
00401000 <.text>:
401000: 55 push %ebp
401001: 89 e5 mov %esp,%ebp
401003: 81 ec 00 00 00 00 sub $0x0,%esp
401009: 90 nop
40100a: 8b 45 08 mov 0x8(%ebp),%eax
40100d: 50 push %eax
40100e: b8 00 20 40 00 mov $0x402000,%eax
401013: 50 push %eax
401014: e8 57 02 00 00 call 0x401270
401019: 83 c4 08 add $0x8,%esp
40101c: b8 0b 20 40 00 mov $0x40200b,%eax
401021: 50 push %eax
401022: e8 51 02 00 00 call 0x401278
401027: 83 c4 04 add $0x4,%esp
40102a: b8 00 00 00 00 mov $0x0,%eax
40102f: c9 leave
401030: c3 ret
On Thu, Jun 6, 2024 at 5:30 PM HarukaMomono via Tinycc-devel <tinycc-devel@nongnu.org
<mailto:tinycc-devel@nongnu.org>> wrote:
commit:3b943bec5de423e234b5f92d9a8f110ad66a85a1
author:Gynt <Gynt@users.noreply.github.com
<mailto:Gynt@users.noreply.github.com>>
Mon, 3 Jun 2024 19:52:34 +0800 (3 13:52 +0200)
committer:Gynt <Gynt@users.noreply.github.com
<mailto:Gynt@users.noreply.github.com>>
Mon, 3 Jun 2024 19:56:32 +0800 (3 13:56 +0200)
tree:3c7fd4f944e9417b6bf2c95c21c9e8c9ee671b11
parent:8cd21e91ccee3baf15ad2f8cba9cbc4b618695a0
envs: windows 10; gcc version 14.1.0 (MinGW-W64 x86_64-ucrt-posix-seh,
built by Brecht Sanders, r1)
In this branch, I built it using gcc, the build command: build-tcc.bat -x
C file:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, const char **argv, const char **envp) {
printf("argc = %d\n", argc);
system("pause");
return 0;
}
Compile Commands:
tcc.exe -std=c11 -m32 -o test.exe test.c
result:
argc = 9908136
Decompile using IDA:
int __thiscall sub_401000(void *this)
{
printf("arg num = %d\n", this);
system("pause");
return 0;
}
There are missing parameters.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
百野悠
antisnow@qq.com
<https://wx.mail.qq.com/home/index?t=readmail_businesscard_midpage&nocheck=true&name=%E7%99%BE%E9%87%8E%E6%82%A0&icon=https%3A%2F%2Fthirdqq.qlogo.cn%2Fg%3Fb%3Dsdk%26k%3DOZI1461f3WfMVgfs9eVX5g%26s%3D100%26t%3D1556966029%3Frand%3D1647596762&mail=antisnow%40qq.com&code=>
_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org <mailto:Tinycc-devel@nongnu.org>
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel