Re: Use -fvisibility=hidden for shared libraries

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, 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-09-01 21:19:35
Message-ID: 20220901211935.k6v7mt3mjhnfbhnr@awork3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2022-07-27 14:02:28 -0400, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > On 2022-07-18 00:05:16 -0700, Andres Freund wrote:
> >> Given that that's just about all compilers we support using configure, perhaps
> >> we should just move that out of the compiler specific section? Doesn't look
> >> like there's much precedent for that so far...
>
> > Here's a potential patch along those lines.
>
> Now that the dust from the main patch is pretty well settled, +1
> for trying that.

Here's an updated patch for this (also shared recently on another thread). I
was wrong earlier saying that -fvisibility works for xlc - it is accepted, but
just as some sort of input file. We do need -qvisibility.

I tested it on aix and solaris, both with gcc and their proprietary compilers
and confirmed that it indeed does reduce the number of exposed symbols.

I also attached the aix patch to not use mkldexport for extension anymore, as
I tested the patches in that order. I plan to push the aix one as soon as as
hoverfly and sungazer ran once after e5484554ba9.

> > I wonder if we also should move the -fno-strict-aliasing, -fwrapv tests
> > out. But that'd be something for later.
>
> Those seem less likely to be portable to non-gcc-alike compilers.
> On the other hand, maybe it'd be interesting to just remove the
> conditionality temporarily and try ALL the switches on all compilers,
> just to see what we can learn from the buildfarm.

Unfortunately, given the discovery of xlc accepting -f... silently that's
probably not feasible. We'd have to make it at least conditional on not being
xlc. Everything else we support does seem to be ok with -fxxx flags.

Greetings,

Andres Freund

Attachment Content-Type Size
v5-0001-aix-No-need-to-use-mkldexport-when-we-want-to-exp.patch text/x-diff 4.1 KB
v5-0002-configure-Expand-fvisibility-checks-to-more-compi.patch text/x-diff 17.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2022-09-01 21:22:05 Re: windows resource files, bugs and what do we actually want
Previous Message Nathan Bossart 2022-09-01 21:18:20 Re: introduce bufmgr hooks