From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Default to hidden visibility for extension libraries where possi
Date: Mon, 18 Jul 2022 01:05:56 +0000
Message-ID: <E1oDFCt-0001nT-LO@gemulon.postgresql.org> (raw)
Default to hidden visibility for extension libraries where possible
Until now postgres built extension libraries with global visibility, i.e.
exporting all symbols. On the one platform where that behavior is not
natively available, namely windows, we emulate it by analyzing the input files
to the shared library and exporting all the symbols therein.
Not exporting all symbols is actually desirable, as it can improve loading
speed, reduces the likelihood of symbol conflicts and can improve intra
extension library function call performance. It also makes the non-windows
builds more similar to windows builds.
Additionally, with meson implementing the export-all-symbols behavior for
windows, turns out to be more verbose than desirable.
This patch adds support for hiding symbols by default and, to counteract that,
explicit symbol visibility annotation for compilers that support
__attribute__((visibility("default"))) and -fvisibility=hidden. That is
expected to be most, if not all, compilers except msvc (for which we already
support explicit symbol export annotations).
Now that extension library symbols are explicitly exported, we don't need to
export all symbols on windows anymore, hence remove that behavior from
src/tools/msvc. The supporting code can't be removed, as we still need to
export all symbols from the main postgres binary.
Author: Andres Freund <andres@anarazel.de>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/20211101020311.av6hphdl6xbjbuif@alap3.anarazel.de
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/089480c077056fc20fa8d8f5a3032a9dcf5ed812
Modified Files
--------------
configure | 152 +++++++++++++++++++++++++++++++++++++++++++++
configure.ac | 13 ++++
src/Makefile.global.in | 3 +
src/Makefile.shlib | 13 ++++
src/include/c.h | 13 ++--
src/include/pg_config.h.in | 3 +
src/makefiles/pgxs.mk | 5 +-
src/tools/msvc/Project.pm | 7 ---
src/tools/msvc/Solution.pm | 1 +
9 files changed, 198 insertions(+), 12 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: andres@anarazel.de
Subject: Re: pgsql: Default to hidden visibility for extension libraries where possi
In-Reply-To: <E1oDFCt-0001nT-LO@gemulon.postgresql.org>
References: <E1oDFCt-0001nT-LO@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox