[PATCH] Allow to build without exporting symbols

Mike Hommey mh+jemalloc at glandium.org
Mon Nov 19 01:54:25 PST 2012


On Thu, Nov 08, 2012 at 10:29:58PM +0100, Mike Hommey wrote:
> On Thu, Nov 08, 2012 at 12:29:37PM -0800, Jason Evans wrote:
> > On Nov 7, 2012, at 10:40 PM, Mike Hommey wrote:
> > > From: Mike Hommey <mh at glandium.org>
> > > 
> > > When statically linking jemalloc, it may be beneficial not to export its
> > > symbols if it makes sense, which allows the compiler and the linker to do
> > > some further optimizations.
> > > ---
> > > configure.ac |    7 +++++++
> > > 1 file changed, 7 insertions(+)
> > > 
> > > diff --git a/configure.ac b/configure.ac
> > > index 1c52439..8558961 100644
> > > --- a/configure.ac
> > > +++ b/configure.ac
> > > @@ -471,6 +471,13 @@ for stem in ${public_syms}; do
> > >   AC_DEFINE_UNQUOTED([${n}], [${m}])
> > > done
> > > 
> > > +AC_ARG_WITH([export],
> > > +  [AS_HELP_STRING([--without-export], [disable exporting jemalloc public APIs])],
> > > +  [if test "x$with_export" = "xno"; then
> > > +  AC_DEFINE([JEMALLOC_EXPORT],[])]
> > > +fi]
> > > +)
> > > +
> > > dnl Do not mangle library-private APIs by default.
> > > AC_ARG_WITH([private_namespace],
> > >   [AS_HELP_STRING([--with-private-namespace=<prefix>], [Prefix to prepend to all library-private APIs])],
> > > -- 
> > > 1.7.10.4
> > 
> > This looks to me like it will cause redefined symbol warnings.  Does it?
> 
> Why would it?

If you're thinking about redefined macros, that won't happen, because 
autoconf also replaces #define MACRO foo when it handles
AC_DEFINE(MACRO). Which is why it works without adding a #undef
JEMALLOC_EXPORT in the first place.

Mike



More information about the jemalloc-discuss mailing list