Re: Use -fvisibility=hidden for shared libraries

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>, Laurenz Albe <laurenz.albe@cybertec.at>, pgsql-hackers@postgresql.org
Date: 2022-10-16T02:08:08Z
Lists: pgsql-hackers
Hi,

On 2022-09-01 14:19:35 -0700, Andres Freund wrote:
> Here's an updated patch for this (also shared recently on another thread).

I've since then committed this.

I was reminded of this when thinking about
https://postgr.es/m/1595488.1665869988%40sss.pgh.pa.us

Thinking about this made me realize that we currently don't expose
-fvisibility=hidden via pg_config. It's added to extensions built via PGXS,
via Makefile.global, but that doesn't help extensions that don't want to use
PGXS.

I guess we should report the CFLAGS_SL_MODULE etc via pg_config?

Greetings,

Andres Freund



Commits

  1. Mark all symbols exported from extension libraries PGDLLEXPORT.

  2. Default to hidden visibility for extension libraries where possible

  3. Remove now superfluous declarations of dlsym()ed symbols.

  4. Add central declarations for dlsym()ed symbols