Re: Use -fvisibility=hidden for shared libraries

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Use -fvisibility=hidden for shared libraries
Date: 2022-03-24 15:13:31
Message-ID: 5b8d48a4-2fee-6764-7eda-a076f544ea33@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11.01.22 03:53, Andres Freund wrote:
> Ugh. In the case of worker_spi it's because -fvisibility=hidden isn't applied
> to worker_spi.c at all. Which in turn is because Makefile.shlib isn't used at
> all for MODULES= style modules just for MODULE_big= ones :(.
>
> Once that's "fixed" it fails as expected...
>
> I'm not sure what the best way to deal with this is. Just now I copied the
> logic from Makefile.shlib to pgxs.mk (by the existing CFLAGS_SL use), but that
> doesn't scale - there's other direct uses of CFLAGS_SL.
>
> Perhaps the best way would be to add the -fvisibility=hidden to CFLAGS_SL, and
> work around the explicit exports issue in Makefile.shlib by adding an explicit
> -fvisibility=default? Or perhaps CFLAGS_SL

The easiest solution would be to change worker_spi's Makefile to use
MODULE_big.

There are already many cases where MODULE_big is used instead of MODULES
for seemingly random reasons, so I wouldn't worry too much about it here
if it helps you move forward.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2022-03-24 15:16:15 Re: [RFC] building postgres with meson -v6
Previous Message Alvaro Herrera 2022-03-24 15:00:58 Re: Remove an unnecessary errmsg_plural in dependency.c