[FFmpeg-devel] [PATCH] restoring binary compatibility with ffmpeg 0.5
Michael Niedermayer
michaelni
Thu Jun 10 11:38:52 CEST 2010
On Thu, Jun 10, 2010 at 09:52:13AM +0100, M?ns Rullg?rd wrote:
> Reinhard Tartler <siretart at tauware.de> writes:
>
> > On Wed, Jun 09, 2010 at 19:41:33 (CEST), Michael Niedermayer wrote:
> >
> >> On Wed, Jun 09, 2010 at 03:42:13PM +0200, Reinhard Tartler wrote:
> >>> Two questions:
> >>> a) doesn't this attribute need to be at symbol declaration and not
> >>> definition?
> >>
> >> The way i understand it, it needs to be at the definition
> >> at the declaration it possibly means a weak refernce which is something
> >> that is 0 (instead of failing to link) if no definition is found
> >
> > I see.
> >
> > I've now tried your suggestion to (re)introduce the functions like you
> > propose:
> >
> > #if LIBAVFORMAT_VERSION_MAJOR < 53
> > [...]
> > void __attribute__((weak)) av_init_packet(AVPacket *pkt)
> > {
> > abort();
> > }
> > #endif
> >
> > building a shared libavformat.so works without warnings/errors regarding
> > symbol collisions and results this
> >
> > $ readelf -s /tmp/ffmpeg-trunk/lib/libavformat.so | grep av_init_packet@
> > 466: 000abc00 8 FUNC WEAK DEFAULT 13 av_init_packet@@LIBAVFORMAT_52
> >
> > I guess this is exactly what you've expected here.
> >
> > With this setup, I've now tried both the ffplay binary from this
> > compilation and the system /usr/bin/ffplay (based on version 0.5.2). In
> > *both* cases, it seems that the binary at runtime picks up the version
> > in libavformat:
> >
> >>> readelf -s /tmp/ffmpeg-trunk/bin/ffplay | grep av_init_packet
> > 49: 00000000 0 FUNC GLOBAL DEFAULT UND av_init_packet at LIBAVFORMAT_52 (10)
> >
> >>> /tmp/ffmpeg-trunk/bin/ffplay /tmp/foo.avi
> > FFplay version SVN-r23556, Copyright (c) 2003-2010 the FFmpeg developers
> > built on Jun 10 2010 08:09:17 with gcc 4.4.3
> > configuration: --enable-avfilter --enable-libvpx --enable-shared --disable-static --enable-gpl --prefix=/tmp/ffmpeg-trunk --enable-postproc --enable-libvorbis
> > libavutil 50.18. 0 / 50.18. 0
> > libavcodec 52.75. 1 / 52.75. 1
> > libavformat 52.68. 0 / 52.68. 0
> > libavdevice 52. 2. 0 / 52. 2. 0
> > libavfilter 1.20. 0 / 1.20. 0
> > libswscale 0.11. 0 / 0.11. 0
> > libpostproc 51. 2. 0 / 51. 2. 0
> > zsh: abort /tmp/ffmpeg-trunk/bin/ffplay /srv/media/UDS-Sevilla.avi
>
> This is what I would expect. The weak attribute is only used when
> combining relocatable object files in to an executable or shared
> object, not during runtime dynamic linking.
until reinhard posts a readelf of libavcodec that shows a global
av_init_packet at LIBAVFORMAT_52 this conclusion is unfounded
also let me quote the code from the runtime dynamic linker
switch (ELFW(ST_BIND) (sym->st_info))
{
case STB_WEAK:
/* Weak definition. Use this value if we don't find another. */
if (__builtin_expect (GLRO(dl_dynamic_weak), 0))
{
if (! result->s)
{
result->s = sym;
result->m = (struct link_map *) map;
}
break;
}
/* FALLTHROUGH */
case STB_GLOBAL:
#ifdef __mips__
/* HACK: MIPS marks its lazy evaluation stubs with SHN_UNDEF
symbols, we skip them. */
if (sym->st_shndx == SHN_UNDEF)
break;
#endif
/* Global definition. Just what we need. */
result->s = sym;
result->m = (struct link_map *) map;
return 1;
default:
/* Local symbols are ignored. */
break;
}
}
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I wish the Xiph folks would stop pretending they've got something they
do not. Somehow I fear this will remain a wish. -- M?ns Rullg?rd
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100610/879f642a/attachment.pgp>
More information about the ffmpeg-devel
mailing list