[FFmpeg-devel] [RFC] gcc garbage collection unused code

Måns Rullgård mans
Thu Jun 12 23:45:41 CEST 2008


matthieu castet <castet.matthieu at free.fr> writes:

> Hi,
>
> I want to try to use -fdata-sections -ffunction-sections to remove
> dead code from ffmpeg.
>
> This is trivial to do on static library using
> --extra-cflags="-ffunction-sections -fdata-sections"
> --extra-ldflags="-Wl,--gc-sections -Wl,--print-gc-sections"
>
> But I want to try it also on shared libraries.
> For that I need to play with symbol visibility. I put all symbol to
> hidden except the public symbols. For that I use -fvisibility=hidden
> and pragma to set default visibility in public header (see attached
> patch).
> I don't really like it, because I wonder what will happen with
> compiler not supporting these pragma. But that's the only simple
> solution I see ATM.
>
> With the patch and setting --enable-shared
> --extra-cflags=-ffunction-sections -fdata-sections -fvisibility=hidden
> --extra-ldflags=-Wl,--gc-sections -Wl,--print-gc-sections,
> it mostly work but there are some problem with function that are not
> public but shared across libraries [1].
>
> What do you think of that ?
>
> What should be the best way to unhide private symbol shared across
> libraries ? Working at header level or function level ?

Symbols are either exported or not.  There is no way to export symbols
only to certain other libraries.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list