Platform

ARM (Thumb assembly)

What

Depending on the GCC compiler options used, you can receive an error:

error: r7 cannot be used in asm here

Reason

The assembly code in bn_mul.h is optimized for the ARM platform and uses some registers, including r7 to efficiently do an operation. GCC also uses r7 as the frame pointer under ARM Thumb assembly.

Solution

Add -fomit-frame-pointer to your GCC compiler options.

If you have already added -O, -O2, etc you do not need to add -fomit-frame-pointer as the optimization options already include it on most systems by default.

Did this help?