Bug 229523 - databases/postgresql10-server: remove LLD_UNSAFE, add -Wl,-z,notext to allow build with lld
Summary: databases/postgresql10-server: remove LLD_UNSAFE, add -Wl,-z,notext to allow ...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: pgsql
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-05 01:28 UTC by Larry Rosenman
Modified: 2018-09-25 15:57 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (pgsql)


Attachments
Makefile patch (579 bytes, patch)
2018-07-05 01:28 UTC, Larry Rosenman
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Larry Rosenman freebsd_committer freebsd_triage 2018-07-05 01:28:26 UTC
Created attachment 194883 [details]
Makefile patch

In BZ 21978, emaste suggested this change, and I've now tested it, and it fixes the build problem. 

I assume we want as many ports using lld(ld.lld) as opposed to ld.bfd.
Comment 1 Larry Rosenman freebsd_committer freebsd_triage 2018-07-05 01:38:50 UTC
Err the bug reference is https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219758
Comment 2 Larry Rosenman freebsd_committer freebsd_triage 2018-07-07 19:16:40 UTC
Hold off on this.  The PostgreSQL guys have a patch that they are going to back-patch to V10, and the active 9.x branches.  The next minor releases and V11 (which already has the fix) won't need LLD_UNSAFE, and won't need the -Wl,-z,notext at all.
Comment 3 Larry Rosenman freebsd_committer freebsd_triage 2018-07-09 22:19:17 UTC
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


The next minor releases should have this fix, and allow you to remove LLD_UNSAFE and not do anything else.
Comment 4 Larry Rosenman freebsd_committer freebsd_triage 2018-07-10 02:34:10 UTC
For the record, peripatus is my -CURRENT box :)
Comment 5 Larry Rosenman freebsd_committer freebsd_triage 2018-08-09 16:03:04 UTC
as of today's releases, we should no longer need LLD_UNSAFE.

10.5, 9.6.10, 9.5.14, 9.4.19, 9.3.24
Comment 6 Palle Girgensohn freebsd_committer freebsd_triage 2018-08-10 09:09:31 UTC
Excellent, thanks for this! I'm committing updates to the new versions without the LLD_UNSAFE.
Comment 7 commit-hook freebsd_committer freebsd_triage 2018-08-10 09:25:39 UTC
A commit references this bug:

Author: girgen
Date: Fri Aug 10 09:25:24 UTC 2018
New revision: 476819
URL: https://svnweb.freebsd.org/changeset/ports/476819

Log:
  The PostgreSQL Global Development Group has released an update to all supported
  versions of our database system, including 10.5, 9.6.10, 9.5.14, 9.4.19,
  9.3.24.  This release fixes two security issues as well as bugs reported over
  the last three months.

  If you have untrusted users accessing your system and you are either running
  PostgreSQL 9.5 or a newer version OR have installed the "dblink" or
  "postgres_fdw" extensions, you must apply this update as soon as possible. All
  other users can upgrade at the next convenient downtime.

  Please note that PostgreSQL changed its versioning scheme with the release of
  version 10.0, so updating to version 10.5 from any 10.x release is considered a
  minor update.

  The PostgreSQL Global Development Group also announces that the third beta
  release of PostgreSQL 11 is now available for download. This release contains
  previews of all features that will be available in the final release of
  PostgreSQL 11 (though some details of the release could change before then) as
  well as bug fixes that were reported during the second beta.

  This release also changes the default option for the server packages to *not*
  include XML support per default. If you need this, please check the XML option
  knob and build the port.

  Releasenotes:	https://www.postgresql.org/about/news/1878/
  PR:		229523, 198588
  Security:	96eab874-9c79-11e8-b34b-6cc21735f730
  Security:	CVE-2018-10915, CVE-2018-10925

Changes:
  head/UPDATING
  head/databases/postgresql10-server/Makefile
  head/databases/postgresql10-server/distinfo
  head/databases/postgresql10-server/pkg-plist-client
  head/databases/postgresql10-server/pkg-plist-server
  head/databases/postgresql93-server/Makefile
  head/databases/postgresql93-server/distinfo
  head/databases/postgresql93-server/pkg-plist-client
  head/databases/postgresql94-server/Makefile
  head/databases/postgresql94-server/distinfo
  head/databases/postgresql94-server/pkg-plist-client
  head/databases/postgresql94-server/pkg-plist-server
  head/databases/postgresql95-server/Makefile
  head/databases/postgresql95-server/distinfo
  head/databases/postgresql95-server/pkg-plist-client
  head/databases/postgresql95-server/pkg-plist-server
  head/databases/postgresql96-server/Makefile
  head/databases/postgresql96-server/distinfo
  head/databases/postgresql96-server/pkg-plist-client
  head/databases/postgresql96-server/pkg-plist-server
Comment 8 commit-hook freebsd_committer freebsd_triage 2018-09-25 15:57:40 UTC
A commit references this bug:

Author: girgen
Date: Tue Sep 25 15:57:10 UTC 2018
New revision: 480671
URL: https://svnweb.freebsd.org/changeset/ports/480671

Log:
  MFH: r476819

  The PostgreSQL Global Development Group has released an update to all supported
  versions of our database system, including 10.5, 9.6.10, 9.5.14, 9.4.19,
  9.3.24.  This release fixes two security issues as well as bugs reported over
  the last three months.

  If you have untrusted users accessing your system and you are either running
  PostgreSQL 9.5 or a newer version OR have installed the "dblink" or
  "postgres_fdw" extensions, you must apply this update as soon as possible. All
  other users can upgrade at the next convenient downtime.

  Please note that PostgreSQL changed its versioning scheme with the release of
  version 10.0, so updating to version 10.5 from any 10.x release is considered a
  minor update.

  The PostgreSQL Global Development Group also announces that the third beta
  release of PostgreSQL 11 is now available for download. This release contains
  previews of all features that will be available in the final release of
  PostgreSQL 11 (though some details of the release could change before then) as
  well as bug fixes that were reported during the second beta.

  This release also changes the default option for the server packages to *not*
  include XML support per default. If you need this, please check the XML option
  knob and build the port.

  Releasenotes:	https://www.postgresql.org/about/news/1878/
  PR:		229523, 198588
  Security:	96eab874-9c79-11e8-b34b-6cc21735f730
  Security:	CVE-2018-10915, CVE-2018-10925

  Approved by:	ports-secteam

Changes:
_U  branches/2018Q3/
  branches/2018Q3/UPDATING
  branches/2018Q3/databases/postgresql10-server/Makefile
  branches/2018Q3/databases/postgresql10-server/distinfo
  branches/2018Q3/databases/postgresql10-server/pkg-plist-client
  branches/2018Q3/databases/postgresql10-server/pkg-plist-server
  branches/2018Q3/databases/postgresql93-server/Makefile
  branches/2018Q3/databases/postgresql93-server/distinfo
  branches/2018Q3/databases/postgresql93-server/pkg-plist-client
  branches/2018Q3/databases/postgresql94-server/Makefile
  branches/2018Q3/databases/postgresql94-server/distinfo
  branches/2018Q3/databases/postgresql94-server/pkg-plist-client
  branches/2018Q3/databases/postgresql94-server/pkg-plist-server
  branches/2018Q3/databases/postgresql95-server/Makefile
  branches/2018Q3/databases/postgresql95-server/distinfo
  branches/2018Q3/databases/postgresql95-server/pkg-plist-client
  branches/2018Q3/databases/postgresql95-server/pkg-plist-server
  branches/2018Q3/databases/postgresql96-server/Makefile
  branches/2018Q3/databases/postgresql96-server/distinfo
  branches/2018Q3/databases/postgresql96-server/pkg-plist-client
  branches/2018Q3/databases/postgresql96-server/pkg-plist-server