[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Strange issue with 64bit section offsets
From: |
grischka |
Subject: |
Re: [Tinycc-devel] Strange issue with 64bit section offsets |
Date: |
Sat, 25 Feb 2012 15:18:35 +0100 |
User-agent: |
Thunderbird 2.0.0.24 (Windows/20100228) |
Andrew Mulbrook wrote:
Greetings,
I'm using tcc to develop a "toy" operating system kernel. In adding
64bit support, I discovered what appears to be a bug in tcc.
Several fields in "tcc.h" structures are defined as "unsigned long". In
a MingW32 environmebr, these appear to break when generating a text
section with a high load offset. I'm using
"-Wl,-Ttext=0xffffff8000000000". Also, the link_option parsing inside
libtcc.c uses "strtol" as opposed to "strtoll". On 64 bit linux, the
binary image works as expected. On 64bit windows, the long only holds a
32bit offset and things go 'splody.
Current approach in TCC is using 'uplong' for absolute addresses,
which is for win64
#ifdef _WIN64
# define uplong unsigned long long
#endif
and otherwise
#ifndef uplong
#define uplong unsigned long
#endif
(We might use uintptr_t eventually)
For relative addresses (offsets) 32 bits are generally sufficient
even on 64 bit platforms.
This appears on first glance to be fixable via changing the "long"
references in the structure to long long /int64 types. However, before
I start venturing into the maze of writing a bugfix, I was curious if
anyone was looking at / developing the 64bit portions of tcc, or if
submitted patches would even be seen by someone. Was this a known issue
with larger implications? I also noticed objdump is currently choking on
the resulting binary as well (linux 64bit testing).
I'd assume that 64 bit works except where it doesn't.
I noticed the tinycc website says this compiler isn't being actively
maintained, but there is a steady (extremely light) stream of commits.
Has someone taken over this project? tcc has the nice benefit for me of
running on windows & linux without huge headaches in bringing up a
proper cross toolchain.
You're welcome to push patches on out 'mob' branch. See instructions:
http://repo.or.cz/w/tinycc.git
- Assume that your patch will go into next release without further checking.
- "Smaller patches are better patches."
- "Fix your problem at hand, try not to cause other problems."
- (... more stuff you already know).
Next release (0.9.26) is overdue but not urgent.
Thanks,
--- grischka
Best Regards,
Andrew