aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2018-07-09 17:23:31 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2018-07-09 17:23:31 -0400
commitc74f48a4ec54c36b515f85a6b779a4751b7070b7 (patch)
tree28221d10f99d0b922cfe23496b7e9eddaf1b42f9 /contrib
parentb0da7ecad332244364152ff6f00fd0ceb8733781 (diff)
downloadpostgresql-c74f48a4ec54c36b515f85a6b779a4751b7070b7.tar.gz
postgresql-c74f48a4ec54c36b515f85a6b779a4751b7070b7.zip
Prevent accidental linking of system-supplied copies of libpq.so etc.
Back-patch commit dddfc4cb2, which broke LDFLAGS and related Makefile variables into two parts, one for within-build-tree library references and one for external libraries, to ensure that the order of -L flags has all of the former before all of the latter. This turns out to fix a problem recently noted on buildfarm member peripatus, that we attempted to incorporate code from libpgport.a into a shared library. That will fail on platforms that are sticky about putting non-PIC code into shared libraries. (It's quite surprising we hadn't seen such failures before, since the code in question has been like that for a long time.) I think that peripatus' problem could have been fixed with just a subset of this patch; but since the previous issue of accidentally linking to the wrong copy of a Postgres shlib seems likely to bite people in the field, let's just back-patch the whole change. Now that commit dddfc4cb2 has survived some beta testing, I'm less afraid to back-patch it than I was at the time. This also fixes undesired inclusion of "-DFRONTEND" in pg_config's CPPFLAGS output (in 9.6 and up) and undesired inclusion of "-L../../src/common" in its LDFLAGS output (in all supported branches). Back-patch to v10 and older branches; this is already in v11. Discussion: https://postgr.es/m/20180704234304.bq2dxispefl65odz@ler-imac.local
Diffstat (limited to 'contrib')
-rw-r--r--contrib/dblink/Makefile2
-rw-r--r--contrib/hstore_plperl/Makefile2
-rw-r--r--contrib/hstore_plpython/Makefile2
-rw-r--r--contrib/ltree_plpython/Makefile2
-rw-r--r--contrib/oid2name/Makefile2
-rw-r--r--contrib/postgres_fdw/Makefile2
-rw-r--r--contrib/spi/Makefile2
-rw-r--r--contrib/vacuumlo/Makefile2
8 files changed, 7 insertions, 9 deletions
diff --git a/contrib/dblink/Makefile b/contrib/dblink/Makefile
index 5189758dabf..b1a5e063837 100644
--- a/contrib/dblink/Makefile
+++ b/contrib/dblink/Makefile
@@ -3,7 +3,7 @@
MODULE_big = dblink
OBJS = dblink.o $(WIN32RES)
PG_CPPFLAGS = -I$(libpq_srcdir)
-SHLIB_LINK = $(libpq)
+SHLIB_LINK_INTERNAL = $(libpq)
EXTENSION = dblink
DATA = dblink--1.2.sql dblink--1.1--1.2.sql dblink--1.0--1.1.sql \
diff --git a/contrib/hstore_plperl/Makefile b/contrib/hstore_plperl/Makefile
index c0906db1f55..f63cba27456 100644
--- a/contrib/hstore_plperl/Makefile
+++ b/contrib/hstore_plperl/Makefile
@@ -28,7 +28,7 @@ ifeq ($(PORTNAME), win32)
# these settings are the same as for plperl
override CPPFLAGS += -DPLPERL_HAVE_UID_GID -Wno-comment
# ... see silliness in plperl Makefile ...
-SHLIB_LINK += $(sort $(wildcard ../../src/pl/plperl/libperl*.a))
+SHLIB_LINK_INTERNAL += $(sort $(wildcard ../../src/pl/plperl/libperl*.a))
else
rpathdir = $(perl_archlibexp)/CORE
SHLIB_LINK += $(perl_embed_ldflags)
diff --git a/contrib/hstore_plpython/Makefile b/contrib/hstore_plpython/Makefile
index 7ff787a22e4..b81735ab910 100644
--- a/contrib/hstore_plpython/Makefile
+++ b/contrib/hstore_plpython/Makefile
@@ -26,7 +26,7 @@ endif
# We must link libpython explicitly
ifeq ($(PORTNAME), win32)
# ... see silliness in plpython Makefile ...
-SHLIB_LINK += $(sort $(wildcard ../../src/pl/plpython/libpython*.a))
+SHLIB_LINK_INTERNAL += $(sort $(wildcard ../../src/pl/plpython/libpython*.a))
else
rpathdir = $(python_libdir)
SHLIB_LINK += $(python_libspec) $(python_additional_libs)
diff --git a/contrib/ltree_plpython/Makefile b/contrib/ltree_plpython/Makefile
index bc7502b8c32..7e988c79935 100644
--- a/contrib/ltree_plpython/Makefile
+++ b/contrib/ltree_plpython/Makefile
@@ -26,7 +26,7 @@ endif
# We must link libpython explicitly
ifeq ($(PORTNAME), win32)
# ... see silliness in plpython Makefile ...
-SHLIB_LINK += $(sort $(wildcard ../../src/pl/plpython/libpython*.a))
+SHLIB_LINK_INTERNAL += $(sort $(wildcard ../../src/pl/plpython/libpython*.a))
else
rpathdir = $(python_libdir)
SHLIB_LINK += $(python_libspec) $(python_additional_libs)
diff --git a/contrib/oid2name/Makefile b/contrib/oid2name/Makefile
index 3414b4a5cca..3eef8f60bea 100644
--- a/contrib/oid2name/Makefile
+++ b/contrib/oid2name/Makefile
@@ -7,7 +7,7 @@ PROGRAM = oid2name
OBJS = oid2name.o $(WIN32RES)
PG_CPPFLAGS = -I$(libpq_srcdir)
-PG_LIBS = $(libpq_pgport)
+PG_LIBS_INTERNAL = $(libpq_pgport)
ifdef USE_PGXS
PG_CONFIG = pg_config
diff --git a/contrib/postgres_fdw/Makefile b/contrib/postgres_fdw/Makefile
index 354331247a8..85394b4f1f0 100644
--- a/contrib/postgres_fdw/Makefile
+++ b/contrib/postgres_fdw/Makefile
@@ -5,7 +5,7 @@ OBJS = postgres_fdw.o option.o deparse.o connection.o shippable.o $(WIN32RES)
PGFILEDESC = "postgres_fdw - foreign data wrapper for PostgreSQL"
PG_CPPFLAGS = -I$(libpq_srcdir)
-SHLIB_LINK = $(libpq)
+SHLIB_LINK_INTERNAL = $(libpq)
EXTENSION = postgres_fdw
DATA = postgres_fdw--1.0.sql
diff --git a/contrib/spi/Makefile b/contrib/spi/Makefile
index 10ab5bb5fef..42aa3740c42 100644
--- a/contrib/spi/Makefile
+++ b/contrib/spi/Makefile
@@ -17,8 +17,6 @@ DOCS = $(addsuffix .example, $(MODULES))
# comment out if you want a quieter refint package for other uses
PG_CPPFLAGS = -DREFINT_VERBOSE
-LDFLAGS_SL += -L$(top_builddir)/src/port -lpgport
-
ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
diff --git a/contrib/vacuumlo/Makefile b/contrib/vacuumlo/Makefile
index b4ba896fba9..71106ff69c6 100644
--- a/contrib/vacuumlo/Makefile
+++ b/contrib/vacuumlo/Makefile
@@ -7,7 +7,7 @@ PROGRAM = vacuumlo
OBJS = vacuumlo.o $(WIN32RES)
PG_CPPFLAGS = -I$(libpq_srcdir)
-PG_LIBS = $(libpq_pgport)
+PG_LIBS_INTERNAL = $(libpq_pgport)
ifdef USE_PGXS
PG_CONFIG = pg_config