Re: Use -fvisibility=hidden for shared libraries
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: pgsql-hackers@postgresql.org
Date: 2021-11-01T05:47:00Z
Lists: pgsql-hackers
Hi, On 2021-11-01 05:55:40 +0100, Laurenz Albe wrote: > I see that at least clang and gcc support this flag. Yes - and have for a long time. 2004 or so. > Could the reduced number of exported functions be a problem, if someone > relies on some function being exported? It may not be worth worrying about, > and they can always come and make a case for that symbol to be exported. Hm. Possible, but I don't think common. It's pretty rare to need symbols from a postgres extension shared library from another shared library. The most common case are transforms. To add a new transform one, from what I've seen, needs to expose previously internal stuff from an extension anyway... And transforms aren't all that common. And yes, we can easily just add a few additional exports over time. One nice advantage of this is that the !windows build behaves more similar to the windows case, which makes it easier to detect build breakages locally... Greetings, Andres Freund
Commits
-
Mark all symbols exported from extension libraries PGDLLEXPORT.
- 8cf64d35eacc 16.0 landed
-
Default to hidden visibility for extension libraries where possible
- 089480c07705 16.0 landed
-
Remove now superfluous declarations of dlsym()ed symbols.
- fd4bad165539 16.0 landed
-
Add central declarations for dlsym()ed symbols
- f2b73c8d75d5 16.0 landed