[m-users.] ARM Linux toolchain
Julien Fischer
jfischer at opturion.com
Fri Feb 12 14:58:15 AEDT 2016
Hi Vladimir,
On Fri, 12 Feb 2016, Vladimir Komendantskiy wrote:
> I'm trying to compile Mercury git HEAD as a cross-compiler for an ARM
> Linux target (GCC 5.3.1). To configure, I reuse the cross-compile
> script tools/configure_mingw_cross with the right host and gcc name.
There probably need to be a few other changes to that as well.
> I get compile-time errors quite soon:
>
> ../scripts/mgnuc --grade asm_fast.gc --c-debug --no-ansi -- -c mercury_deep_copy.c -o mercury_deep_copy.o
> In file included from mercury_deep_copy.c:59:0:
> mercury_deep_copy_body.h: In function ‘MR_deep_copy’:
> mercury_deep_copy_body.h:848:1: error: unable to find a register to spill
> mercury_deep_copy_body.h:848:1: error: this is the insn:
> (insn 446 451 2140 47 (set (reg:SI 958)
> (mem/f:SI (plus:SI (reg/f:SI 591 [ functor_desc_103->MR_du_functor_arg_types ])
> (reg:SI 296 [ D.10539 ])) [0 *_199+0 S4 A32])) mercury_deep_copy_body.h:345 615 {*thumb2_movsi_vfp}
> (expr_list:REG_DEAD (reg/f:SI 591 [ functor_desc_103->MR_du_functor_arg_types ])
> (expr_list:REG_DEAD (reg:SI 296 [ D.10539 ])
> (expr_list:REG_EQUIV (mem:SI (reg/f:SI 13 sp) [0 S4 A32])
> (nil)))))
It's a bug in GCC. There's not a lot we can do about other than try to
identify what constructs / optimization settings trigger it and add a
workaround. (This is a common sort of problem in grades that use GCC's
global register variable extension; quite a few bits of GCC don't deal
well with there being fewer registers than normal.)
> An older post [1] suggests adding -O1 to CFLAGS. In fact yes, adding "CFLAGS += -O1" in Mmake.common solves this one.
>
> [1] http://www.mercurylang.org/list-archives/users/2013-June/007597.html
>
> However another error follows:
>
> mercury_layout_util.c: In function ‘MR_get_type_and_value’:
> mercury_layout_util.c:946:1: error: unable to find a register to spill
> mercury_layout_util.c:946:1: error: this is the insn:
> (insn 13 34 36 2 (set (reg:SI 126)
> (mem/f/c:SI (plus:SI (reg/f:SI 103 afp)
> (const_int 40 [0x28])) [0 value+0 S4 A32])) mercury_layout_util.c:943 615 {*thumb2_movsi_vfp}
> (nil))
>
> Is there a better solution then the -O1 workaround? Possibly I should disable asm_fast* grades?
Are you doing something that specifically requires the asm_fast* grades?
If not, I suggest you use the 'hlc' grades for most things and the
'none' grades for things that aren't supported by the high-level C
back-end (e.g. debugging, deep profiling). Passing
--with-llds-base-grade=none
to configure should do this for you.
Julien.
More information about the users
mailing list