[erlang-questions] Erlang in Debian on m68k architecture

Bjorn Gustavsson bjorn@REDACTED
Thu Jan 25 16:04:09 CET 2007


"Sergei Golovan" <sgolovan@REDACTED> writes:

> On 1/25/07, Roman Zippel <zippel@REDACTED> wrote:
> > It's aligned, but unfortunately not as much as erlang liked.
> > Unfortunately that's also a very common error source in quite a few
> > packages, which then only fail on m68k.
> 
> We've found GCC option -malign-int for m68k. Citing from the manual:
>        -malign-int
>        -mno-align-int
>            Control whether GCC aligns "int", "long", "long long", "float",
>            "double", and "long double" variables on a 32-bit boundary
>            (-malign-int) or a 16-bit boundary (-mno-align-int).  Aligning
>            variables on 32-bit boundaries produces code that runs somewhat
>            faster on processors with 32-bit busses at the expense of more mem-
>            ory.
> 
>            Warning: if you use the -malign-int switch, GCC will align struc-
>            tures containing the above types  differently than most published
>            application binary interface specifications for the m68k.
> 
>  Can the issue with alignment of the structure be resolved using this
> option? Or this option isn't recommended to use?

Yes, it can. The emulator assumes that ints are 32 bit aligned.
Also make sure that malloc() returns 32-bit aligned memory blocks.

However, this option could cause structs including from system header files to
be aligned differently, which can cause code that call system calls or library
function to fail (especially code in the emulator/sys/ and emulator/drivers/
directories).

/Bjorn

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB




More information about the erlang-questions mailing list