From mint-bounce@lists.fishpool.fi  Tue Jan 22 17:29:05 2008
X-Original-To: fnaumann@mail.boerde.de
Delivered-To: fnaumann@mail.boerde.de
From: "Roger Burrows" <anodyne@cyberus.ca>
Organization: Anodyne Software
To: mint@fishpool.com
Date: Sat, 24 Nov 2007 17:05:34 -0500
MIME-Version: 1.0
Subject: Re: [MiNT] GCC 4.2.2 and binary compatibility
Message-ID: <474859DE.29216.569B12@localhost>
Priority: normal
In-reply-to: <4747F03E.4050101@freesbee.fr>
X-mailer: Pegasus Mail for Windows (v4.02a)
Content-type: text/plain; charset=ISO-8859-1
Content-description: Mail message body
X-Authenticated: anodyne@magma.ca - (MYCROFT) [142.46.8.6]
X-ecartis-version: Ecartis v1.0.0
Sender: mint-bounce@lists.fishpool.fi
Errors-To: mint-bounce@lists.fishpool.fi
X-original-sender: anodyne@cyberus.ca
Precedence: bulk
List-help: <mailto:ecartis@lists.fishpool.fi?Subject=help>
List-unsubscribe: <mailto:mint-request@lists.fishpool.fi?Subject=unsubscribe>
List-Id: <mint.lists.fishpool.fi>
X-List-ID: <mint.lists.fishpool.fi>
List-subscribe: <mailto:mint-request@lists.fishpool.fi?Subject=subscribe>
List-owner: <mailto:tjhukkan@fishpool.fi>
List-post: <mailto:mint@lists.fishpool.fi>
X-Virus-Scanned: by amavisd-new at relay.boerde.de
X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on relay.boerde.de
X-Spam-Status: No, hits=3.0 tagged_above=-50.5 required=7.0 tests=AWL,
 BAYES_00, RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_SORBS
X-Spam-Level: ***
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from Quoted-printable to 8bit by freemint id m0MGP1ap004618
Status: 
X-Status: 
X-Keywords:                   

Hi Vincent,
On 24 Nov 2007 at 10:34, Vincent Rivière wrote:
> 
> The first problem was about functions returning pointers. Traditional
> compilers used to return them into d0. GCC for Linux/m68k returns them
> into a0. My current binaries behaves like Linux, but it breaks the
> compatibility with older Atari functions written in assembly language.
> Thus in my next build, I'll disable that a0/d0 stuff and use d0 in all 
> cases, just like older compilers.
> 
> The second question is about alignment.
> 
> Vincent Rivière wrote:
> > I would like to speak about another "feature" : alignment.
> > 
> > By default, GCC aligns structure members on 4-byte boundaries, 
> > producing useless 2-byte holes in a structure where longs and shorts 
> > are mixed. I patched it long ago to use a 2-byte default alignment, 
> > so no space is wasted. Some people said that the 68020+ CPU have 
> > faster memory access to longs aligned on 32-bit boundaries. Is it 
> > true on Atari computers ?
> > 
> > I recently discovered another "feature" of GCC. When function 
> > arguments are pushed on the stack, they are aligned on an "int" 
> > boundary. When compiling with -mshort, there is no additional filler.
> > But when -mshort is not used, pushing a short then a long causes the
> > long to be aligned 2 bytes further. A short filler is inserted 
> > between the 2 values. Just like structure alignment, it seems to me 
> > that such alignment is useless on the Atari platform. I plan to 
> > remove this alignment in my next build.
> > 
> > So what do you think about removing the alignments, for structure 
> > members and stack parameters ? Does it break some compatibility ?
> 
> Petr Stehlik answered:
> > yes, it does.
> > 
> > If you want to help the Atari community with your GCC port then
> > please don't mess with these settings (including the a0/d0 trials)
> > and make sure that you use the very same settings the gcc 2.95 for
> > MiNT had.
> 
> Feel free to post any further comment.
> 

The Lattice C compiler (in default mode) uses 32-bit integers and widens 
shorter integer type (i.e. shorts and chars) to 32 bits before placing them on 
the stack.  However (also in default mode), non-character structure members are 
aligned on word boundaries rather than long boundaries.  Both these behaviours 
may be changed by appropriate compiler arguments.

Since I suspect GCC is used a lot more than Lattice for current development, it 
would probably be best to stick to the existing GCC implementation behaviour.

Regards,
Roger Burrows


