[Top][All Lists]

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

Re: [Tinycc-devel] .fill .rept broken by "Clean up 64bit immediate suppo

From: Michael Matz
Subject: Re: [Tinycc-devel] .fill .rept broken by "Clean up 64bit immediate support"
Date: Sun, 15 May 2016 01:17:57 +0200 (CEST)
User-agent: Alpine 2.20 (LSU 67 2015-01-07)


[request for testing a patch below]

On Sat, 14 May 2016, Sergey Korshunoff wrote:

It might also simply be that your libc headers are incompatible with a 64bit 
compilation (e.g. if
you miss any WORDSIZE support from <bits/wordsize.h>). In that case we might 
have to do
more hackery, but generally it won't be possible on such a system to build much 
software cross > (to 64bit) at all.

My glibc on host is quite old (2.9) Is the new glibc on i386 allow to
compile 64 bit code? How about muslim or uclibc headers? I think we
must use a tcc headers for lib/* compilation

PS: on my host /usr/include/bits/wordsize.h is
#define __WORDSIZE      32

I see. Well, you will have multiple problems with that and building 64bit software, because your system headers aren't 64bit capabable. OTOH for building something cross the correct target heades are a preliminarity anyway, so you need some from somewhere else, for instance musl libc.

The idea of using only tcc headers for lib/* compilation might sound good at first, but tcc doesn't provide all standard headers (and shouldn't because it's not a full toolchain with C library); it really relies on the existence of working/compatible target headers that also the lib/* implementation can use.

OTOH, for the particular problem you got there might be two solutions inside tcc itself. You got incompatible definitions of 'intptr_t' and 'ssize_t', those come from TCCs stddef.h. Now, a ISO c99 stddef.h shouldn't even define those two types, OTOH invalid sources might expect it to.

Second, at least glibc defines intptr_t and ssize_t on 32bit platforms in terms of 'int', not in terms of 'long', but TCC uses the latter, and from that the incompatible definitions result.

So, I offer two patches for you to try. The first (removing the typedefs from stddef.h) is more correct, and the second might be more compatible with current behaviour.

If somebody could please test the _first_ patch on other systems than linux/x86_64 (in particular on windows) on compilation of some random software, I would be grateful. It's the more correct thing to do and I'd like to apply it.


Attachment: tcc-stddef.h
Description: Text Data

Attachment: tcc-32bit-ptrdiff.diff
Description: Text Data

reply via email to

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