[FFmpeg-devel] Suggested fix for: Linker error when using libavcodec.a within shared library on ARM plattform
michaelni at gmx.at
Thu Feb 12 16:38:13 CET 2015
On Thu, Feb 12, 2015 at 02:20:13PM +0000, Andreas Haupt wrote:
> >Michael Niedermayer <michaelni at gmx.at> schrieb am 13:01 Donnerstag, 12.Februar 2015:
> >On Thu, Feb 12, 2015 at 10:56:58AM +0000, Andreas Haupt wrote:
> >> Hi,
> >> I found an issue when linking against the ffmpeg libavcodec.a static libary on armhf which can probably consider to be a bug.
> >> Summary of the bug:
> >> When I try to build a shared library in which I include libavcodec.a I receive the following linker error (on ARM plattform - banana pi board).
> >> Affected versions of ffmpeg are at least 2.5.3 and git-master, affected plattform is armhf (linux).
> >> Error message from linker:
> >> /home/hpt/ffmpeg/arm_gcc/2.5.3/lib/static/libavcodec.a(videodsp_armv5te.o): In function `ff_prefetch_arm':
> >> /root/build_ffmpeg/ffmpeg/libavcodec/arm/videodsp_armv5te.S:29:(.text+0x8): relocation truncated to fit: R_ARM_THM_JUMP19 against symbol `ff_prefetch_arm' defined in .text section in /home/hpt/ffmpeg/arm_gcc/2.5.3/lib/static/libavcodec.a(videodsp_armv5te.o)
> >> collect2: ld returned 1 exit status
> >> How to reproduce:
> >> Use the attached cpp file to build a shared object library on arm.
> >> When I try to create the shared object library I get the linker error from above. I used the following command to create the shared object library:
> >> % g++ -shared -D__STDC_CONSTANT_MACROS -o test.so -I/home/hpt/ffmpeg/arm_gcc/2.5.3/include/ sample_cpp_file_for_bug_reproduction.cpp /home/hpt/ffmpeg/arm_gcc/2.5.3/lib/static/libavcodec.a
> >> There seems to be some problem in the libavcodec/arm/videodsp_armv5te.S assembler file. In that file the label 'ff_prefetch_arm' (line 25) is exported and further down used by a conditional near jump (line 29). The near jump cannot be done if the label is exported within a shared object library. That's at least the explanation I found for myself.
> >> I used the attached (untested) patch to fix the linker error from above. As far as I can see this patch should fix the problem without any side effects. At least it fixes the linker error I get.
> >does this work too: ?
> >diff --git a/libavcodec/arm/videodsp_armv5te.S b/libavcodec/arm/videodsp_armv5te.S
> >index 55bcce5..aff1161 100644
> >--- a/libavcodec/arm/videodsp_armv5te.S
> >+++ b/libavcodec/arm/videodsp_armv5te.S
> >@@ -23,9 +23,10 @@
> >#include "libavutil/arm/asm.S"
> >function ff_prefetch_arm, export=1
> > subs r2, r2, #1
> > pld [r0]
> > add r0, r0, r1
> >- bne X(ff_prefetch_arm)
> >+ bne 1b
> > bx lr
> >Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> >Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User
> >questions about the command line tools should be sent to the ffmpeg-user ML.
> >And questions about how to use libav* should be sent to the libav-user ML.
> >ffmpeg-devel mailing list
> >ffmpeg-devel at ffmpeg.org
> Yes, the diff you suggested does work. (They don't produce the earlier linker error.)
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 181 bytes
Desc: Digital signature
More information about the ffmpeg-devel