Zhang,
Thank you for commits.
I don't really know if they make tcc better or not but I sure that:
- Windows 32/64 has no regression
- RPi has no regression
- Your commit messages and patch are clear very easy to understand.
To me (again I'm not a maintainer) they seem to be good contributions. To be
perfect, they lack of new tests that show why tcc was wrong before your commits
and why now it is doing right.
With those new tests, we can better tell you if your fixes work on all
supported platforms. Feel free to add them. No one will protest to see new
tests on a tcc.
Christian
-----Original Message-----
From: Tinycc-devel [mailto:address@hidden On Behalf Of ???
Sent: samedi 9 septembre 2017 14:56
To: address@hidden
Subject: Re: [Tinycc-devel] BUG: code generation problem in
i386-gen.c:gcall_or_jmp()
OK, I will push my modifications to the mob branch.
在 2017年09月09日 18:26, Christian Jullien 写道:
Hello Zhang
First I'm not an official maintainer of tcc but a regular user and observer of
its evolutions. I also check that it does not regress on the platforms I use.
That said, your recent proposals seem strongly argumented with associated
tests. Since no one commented your proposal (that sad!).
I suggest you to push them in mod so that we can see if we have regression or
not with them. Please make one commit at a time for a given fix so that we can
better insulate regression (if any).
I any cases, many thanks to participate to this project and to try to make it
better.
Christian
-----Original Message-----
From: Tinycc-devel [mailto:address@hidden On Behalf Of ???
Sent: samedi 9 septembre 2017 05:03
To: address@hidden
Subject: [Tinycc-devel] BUG: code generation problem in
i386-gen.c:gcall_or_jmp()
Hello,
I found 3 problems in i386-gen.c:gcall_or_jmp().
(1) There is a fix for extending return value to whole register, however, this
fix is in the constant case only, if a call is indirect, this fix will not be
applied and the result will be wrong.
(2) The fix is for 'call' and if 'is_jmp' == 1, it will generate redundant code.
(3) Calling constant should use the indirect way. For example, if someone write "((void
(*)(void)) 0x12345678)()" in a DLL, the generated code will be "CALL 0x12345678".
However, because the imm in CALL instruction is PC related, when the DLL is relocated, the call
target will be wrong.
I provided a patch and two testcase.
'test-movzx-movsx.c' is for problem (1) and (2).
run it with:
tcc -run test-movzx-movsx.c
expected output is:
0000ABCE 0000ABCE
FFFFABCE FFFFABCE
000000CE 000000CE
FFFFFFCE FFFFFFCE
0000ABCE 0000ABCE
FFFFABCE FFFFABCE
000000CE 000000CE
FFFFFFCE FFFFFFCE
the other two files are for problem (3).
run it with:
# set DLL base at 0x400000 to force a relocation tcc -shared
-Wl,-Ttext=0x00400000 test-call-constant-dll.c
tcc -L. -ltest-call-constant-dll -run test-call-constant-run.c
expected output is:
by pointer variable: FEEDBEEF
by pointer constant: FEEDBEEF
Thanks
Zhang Boyang
_______________________________________________
Tinycc-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/tinycc-devel