[FFmpeg-devel] Memory leak using bitstream filters with shared libs

Måns Rullgård mans
Sun Mar 9 04:42:46 CET 2008

Uoti Urpala <uoti.urpala at pp1.inet.fi> writes:

> On Sat, 2008-03-08 at 19:23 -0500, Rich Felker wrote:
>> It's actually an implementation bug since the C language requires that
>> the addresses match. I suspect it's binutils doing something stupid
>> due to -Bsymbolic. Anyway this sort of problem is common enough that
> It's binutils doing what -Bsymbolic is documented to do - binding
> references to global symbols to the definition within the shared
> library. If the main program is compiled without -fPIC then functions
> are normally bound to the main program's PLT entry (if one exists for
> the function in question), and that's what other code will use.

I can't see a reason why both bits of code can't use similar
indirection to pick up the real address of the function.

The code in question in utils.c is compiled to

  mov    0x2755d4(%rip),%rax

whereas the relevant instruction from ffmpeg.c is

  movq   $0x4038a0,0x48(%rsp)

The address 0x4038a0 is a PLT entry with a jump instruction:

  jmpq   *0x20e9a2(%rip)

Why can't the movq instruction reference the GOT instead of using the
PLT entry?  I realise this would prohibit lazy binding of this symbol,
but surely there's a way to handle that.

M?ns Rullg?rd
mans at mansr.com

More information about the ffmpeg-devel mailing list