Re: [PATCH] use -fvisibility=hidden
Reimar Döffinger <Reimar.Doeffinger <at> gmx.de>
2012-08-14 18:06:46 GMT
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).