mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
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
This commit is contained in:
@ -1,15 +1,14 @@
|
||||
AROPT = crs
|
||||
|
||||
export_dynamic = -Wl,-E
|
||||
# Use --enable-new-dtags to generate DT_RUNPATH instead of DT_RPATH.
|
||||
# This allows LD_LIBRARY_PATH to still work when needed.
|
||||
rpath = -Wl,-rpath,'$(rpathdir)',--enable-new-dtags
|
||||
|
||||
DLSUFFIX = .so
|
||||
|
||||
ifeq "$(findstring sparc,$(host_cpu))" "sparc"
|
||||
CFLAGS_SL = -fPIC
|
||||
else
|
||||
CFLAGS_SL = -fpic
|
||||
endif
|
||||
|
||||
|
||||
# Rule for building a shared library from a single .o file
|
||||
%.so: %.o
|
||||
|
@ -9,11 +9,7 @@ endif
|
||||
|
||||
DLSUFFIX = .so
|
||||
|
||||
ifeq ($(findstring sparc,$(host_cpu)), sparc)
|
||||
CFLAGS_SL = -fPIC -DPIC
|
||||
else
|
||||
CFLAGS_SL = -fpic -DPIC
|
||||
endif
|
||||
|
||||
|
||||
# Rule for building a shared library from a single .o file
|
||||
|
@ -7,11 +7,7 @@ endif
|
||||
|
||||
DLSUFFIX = .so
|
||||
|
||||
ifeq ($(findstring sparc,$(host_cpu)), sparc)
|
||||
CFLAGS_SL = -fPIC -DPIC
|
||||
else
|
||||
CFLAGS_SL = -fpic -DPIC
|
||||
endif
|
||||
|
||||
|
||||
# Rule for building a shared library from a single .o file
|
||||
|
Reference in New Issue
Block a user