[Ffmpeg-devel] [patch] gcc4 visibility support
Diego 'Flameeyes' Pettenò
Fri Jun 2 18:45:29 CEST 2006
(not sure if this will come to ffmpeg-devel as I'm not subscribed.. in case
can you forward it? :)
On Friday 02 June 2006 18:22, Mike Melanson wrote:
> Could you explain this a bit? What is meant by "gcc visibility"? A
> cursory review of the patch seems to indicate that public symbols in the
> C files are now qualified with the keyword EXPORTED. What's this all
> about? I haven't heard of this before.
GCC has something about ELF symbols visibility in their wiki (
http://gcc.gnu.org/wiki/Visibility ), although that is more oriented on C++
and does not all make sense for C-based libraries such as FFMpeg.
EXPORTED is not a keyword but a macro, mainly for backward compatibility with
older GCC, that expands on GCC4 to __attribute__((visibility("default"))),
that makes the symbol use the "default" visibility (that is, the symbol is
exported an visible), then -fvisibility=hidden changes the actual default
visibility of symbols to hidden (without touching the symbols with an
explicit visibility attribute, the ones marked as EXPORTED).
When hiding symbols, the entry points in the libraries are removed, the
symbols are not visible by outside, so for a start VLC can't declare two
externs with the name of the mpeg4 matrix tables and use them if they are not
exported by the library. This brings a development upside: you have control
on the symbols you export, if some software is relying on the internal
variables and structures, it's cut off, it avoids mysterious crashes due to
change in ABI of internal functions.
But what is most important is that it cuts down the quantity of symbols that
are bound at runtime (try LD_DEBUG=bindings ffmpeg ), which is sensible for
stuff like xine and amaroK that relies on ffmpeg :)
It also allows the optimizer to do a better job, as it knows if the symbol is
going to be used outside the library or not.
Diego "Flameeyes" Petten? - http://farragut.flameeyes.is-a-geek.org/
Gentoo/Alt lead, Gentoo/FreeBSD, Video, AMD64, Sound, PAM, KDE
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
More information about the ffmpeg-devel