diff options
| author | Tom Lane | 2018-07-09 21:23:32 +0000 |
|---|---|---|
| committer | Tom Lane | 2018-07-09 21:23:32 +0000 |
| commit | dd4e836748cec3e361e3b52243137960557a000d (patch) | |
| tree | 4ecadc3a9769984c06d8e097a527c8164ab59c67 /contrib | |
| parent | f352f43d3f10a8491035cc3ccd6f85aa6215aead (diff) | |
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/Makefile | 2 | ||||
| -rw-r--r-- | contrib/oid2name/Makefile | 2 | ||||
| -rw-r--r-- | contrib/pgbench/Makefile | 3 | ||||
| -rw-r--r-- | contrib/postgres_fdw/Makefile | 2 | ||||
| -rw-r--r-- | contrib/spi/Makefile | 2 | ||||
| -rw-r--r-- | contrib/vacuumlo/Makefile | 2 |
6 files changed, 6 insertions, 7 deletions
diff --git a/contrib/dblink/Makefile b/contrib/dblink/Makefile index e833b9203ac..a5b59c6b41f 100644 --- a/contrib/dblink/Makefile +++ b/contrib/dblink/Makefile @@ -3,7 +3,7 @@ MODULE_big = dblink OBJS = dblink.o PG_CPPFLAGS = -I$(libpq_srcdir) -SHLIB_LINK = $(libpq) +SHLIB_LINK_INTERNAL = $(libpq) EXTENSION = dblink DATA = dblink--1.1.sql dblink--1.0--1.1.sql dblink--unpackaged--1.0.sql diff --git a/contrib/oid2name/Makefile b/contrib/oid2name/Makefile index f695b4a84e1..b41f8af6661 100644 --- a/contrib/oid2name/Makefile +++ b/contrib/oid2name/Makefile @@ -7,7 +7,7 @@ PROGRAM = oid2name OBJS = oid2name.o 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/pgbench/Makefile b/contrib/pgbench/Makefile index b8f5fb467f6..d6fbdcc0d69 100644 --- a/contrib/pgbench/Makefile +++ b/contrib/pgbench/Makefile @@ -7,7 +7,8 @@ PROGRAM = pgbench OBJS = pgbench.o PG_CPPFLAGS = -I$(libpq_srcdir) -PG_LIBS = $(libpq_pgport) $(PTHREAD_LIBS) +PG_LIBS_INTERNAL = $(libpq_pgport) +PG_LIBS = $(PTHREAD_LIBS) ifdef USE_PGXS PG_CONFIG = pg_config diff --git a/contrib/postgres_fdw/Makefile b/contrib/postgres_fdw/Makefile index c0f4160f6ba..bfb2e1d7681 100644 --- a/contrib/postgres_fdw/Makefile +++ b/contrib/postgres_fdw/Makefile @@ -4,7 +4,7 @@ MODULE_big = postgres_fdw OBJS = postgres_fdw.o option.o deparse.o connection.o 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 0c11bfcbbd4..f6ffe71c020 100644 --- a/contrib/spi/Makefile +++ b/contrib/spi/Makefile @@ -16,8 +16,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 b658f9bf6f8..ccb7d074085 100644 --- a/contrib/vacuumlo/Makefile +++ b/contrib/vacuumlo/Makefile @@ -7,7 +7,7 @@ PROGRAM = vacuumlo OBJS = vacuumlo.o PG_CPPFLAGS = -I$(libpq_srcdir) -PG_LIBS = $(libpq_pgport) +PG_LIBS_INTERNAL = $(libpq_pgport) ifdef USE_PGXS PG_CONFIG = pg_config |
