Bug 224442 - lang/php56: contains relocations in read-only segment
Summary: lang/php56: contains relocations in read-only segment
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: Alex Dupre
URL: https://reviews.freebsd.org/D17193
Keywords:
: 230207 (view as bug list)
Depends on:
Blocks: 214864
  Show dependency treegraph
 
Reported: 2017-12-19 02:18 UTC by Ed Maste
Modified: 2018-09-18 16:10 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Maste freebsd_committer freebsd_triage 2017-12-19 02:18:40 UTC
Testing in the i386 lld exp-run found a number of instances of read-only segments (presumably .text) containing relocations, which is undesirable.

For example:

/usr/bin/ld: error: can't create dynamic relocation R_386_32 against symbol: php_date_global_timezone_db in readonly segment
>>> defined in ext/date/.libs/php_date.o
>>> referenced by /wrkdirs/usr/ports/lang/php56/work/php-5.6.32/ext/date/php_date.c
>>>               ext/date/.libs/php_date.o:(zif_strtotime)

/usr/bin/ld: error: can't create dynamic relocation R_386_32 against symbol: php_date_global_timezone_db in readonly segment
>>> defined in ext/date/.libs/php_date.o
>>> referenced by /wrkdirs/usr/ports/lang/php56/work/php-5.6.32/ext/date/php_date.c
>>>               ext/date/.libs/php_date.o:(zif_strtotime)

Simple workaround is to add LDFLAGS+=-Wl,-z,notext which turns off lld's error for read-only segment relocations, matching ld.bfd and ld.gold's behaviour, but it's best if the underlying cause is fixed.
Comment 2 Ed Maste freebsd_committer freebsd_triage 2018-09-05 14:35:51 UTC
*** Bug 230207 has been marked as a duplicate of this bug. ***
Comment 3 Ed Maste freebsd_committer freebsd_triage 2018-09-18 16:10:20 UTC
Author: emaste
Date: Tue Sep 18 16:08:02 UTC 2018
New revision: 480035
URL: https://svnweb.freebsd.org/changeset/ports/480035

Log:
  lang/php*: link with -znotext on i386

  This port links some non-PIC code, which fails with lld as it defaults
  to disallowing relocations against read-only segments. For i386 we can
  just add -znotext unconditionally: for GNU BFD ld it just affirms BFD's
  existing default.

  PR:		214864, 230207
  Approved by:	bapt
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D17193

Changes:
  head/lang/php56/Makefile
  head/lang/php70/Makefile
  head/lang/php71/Makefile
  head/lang/php72/Makefile