Skip to content

ARM thumb: error: out of range immediate fixup value on Clang >= 5 #7878

@kleest

Description

@kleest

Commit: 6de98b4
Android NDK Version: r18b

config_android.log
config_rpi.log

Environment:

ANDROID_NDK=/android/ndk
ANDROID_PLATFORM=android-27
PATH=/android/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/:/android/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

$ which clang
/android/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin//clang

$ configdata.pm --dump
<see attached file>

Error:

clang  -Icrypto -I. -Icrypto/include -Iinclude  -fPIC -pthread  -target thumbv7-linux-androideabi -gcc-toolchain /android/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 --sysroot=/android/ndk/platforms/android-28/arch-arm -Wa,--noexecstack -Qunused-arguments -Wall -O3 -mthumb -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/usr/local/lib/engines-3\"" -D__ANDROID_API__=28 -isystem /android/ndk/sysroot/usr/include/arm-linux-androideabi -isystem /android/ndk/sysroot/usr/include -DNDEBUG -D__ARM_MAX_ARCH__=7 -c -o crypto/poly1305/libcrypto-lib-poly1305-armv4.o crypto/poly1305/poly1305-armv4.S
crypto/poly1305/poly1305-armv4.S:168:2: error: out of range immediate fixup value
 addeq r12,r11,#(poly1305_emit-.Lpoly1305_init)
 ^
crypto/poly1305/poly1305-armv4.S:169:2: error: out of range immediate fixup value
 addne r12,r11,#(poly1305_emit_neon-.Lpoly1305_init)
 ^
crypto/poly1305/poly1305-armv4.S:171:2: error: out of range immediate fixup value
 addne r11,r11,#(poly1305_blocks_neon-.Lpoly1305_init)
 ^
Makefile:9912: recipe for target 'crypto/poly1305/libcrypto-lib-poly1305-armv4.o' failed
make[1]: *** [crypto/poly1305/libcrypto-lib-poly1305-armv4.o] Error 1

It seems, that compiling with the -mthumb option leads to the calculated immediate being out-of-range. Without that option, compilation is working fine. Also, with Android NDK r16b that file compiles fine but the build fails at the linking stage (unrelated to this issue).
When natively compiling on a Raspberry PI (./config -mthumb) with LLVM 6.0.0, the same error appears (config_rpi.log), so this is not limited to cross-compilation or Android.

At this point, I do not know if this is actually an issue of OpenSSL, an invalid configuration (is arm-v7a together with -mthumb actually supported?) or a bug in LLVM.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions