Re: libpq's pollution of application namespace

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: libpq's pollution of application namespace
Date: 2005-10-24 15:11:47
Message-ID: 200510241511.j9OFBlD07615@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


This has been saved for the 8.2 release:

http://momjian.postgresql.org/cgi-bin/pgpatches_hold

---------------------------------------------------------------------------

Martijn van Oosterhout wrote:
-- Start of PGP signed section.
> On Sun, Oct 16, 2005 at 06:21:37PM -0400, Tom Lane wrote:
> > I find that libpq.so exports the following symbols that have neither
> > PQ, pq, pg, nor lo_ as a prefix:
>
> <snip>
>
> > It'd be nicer if we could filter out all exported symbols that don't
> > appear in exports.txt, but I don't know any portable way to do that.
>
> With GNU LD it is trivial, using the --version-script command. If you
> use AWK to create the script from exports.txt like so:
>
> awk 'BEGIN { print "{ global: " } { if( $1 != "#" ) {print $1,";"} } END { print "local: *; };" }' <exports.txt >exports.version
>
> And then add "-Wl,--version-script,exports.version" to the link
> command, viola, stray symbols removed. Given we already have a
> configure test for GNU ld, it wouldn't be too hard to make it work for
> them. For windows it already uses exports.txt. What other linkers do we
> need to support?
>
> Another possibility would be to use strip like so:
>
> strip -w -K PQ* -K pq* -K pg* -K lo_* -K *PQ* -o output.so
>
> But then, that may be a GNU strip extention... And it doesn't follow
> the exports file then.
>
> Recent gcc versions support visibility directives in the source code but
> that's a lot more work (although doing it in the code would produce a
> more efficient library). And not portable to other compilers either...
>
> Hope this helps,
> --
> Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> > Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> > tool for doing 5% of the work and then sitting around waiting for someone
> > else to do the other 95% so you can sue them.
-- End of PGP section, PGP failed!

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-10-24 15:14:04 Re: [PATCHES] Win32 CHECK_FOR_INTERRUPTS() performance
Previous Message Tom Lane 2005-10-24 15:10:54 Re: [PATCHES] Win32 CHECK_FOR_INTERRUPTS() performance