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.
Andreas
extern "C"
{
#include <libavformat/avformat.h>
}
void doSomeThing()
{
av_register_all();
avcodec_register_all();
}
From 435f3b61ec0e181810bd7794ba8a88e80209c5fd Mon Sep 17 00:00:00 2001
From: anhaupt <[email protected]>
Date: Thu, 12 Feb 2015 11:26:14 +0100
Subject: [PATCH] fixes the linker error produced when using libavcodec.a
within a shared object library
---
libavcodec/arm/videodsp_armv5te.S | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/libavcodec/arm/videodsp_armv5te.S b/libavcodec/arm/videodsp_armv5te.S
index 55bcce5..b1763ab 100644
--- a/libavcodec/arm/videodsp_armv5te.S
+++ b/libavcodec/arm/videodsp_armv5te.S
@@ -26,6 +26,8 @@ function ff_prefetch_arm, export=1
subs r2, r2, #1
pld [r0]
add r0, r0, r1
- bne X(ff_prefetch_arm)
+ beq 1f
+ b X(ff_prefetch_arm)
+1:
bx lr
endfunc
--
1.9.1
_______________________________________________
ffmpeg-devel mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel