wbrana | 5 Aug 2012 19:25
Picon

[PATCH] use -fvisibility=hidden

-fvisibility=hidden makes executables smaller with smaller load time
Attachment (mplayer-vis-hidden.patch): text/x-patch, 574 bytes
_______________________________________________
MPlayer-dev-eng mailing list
MPlayer-dev-eng <at> mplayerhq.hu
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng
Reimar Döffinger | 5 Aug 2012 20:00
Picon
Picon

Re: [PATCH] use -fvisibility=hidden

On Sun, Aug 05, 2012 at 07:25:09PM +0200, wbrana wrote:
> -fvisibility=hidden makes executables smaller with smaller load time

> --- configure.orig	2012-08-05 19:15:27.000000000 +0200
> +++ configure	2012-08-05 19:16:00.078697510 +0200
>  <at>  <at>  -2608,7 +2608,7  <at>  <at> 
>    elif test "$cc_vendor" != "gnu" ; then
>      CFLAGS="-O2 $_march $_mcpu $_pipe"
>    else
> -    CFLAGS="-O4 $_march $_mcpu $_pipe -ffast-math -fomit-frame-pointer"
> +    CFLAGS="-O4 $_march $_mcpu $_pipe -ffast-math -fomit-frame-pointer -fvisibility=hidden"

That is the GNU only way for something that is supported on many more
platforms by using a linker script (with -Wl,--version-script,).
Only disadvantage is that older binutils versions were broken and
ignored it for executables.
Reimar Döffinger | 14 Aug 2012 20:06
Picon
Picon

Re: [PATCH] use -fvisibility=hidden

On Sun, Aug 05, 2012 at 08:00:16PM +0200, Reimar Döffinger wrote:
> On Sun, Aug 05, 2012 at 07:25:09PM +0200, wbrana wrote:
> > -fvisibility=hidden makes executables smaller with smaller load time
> 
> > --- configure.orig	2012-08-05 19:15:27.000000000 +0200
> > +++ configure	2012-08-05 19:16:00.078697510 +0200
> >  <at>  <at>  -2608,7 +2608,7  <at>  <at> 
> >    elif test "$cc_vendor" != "gnu" ; then
> >      CFLAGS="-O2 $_march $_mcpu $_pipe"
> >    else
> > -    CFLAGS="-O4 $_march $_mcpu $_pipe -ffast-math -fomit-frame-pointer"
> > +    CFLAGS="-O4 $_march $_mcpu $_pipe -ffast-math -fomit-frame-pointer -fvisibility=hidden"
> 
> That is the GNU only way for something that is supported on many more
> platforms by using a linker script (with -Wl,--version-script,).
> Only disadvantage is that older binutils versions were broken and
> ignored it for executables.

Note: if anyone was to implement this: make sure not to hide the
_IO_stdin_used symbol, or you will get some really curious effects
(shame on libc developers for resorting to such a hack).

Gmane