nios2 "Error: r31 cannot be used with jmp; use ret instead"

Hill, Jeff johill at lanl.gov
Fri Jan 27 23:11:46 UTC 2017


Hello all,

We are encountering some assembler errors, see below, when building RTEMS 4.11 for architecture nios2 with the default source builder generated tools.

nios2-rtems4.11-gcc --pipe -DHAVE_CONFIG_H   -I.. -I../../cpukit/../../../altera-sys-config-s43x-BPPM/lib/include -I/home/hill/nios2-rtems/rtems/rtems-git/c/src/../../cpukit/libmisc/shell   -O3 -g -Wall -Wmissing-prototypes -Wimplicit-function-declaration -Wstrict-prototypes -Wnested-externs -MT shell/libshell_a-hexdump-parse.o -MD -MP -MF shell/.deps/libshell_a-hexdump-parse.Tpo -c -o shell/libshell_a-hexdump-parse.o `test -f 'shell/hexdump-parse.c' || echo '/home/hill/nios2-rtems/rtems/rtems-git/c/src/../../cpukit/libmisc/'`shell/hexdump-parse.c
{standard input}: Assembler messages:
{standard input}:881: Error: r31 cannot be used with jmp; use ret instead
make[5]: *** [shell/libshell_a-hexdump-parse.o] Error 1

Some additions, see below, to the RTEMS 4.11 source builder configuration file,  rtems-nios2.bset, appear to temporarily resolve this issue backporting a patch from the gcc mainline. I don't claim to have completed exhaustive testing at this point nor fully understand gcc internals, FWIW.

#
# Add fix for improper use of register 31 with jump instruction issue,
# resulting in some assembler errors as follows
#
# "Error: r31 cannot be used with jmp; use ret instead"
#
%patch add gcc -p0 pw://patchwork.ozlabs.org/patch/471401/raw/nios2-add-IJMP_REGS-reg-class-for-indirect-jumps.patch
%hash md5 nios2-add-IJMP_REGS-reg-class-for-indirect-jumps.patch 90d1052167fe25f561a8f9ab06a74499

Jeff Hill

#
# Tools Set for RTEMS NIOS 4.11 Stable
#

%define release 1

%define rtems_arch nios2

#
# The RTEMS 4.11 base defines.
#
%include rtems-4.11-base.bset

#
# Add fix for improper use of register 31 with jump instruction issue,
# resulting in some assembler errors as follows
#
# "Error: r31 cannot be used with jmp; use ret instead"
#
%patch add gcc -p0 pw://patchwork.ozlabs.org/patch/471401/raw/nios2-add-IJMP_REGS-reg-class-for-indirect-jumps.patch
%hash md5 nios2-add-IJMP_REGS-reg-class-for-indirect-jumps.patch 90d1052167fe25f561a8f9ab06a74499

#
# Tools configuration.
#
4.11/rtems-autotools
devel/expat-2.1.0-1
tools/rtems-binutils-2.26-1
tools/rtems-gcc-4.9.3-newlib-2.2.0-20150423-1
tools/rtems-gdb-7.9-1
tools/rtems-tools-4.11-1
tools/rtems-kernel-4.11


More information about the users mailing list