Relocation Overflow when linking library (error: relocation overflow in R_AARCH64_CONDBR19)

340 views
Skip to first unread message

Freeman X

unread,
Apr 6, 2020, 2:30:12 PM4/6/20
to android-ndk
I'm trying to build POCL(a third party portable OpenCL library ) with NDK_r21. 

Everything compiles fine until linking libOpenCL.so. The error message says:
[ 72%] Linking CXX shared library libOpenCL.so
clang90++: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]
bionic/libc/arch-arm64/bionic/setjmp.S:199: error: relocation overflow in R_AARCH64_CONDBR19
clang90++: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/CL/CMakeFiles/OpenCL.dir/build.make:476: lib/CL/libOpenCL.so.2.6.0] Error 1
make[1]: *** [CMakeFiles/Makefile2:541: lib/CL/CMakeFiles/OpenCL.dir/all] Error 2
make: *** [Makefile:163: all] Error 2


What does that mean? Thanks.

Dan Albert

unread,
Apr 6, 2020, 2:43:47 PM4/6/20
to android-ndk

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/c99061b5-ed3a-4de7-ab11-ec298a86b81f%40googlegroups.com.

Freeman X

unread,
Apr 8, 2020, 3:40:32 PM4/8/20
to android-ndk
Tried the latest release(r21b), still get the same error. I think the error is caused by linking too many libraries(static libs). When I remove some -l flags, this error is gone. Is there limitation on linking static libraries?


On Tuesday, April 7, 2020 at 2:43:47 AM UTC+8, Dan Albert wrote:
On Mon, Apr 6, 2020, 11:30 Freeman X <u300...@connect.hku.hk> wrote:
I'm trying to build POCL(a third party portable OpenCL library ) with NDK_r21. 

Everything compiles fine until linking libOpenCL.so. The error message says:
[ 72%] Linking CXX shared library libOpenCL.so
clang90++: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]
bionic/libc/arch-arm64/bionic/setjmp.S:199: error: relocation overflow in R_AARCH64_CONDBR19
clang90++: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/CL/CMakeFiles/OpenCL.dir/build.make:476: lib/CL/libOpenCL.so.2.6.0] Error 1
make[1]: *** [CMakeFiles/Makefile2:541: lib/CL/CMakeFiles/OpenCL.dir/all] Error 2
make: *** [Makefile:163: all] Error 2


What does that mean? Thanks.

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to andro...@googlegroups.com.

Hunter Mayer

unread,
Feb 2, 2022, 12:24:07 PMFeb 2
to android-ndk
I know this is a little old to respond to (raise the dead!), but I think Freeman is right. I hit this error tonight on a native build that we've been adding code too for over ten+ years now. A couple new functions and it stopped building for armeabi. I remove those definitions and it builds. If I remove other functions that have been in the code base more than half a decade I can add the new ones... I am not interested in playing that game over time, so we'll probably say good by to ancient device support. We've been proud to support them for as long as we have.

But yah... it has its limits... whether documented or not I've seen it empirically first hand. (using NDK 14b. its an old code, but it still works, sort of...)

enh

unread,
Feb 2, 2022, 12:28:33 PMFeb 2
to android-ndk
On Wed, Feb 2, 2022 at 9:24 AM Hunter Mayer <orio...@gmail.com> wrote:
>
> I know this is a little old to respond to (raise the dead!), but I think Freeman is right. I hit this error tonight on a native build that we've been adding code too for over ten+ years now. A couple new functions and it stopped building for armeabi. I remove those definitions and it builds. If I remove other functions that have been in the code base more than half a decade I can add the new ones... I am not interested in playing that game over time, so we'll probably say good by to ancient device support. We've been proud to support them for as long as we have.
>
> But yah... it has its limits... whether documented or not I've seen it empirically first hand. (using NDK 14b. its an old code, but it still works, sort of...)

well, any given relocation type has its limits (there are only so many
bits to represent the offset; that's what the "19" in the name is
telling you), but the toolchain should use an appropriate (that is:
"large enough") relocation type for the distance it needs to jump.
there have definitely been bugs with this over time, so step 1 is
definitely "use a current NDK". if you still have a repro case then,
file at bug at https://github.com/android/ndk/issues.

> On Wednesday, April 8, 2020 at 12:40:32 PM UTC-7 Freeman X wrote:
>>
>> Tried the latest release(r21b), still get the same error. I think the error is caused by linking too many libraries(static libs). When I remove some -l flags, this error is gone. Is there limitation on linking static libraries?
>>
>>
>> On Tuesday, April 7, 2020 at 2:43:47 AM UTC+8, Dan Albert wrote:
>>>
>>> Possibly related to https://github.com/android/ndk/issues/1205
>>>
>>> On Mon, Apr 6, 2020, 11:30 Freeman X <u300...@connect.hku.hk> wrote:
>>>>
>>>> I'm trying to build POCL(a third party portable OpenCL library ) with NDK_r21.
>>>>
>>>> Everything compiles fine until linking libOpenCL.so. The error message says:
>>>> [ 72%] Linking CXX shared library libOpenCL.so
>>>> clang90++: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]
>>>> bionic/libc/arch-arm64/bionic/setjmp.S:199: error: relocation overflow in R_AARCH64_CONDBR19
>>>> clang90++: error: linker command failed with exit code 1 (use -v to see invocation)
>>>> make[2]: *** [lib/CL/CMakeFiles/OpenCL.dir/build.make:476: lib/CL/libOpenCL.so.2.6.0] Error 1
>>>> make[1]: *** [CMakeFiles/Makefile2:541: lib/CL/CMakeFiles/OpenCL.dir/all] Error 2
>>>> make: *** [Makefile:163: all] Error 2
>>>>
>>>>
>>>> What does that mean? Thanks.
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google Groups "android-ndk" group.
>>>>
>>>> To unsubscribe from this group and stop receiving emails from it, send an email to andro...@googlegroups.com.
>>>>
>>>>
>>>> To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/c99061b5-ed3a-4de7-ab11-ec298a86b81f%40googlegroups.com.
>
> --
> You received this message because you are subscribed to the Google Groups "android-ndk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/f29db9b0-4e83-4411-91da-5dbbb65be65fn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages