[Xcb] hidden-visibility and library size

Vincent Torri Vincent.Torri at iecn.u-nancy.fr
Tue Dec 27 12:26:18 PST 2005

On Tue, 27 Dec 2005, Jamey Sharp wrote:

> On Tue, Dec 27, 2005 at 07:30:33PM +0100, Vincent Torri wrote:
> > hey
> Hi Vincent!
> > I'm writing the hidden visibility support for xcb. I wanted to make it the
> > less intrusive possible in configure.ac, that is, i've written a macro for
> > it. Problem : with autoreconf, i'm not able to tell aclocal to look in any
> > dir where the macro is (in m4).
> I believe the recommended thing to do is put your macro in a file named
> acinclude.m4 in the same directory as configure.ac. I think that should
> Just Work.

haa, ok :) i didn't know. It works, indeed. There are the acinclude.m4
file and a diff of configure.ac attached
$(VISIBILITY_CFLAGS) must be added in src/Makefile.am of course
I've also added an output of the configure script. I find it usefull, to
know if we have the configuration that we want. Maybe we can modify it so
that your modifications are taken into account.

> > also, what do you think about adding a specific flag for debug ?
> I guess it'd be fine. What do you think of the attached patch?

it looks fine to me, and it does what i want :)

> Interesting statistics: compiling --with-opt=small saves 15kB (59.6kB
> total) over --with-opt (73.4kB total) and --without-opt (74.1kB).

I also guess that adding -s during linking should decrease even more the
library size (libXCB_la_LDFLAGS = -s   in src/Makefile.am). I've not tried
it, i've just used strip on the library directly.

I also have made some tests, and stripping after using the visibility
feature decreases even more the size.

i also think that we must be sure that, if debugging is set, only the
warning flags and -g must be passed to gcc during compilation and -s not
be passed during linking.


More information about the Xcb mailing list