tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] tcc as compiler for tccboot


From: David Mertens
Subject: Re: [Tinycc-devel] tcc as compiler for tccboot
Date: Thu, 21 Apr 2016 08:46:05 -0400

Hello Sergey,

On Thu, Apr 21, 2016 at 12:44 AM, Sergey Korshunoff <address@hidden> wrote:
> That's a good bit of sleuthing. A couple of questions immediately come to mind:
>    Why does gcc and pcc take 4 as their alignment? Why do we take 32?
I'm not a guru. But tcc behaviour cost me a day of the problem discovering

I hate it when I lose a full day to stuff like this.
 
>    Does this have any performance impact?
I don't think so. This alignment is for unusual sections, not for
.text .data and so.

>    Is there a reason you are implementing this with #ifdef?
I don't know about gcc defaults on different ARCH

> Might we use a preprocessor value (i.e. TCC_DEFAULT_ALIGNMENT) and #define that in architecture-specific header files instead?
May be. But problem exposed only on i386.

Taking all three of these together, I wonder if there is a reason tcc defaulted to 32 in the first place. That is, why not just switch to 4 for all architectures? Perhaps you could do that, push a topic branch, and ask folks to pull it and run their own tests on it. (It looks like you haven't pushed any topic branches yet to http://repo.or.cz/tinycc.git/refs)

Something that might help the conversation along: Do you know where, in the source code for gcc, the alignments are set? This might let us examine how they handle it across architectures. It might even be possible to run "git blame" on said lines in gcc's source, to see if we can learn anything from the commit history.

In any event, it is odd to me that any software compiled entirely from source should care about this sort of alignment. It should leave such issues up to the compiler, as an implementation detail, shouldn't it?

PS: another problem: 0x1234-123 parsed by tcc as float number by
default and there is no switch to dsiable this. And gcc-3.4.6 (4.1.2)
understand the above as _expression_ 0x1234 - 123 by default.

No no no! This is unrelated! Start a different thread, or the conversation will get all confused!

David

--
 "Debugging is twice as hard as writing the code in the first place.
  Therefore, if you write the code as cleverly as possible, you are,
  by definition, not smart enough to debug it." -- Brian Kernighan

reply via email to

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