[FFmpeg-devel] libavfilter fails to link on x86_64

Paul Flinders paul
Sun Dec 5 21:13:26 CET 2010


On 12/05/2010 06:33 PM, Paul Flinders wrote:
> The recent SSE2/SSSE3 optimisations to yadif have resulted in a 
> failure to compile on x86_64 with the error message
>
> /usr/bin/ld: libavfilter/x86/yadif.o: relocation R_X86_64_PC32 against 
> undefined symbol `ff_pw_1' can not be used when making a shared 
> object; recompile with -fPIC
> /usr/bin/ld: final link failed: Bad value
>
Sorry to reply to my own post...

OK, as I understand it this error is caused by trying to access a symbol 
which is defined in another DSO from position independent 64bit code 
because the range of PC relative addressing isn't sufficient to reach an 
arbitrary 64bit address.

Until the recent patches the code defined its own versions of the 
constants pw_1 and pb_1, the new code removed these definitions and uses 
ff_pw_1 and ff_pb_1 presumably intending to pick up the versions in 
libavcodec. The relevant headers aren't included though which makes it 
less than 100% clear that was the intention (there are no compile time 
errors as they are only referenced from assembler statements).

The following patch fixes the compile, not sure whether it is the 
approach you would want to take.

--- libavfilter/x86/yadif.c~    2010-12-05 16:33:02.000000000 +0000
+++ libavfilter/x86/yadif.c    2010-12-05 19:14:49.000000000 +0000
@@ -22,6 +22,11 @@
  #include "libavutil/x86_cpu.h"
  #include "libavfilter/yadif.h"

+#include "libavcodec/x86/dsputil_mmx.h"
+
+DECLARE_ALIGNED(16, const xmm_reg,  ff_pw_1  ) = 
{0x0001000100010001ULL, 0x0001000100010001ULL};
+DECLARE_ALIGNED(16, const xmm_reg,  ff_pb_1  ) = 
{0x0101010101010101ULL, 0x0101010101010101ULL};
+
  #if HAVE_SSSE3
  #define COMPILE_TEMPLATE_SSE 1
  #define COMPILE_TEMPLATE_SSSE3 1




More information about the ffmpeg-devel mailing list