[Top][All Lists]

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

Re: [bug-mes] MesCC neglects alignment requirements of the System V ABI

From: Danny Milosavljevic
Subject: Re: [bug-mes] MesCC neglects alignment requirements of the System V ABI
Date: Thu, 18 Jul 2019 16:35:37 +0200

Hi Mark,

On Thu, 18 Jul 2019 06:14:46 -0400
Mark H Weaver <address@hidden> wrote:

> The System V ABI specifies alignment requirements for each C type.
> Padding must be implicitly inserted in structures to ensure that each
> field is properly aligned.  MesCC does not do this, and therefore it
> violates the ABI.
> For example, see section 3.1.2 (Data Representation) here:
> https://software.intel.com/sites/default/files/article/402129/mpx-linux64-abi.pdf
> One consequence of this is that MesCC-compiled code cannot reliably be
> linked with code compiled by other compilers, because there may be
> disagreements over structure layout.

That is true and a conscious design decision.

In the ARM world, it's even worse, the stack needs to be aligned (to like
16 Bytes) on each function call; and even the uses of the register file need
to be aligned (!).  We don't do those either.

It was a conscious decision to ignore these in order to simplify the compiler.
After all, the goal is to have a human read and understand all of the compiler's
source code, so better if it doesn't do arcane things if we can get away with
leaving it off.

It's true that that precludes liking with code compiled by other compilers,
but there is no use case for the latter, right?

We don't even optimize division by 1, that's how mimimalist we are...

Attachment: pgpFQ3ZV4IxVI.pgp
Description: OpenPGP digital signature

reply via email to

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