Cannot compile GMP 6.0.0a in Thumb mode

Mike Mohr akihana at gmail.com
Thu Mar 27 07:19:05 UTC 2014


While cross compiling GMP 6.0.0a (the packaged release) for Android in
Thumb mode I get the following assembler error:

libtool: compile:  arm-linux-androideabi-gcc -std=gnu99 -DHAVE_CONFIG_H -I.
-I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_div_qr_1n_pi1 -march=armv5te
-mtune=xscale -msoft-float -mthumb -c div_qr_1n_pi1.c  -fPIC -DPIC -o
.libs/div_qr_1n_pi1.o
/tmp/ccXNC6Uv.s: Assembler messages:
/tmp/ccXNC6Uv.s:743: Error: instruction not supported in Thumb16 mode --
`adds r4,r1,r0'
/tmp/ccXNC6Uv.s:744: Error: instruction not supported in Thumb16 mode --
`adcs r3,r3,r2'
/tmp/ccXNC6Uv.s:745: Error: Thumb does not support conditional execution
/tmp/ccXNC6Uv.s:746: Error: Thumb does not support conditional execution
/tmp/ccXNC6Uv.s:1306: Error: instruction not supported in Thumb16 mode --
`adds r4,r1,r0'
/tmp/ccXNC6Uv.s:1307: Error: instruction not supported in Thumb16 mode --
`adcs r3,r3,r2'
/tmp/ccXNC6Uv.s:1308: Error: Thumb does not support conditional execution
/tmp/ccXNC6Uv.s:1309: Error: Thumb does not support conditional execution
make[2]: *** [div_qr_1n_pi1.lo] Error 1

I hand-compiled this file using gcc's -S flag and traced the error to line
218 of the original source file:

$ ls -al mpn/div_qr_1n_pi1.c
lrwxrwxrwx 1 michael michael 30 Mar 26 23:40 mpn/div_qr_1n_pi1.c ->
../mpn/generic/div_qr_1n_pi1.c

which reads:

add_mssaaaa (u2, u1, u0, u0, up[n-2], p1, p0);

For ARM, this is a macro defined on line 133 of the same file.  Changing
line 133 as follows resolves the issue:

#if defined (__arm__) && W_TYPE_SIZE == 32 && !defined(__thumb__)
#define add_mssaaaa(m, sh, sl, ah, al, bh, bl)                          \

The issue at hand is very similar to this bug report:

http://lists.openembedded.org/pipermail/openembedded-core/2012-February/057108.html

Build scripts are available, as usual, from my Github repository:

https://github.com/Rupan/gmp

Michael Mohr


More information about the gmp-discuss mailing list