Always use -fPIC, not -fpic, when building shared libraries with gcc.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 1 Jun 2017 17:32:55 +0000 (13:32 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 1 Jun 2017 17:32:55 +0000 (13:32 -0400)
commite9a3c047a5fc701d2efb776be2b351645ea001c8
tree3950f83c0f0290ab36248d47dc6b125b219b2b9c
parent2712da8b64b4e399a2666cce2c25329f4f834f2d
Always use -fPIC, not -fpic, when building shared libraries with gcc.

On some platforms, -fpic fails for sufficiently large shared libraries.
We've mostly not hit that boundary yet, but there are some extensions
such as Citus and pglogical where it's becoming a problem.  A bit of
research suggests that the penalty for -fPIC is small, in the
single-digit-percentage range --- and there's none at all on popular
platforms such as x86_64.  So let's just default to -fPIC everywhere
and provide one less thing for extension developers to worry about.

Per complaint from Christoph Berg.  Back-patch to all supported branches.
(I did not bother to touch the recently-removed Makefiles for sco and
unixware in the back branches, though.  We'd have no way to test that
it doesn't break anything on those platforms.)

Discussion: https://postgr.es/m/20170529155850.qojdfrwkkqnjb3ap@msg.df7cb.de
doc/src/sgml/dfunc.sgml
src/makefiles/Makefile.linux
src/makefiles/Makefile.netbsd
src/makefiles/Makefile.openbsd