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

Re: Erlang in Debian on m68k architecture



Hi,

On Thu, 25 Jan 2007, Sergei Golovan wrote:

> After some research, we've found that erlang relies on the alignment
> of some global variable. The following patch fixes it:
> ------------------------------------------------------------------
> --- erlang-11.b.2.orig/erts/emulator/beam/binary.c
> +++ erlang-11.b.2/erts/emulator/beam/binary.c
> @@ -31,7 +31,7 @@
> #include "erl_bits.h"
> 
> Uint erts_allocated_binaries;
> -erts_mtx_t erts_bin_alloc_mtx;
> +erts_mtx_t erts_bin_alloc_mtx __attribute__ ((aligned (4)));
> 
> void
> erts_init_binary(void)
> ------------------------------------------------------------------

Nice finding.

> So, the question is the following: Are global variables supposed to be
> always aligned? Is this a bug in GCC that it doesn't align the
> variable? Or is this a bug in erlang, and the fact that it works on
> other architectures is a lucky coincidence?

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.

bye, Roman



Reply to: