Compilation error on ARMv7 with -mthumb

Wirschell, Tom Tom.Wirschell at PinkRoccade.nl
Fri Jul 5 14:58:00 CEST 2013


When recompiling GMP 5.1.2 on an Odroid-U2 (ARMv7) running Gentoo Linux compilation fails when using GCC and CFLAGS "-pipe -march=armv7-a -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -mthumb".

I get the following output:
----------------------------------------------------------------------------------
/bin/sh ../libtool --tag=CC   --mode=compile armv7a-hardfloat-linux-gnueabi-gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -I.. -I../tests    -pipe -march=armv7-a -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -mthumb -c -o mod_1_inv.lo mod_1_inv.c
libtool: compile:  armv7a-hardfloat-linux-gnueabi-gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -I.. -I../tests -pipe -march=armv7-a -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -mthumb -c mod_1_inv.c  -fPIC -DPIC -o .libs/mod_1_inv.o
libtool: compile:  armv7a-hardfloat-linux-gnueabi-gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -I.. -I../tests -pipe -march=armv7-a -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -mthumb -c mod_1_inv.c -o mod_1_inv.o >/dev/null 2>&1
/bin/sh ../libtool --tag=CC   --mode=compile armv7a-hardfloat-linux-gnueabi-gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -I.. -I../tests    -pipe -march=armv7-a -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -mthumb -c -o mod_1_1-1.lo mod_1_1-1.c
libtool: compile:  armv7a-hardfloat-linux-gnueabi-gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -I.. -I../tests -pipe -march=armv7-a -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -mthumb -c mod_1_1-1.c  -fPIC -DPIC -o .libs/mod_1_1-1.o
libtool: compile:  armv7a-hardfloat-linux-gnueabi-gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -I.. -I../tests -pipe -march=armv7-a -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -mthumb -c mod_1_1-1.c -o mod_1_1-1.o >/dev/null 2>&1
/bin/sh ../libtool --tag=CC   --mode=compile armv7a-hardfloat-linux-gnueabi-gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -I.. -I../tests    -pipe -march=armv7-a -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -mthumb -c -o mod_1_1-2.lo mod_1_1-2.c
libtool: compile:  armv7a-hardfloat-linux-gnueabi-gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -I.. -I../tests -pipe -march=armv7-a -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -mthumb -c mod_1_1-2.c  -fPIC -DPIC -o .libs/mod_1_1-2.o
{standard input}: Assembler messages:
{standard input}:261: Error: thumb conditional instruction should be in IT block -- `movcc r6,#0'
{standard input}:262: Error: thumb conditional instruction should be in IT block -- `movcs r6,#-1'
{standard input}:377: Error: thumb conditional instruction should be in IT block -- `movcc r6,#0'
{standard input}:378: Error: thumb conditional instruction should be in IT block -- `movcs r6,#-1'
make: *** [mod_1_1-2.lo] Error 1
make: Leaving directory `/var/tmp/portage/dev-libs/gmp-5.1.2/work/gmp-5.1.2/tune'
emake failed
 * ERROR: dev-libs/gmp-5.1.2 failed (compile phase):
 *   (no error message)
 * 
 * Call stack:
 *     ebuild.sh, line  93:  Called src_compile
 *   environment, line 2918:  Called die
 * The specific snippet of code:
 *           emake -j1 -C tune tuneup || die;
 * 
 * If you need support, post the output of `emerge --info '=dev-libs/gmp-5.1.2'`,
 * the complete build log and the output of `emerge -pqv '=dev-libs/gmp-5.1.2'`.
 * The complete build log is located at '/var/tmp/portage/dev-libs/gmp-5.1.2/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-libs/gmp-5.1.2/temp/environment'.
 * Working directory: '/var/tmp/portage/dev-libs/gmp-5.1.2/work/gmp-5.1.2'
 * S: '/var/tmp/portage/dev-libs/gmp-5.1.2/work/gmp-5.1.2'
----------------------------------------------------------------------------------

I tried GCC 4.6.4 as well as GCC 4.8.1. When I first ran into this issue I was compiling with -O3 but as you can see from the output above specifying no optimization at all doesn't change anything.

When I leave out the "-mthumb" option GPM compiles without any problems on this system using GCC 4.6.4, 4.7.3 and 4.8.1 and CFLAGS changed to also include -O3.

Kind regards,

Tom Wirschell


More information about the gmp-bugs mailing list