tinycc-devel
[Top][All Lists]
Advanced

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

RE: [Tinycc-devel] libtcc not working properly on x86-64 targets


From: grischka
Subject: RE: [Tinycc-devel] libtcc not working properly on x86-64 targets
Date: Tue, 22 Dec 2009 16:21:12 +0100
User-agent: Thunderbird 2.0.0.23 (Windows/20090812)

Michael Kuklinski wrote:
> There appears to be a problem in how it configures the jump table in
> add_jump_tableâ after fixing the unsigned long to a uplong, that
> appears to be where the truncation occurs. However, there is no
> native jmp operation for 64-bit addresses which is problematicâ
> everything is supposed to be handled as 32-bit offsets.

I just wonder how did you get into add_jump_table?  It's defined
only for non-PE targets and on those an unsigned long _IS_ 64 bit,
so you wont have problems with truncation.

> There appear
> to be a variety of problems there and in the functions leading up to
> it where things are passed as 32-bit variables instead of 64-bit,
> which causes truncation before then.

FYI, your example works just fine for me without modification to tcc
on both Windows 7 (64) and Ubuntu (amd64).  Also it is not much
different to the libtcc_test example so the scenario is at least not
completely untested.

Still I don't say there aren't bugs and probably you are right that
value in put_elf_sym and also val/addr in relocate_section should be
uplong.

In any case if you are on windows, make sure to compile libtcc with
PE support.  Otherwise the generated code would use incompatible
calling convention to functions added using tcc_add_symbol.

--- grischka




reply via email to

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