Bug 230604

Summary: lld 7 does not support -z interpose [devel/valgrind, devel/valgrind-devel: fails to build with LLD 7]
Product: Base System Reporter: Jan Beich <jbeich>
Component: binAssignee: Ed Maste <emaste>
Status: Closed FIXED    
Severity: Affects Only Me CC: emaste
Priority: --- Keywords: patch
Version: CURRENTFlags: bdrewery: maintainer-feedback+
emaste: mfc-stable11?
emaste: mfc-stable10-
Hardware: Any   
OS: Any   
URL: https://reviews.freebsd.org/D17172
Bug Depends on:    
Bug Blocks: 214864, 230355    

Description Jan Beich freebsd_committer freebsd_triage 2018-08-13 21:44:23 UTC
$ poudriere jail -cj clang7 -a amd64 -v projects/clang700-import -m svn+https
$ poudriere testport -j clang7 devel/valgrind
[...]
ld: error: unknown -z value: interpose
cc: error: linker command failed with exit code 1 (use -v to see invocation)

http://package18.nyi.freebsd.org/data/headamd64PR230355-default/2018-08-11_19h01m06s/logs/errors/valgrind-3.10.1.20160113_5,1.log
http://package18.nyi.freebsd.org/data/headamd64PR230355-default/2018-08-11_19h01m06s/logs/errors/valgrind-devel-3.10.1.20160113_5,1.log
Comment 1 Jan Beich freebsd_committer freebsd_triage 2018-08-13 21:44:36 UTC
Can be worked around via LLD_UNSAFE.
Comment 2 Jan Beich freebsd_committer freebsd_triage 2018-08-13 21:57:32 UTC
rtld supports interpose since base r256101.
Comment 3 Bryan Drewery freebsd_committer freebsd_triage 2018-09-13 21:25:56 UTC
Adding LLD_UNSAFE=yes to the ports is approved by me once lld 7 is committed
and only if it lacks a fix for -z interpose.

Looking at my build log lld 6 is handling it fine.

cc -m64 -O2 -g -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -Wno-tautological-compare -fno-strict-aliasing -fno-builtin -O -g -fno-omit-frame-pointer -fno-strict-aliasing -fpic -fPIC -fno-builtin -Wno-long-lo
ng -O2 -pipe  -fstack-protector -fno-strict-aliasing -Wno-tautological-compare -Wno-cast-align -Wno-self-assign -fno-stack-protector -nodefaultlibs -shared -Wl,-z,interpose,-z,initfirst -m64 -Wl,--whole-archive ../coregrind/libreplacemalloc_toolpreload-amd64-freebsd.a -Wl,--no-whol
e-archive -fstack-protector -o vgpreload_exp-dhat-amd64-freebsd.so
cc -B/usr/lib32 -m32 -O2 -g -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -Wno-tautological-compare -fno-strict-aliasing -fno-builtin -O -g -fno-omit-frame-pointer -fno-strict-aliasing -fpic -fPIC -fno-builtin
 -Wno-long-long -O2 -pipe  -fstack-protector -fno-strict-aliasing -Wno-tautological-compare -Wno-cast-align -Wno-self-assign -fno-stack-protector -nodefaultlibs -shared -Wl,-z,interpose,-z,initfirst -B/usr/lib32 -m32 -Wl,--whole-archive ../coregrind/libreplacemalloc_toolpreload-x86
-freebsd.a -Wl,--no-whole-archive -fstack-protector -o vgpreload_exp-dhat-x86-freebsd.so
<no errors>

Ideally lld 7 regains -z interpose support instead.
Comment 4 Ed Maste freebsd_committer freebsd_triage 2018-09-14 12:46:10 UTC
Note that lld 6.0 does not support -z interpose; the issue is just that before 7.0 lld accepted but ignored unknown options, and now it disallows them.

It looks like "-z interpose" just has the effect of setting the DF_1_INTERPOSE flag, and should be easy to add to lld.
Comment 5 commit-hook freebsd_committer freebsd_triage 2018-09-14 15:15:27 UTC
A commit references this bug:

Author: emaste
Date: Fri Sep 14 15:15:17 UTC 2018
New revision: 338682
URL: https://svnweb.freebsd.org/changeset/base/338682

Log:
  lld: add -z interpose support

  -z interpose sets the DF_1_INTERPOSE flag, marking the object as an
  interposer.

  Committed upstream as LLVM r342239.

  PR:		230604
  Reported by:	jbeich
  Reviewed by:	markj
  Approved by:	re (kib)
  MFC after:	1 week
  Relnotes:	Yes
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D17172

Changes:
  head/contrib/llvm/tools/lld/ELF/Config.h
  head/contrib/llvm/tools/lld/ELF/Driver.cpp
  head/contrib/llvm/tools/lld/ELF/SyntheticSections.cpp
  head/usr.bin/clang/lld/ld.lld.1
Comment 6 commit-hook freebsd_committer freebsd_triage 2018-10-02 22:51:51 UTC
A commit references this bug:

Author: emaste
Date: Tue Oct  2 22:51:25 UTC 2018
New revision: 339100
URL: https://svnweb.freebsd.org/changeset/base/339100

Log:
  MFC r338682: lld: add -z interpose support

  -z interpose sets the DF_1_INTERPOSE flag, marking the object as an
  interposer.

  PR:		230604
  Relnotes:	Yes
  Sponsored by:	The FreeBSD Foundation

Changes:
_U  stable/11/
  stable/11/contrib/llvm/tools/lld/ELF/Config.h
  stable/11/contrib/llvm/tools/lld/ELF/Driver.cpp
  stable/11/contrib/llvm/tools/lld/ELF/SyntheticSections.cpp
  stable/11/usr.bin/clang/lld/ld.lld.1
Comment 7 Ed Maste freebsd_committer freebsd_triage 2018-10-04 01:28:18 UTC
Committed and merged to stable/11.
Comment 8 commit-hook freebsd_committer freebsd_triage 2018-10-26 21:20:37 UTC
A commit references this bug:

Author: dim
Date: Fri Oct 26 21:20:07 UTC 2018
New revision: 483054
URL: https://svnweb.freebsd.org/changeset/ports/483054

Log:
  Add all patches from base llvm/clang/lld/lldb 6.0 to devel/llvm60

  This adds all the patches that were applied in the past to head, under
  contrib/llvm.  After these, there only minimal diffs left between the
  port sources and the base sources.

  Most of these remaining diffs are due to #ifdef shortcuts in the base
  sources, because we don't compile certain features in.  Other diffs are
  because the port has applied a few changes that we don't have in base.

  While here, use Makefile.LICENSE from the devel/llvm-devel port.

  Approved by:	brooks (maintainer)
  Reviewed by:	brooks
  PR:		212343, 225128, 225471, 226388, 226658, 226872, 229050, 230444, 230604, 231355
  MFH:		2018Q4
  Differential Revision: https://reviews.freebsd.org/D17702

Changes:
  head/devel/llvm60/Makefile
  head/devel/llvm60/files/clang/patch-head-r331066.diff
  head/devel/llvm60/files/clang/patch-head-r336227.diff
  head/devel/llvm60/files/clang/patch-head-r338697.diff
  head/devel/llvm60/files/clang/patch-head-r339019.diff
  head/devel/llvm60/files/lld/
  head/devel/llvm60/files/lld/patch-head-r331731.diff
  head/devel/llvm60/files/lld/patch-head-r333401.diff
  head/devel/llvm60/files/lld/patch-head-r336664.diff
  head/devel/llvm60/files/lld/patch-head-r336972.diff
  head/devel/llvm60/files/lld/patch-head-r337282.diff
  head/devel/llvm60/files/lld/patch-head-r338251.diff
  head/devel/llvm60/files/lld/patch-head-r338682.diff
  head/devel/llvm60/files/lld/patch-head-r339013.diff
  head/devel/llvm60/files/lld/patch-head-r339304.diff
  head/devel/llvm60/files/lldb/
  head/devel/llvm60/files/lldb/patch-head-r332849.diff
  head/devel/llvm60/files/lldb/patch-head-r332965.diff
  head/devel/llvm60/files/patch-head-r308867.diff
  head/devel/llvm60/files/patch-head-r330686.diff
  head/devel/llvm60/files/patch-head-r331065.diff
  head/devel/llvm60/files/patch-head-r331366.diff
  head/devel/llvm60/files/patch-head-r336969.diff
  head/devel/llvm60/files/patch-head-r336970.diff
  head/devel/llvm60/files/patch-head-r337615.diff
  head/devel/llvm60/files/patch-head-r338689.diff
Comment 9 commit-hook freebsd_committer freebsd_triage 2018-10-31 18:49:49 UTC
A commit references this bug:

Author: dim
Date: Wed Oct 31 18:49:08 UTC 2018
New revision: 483602
URL: https://svnweb.freebsd.org/changeset/ports/483602

Log:
  MFH: r481120

  Update to a new snapshot.

  Update LICENSE data per mailing list feedback and move to a seperate
  Makefile.LICENSE for use by other llvm ports.

  MFH: r483054

  Add all patches from base llvm/clang/lld/lldb 6.0 to devel/llvm60

  This adds all the patches that were applied in the past to head, under
  contrib/llvm.  After these, there only minimal diffs left between the
  port sources and the base sources.

  Most of these remaining diffs are due to #ifdef shortcuts in the base
  sources, because we don't compile certain features in.  Other diffs are
  because the port has applied a few changes that we don't have in base.

  While here, use Makefile.LICENSE from the devel/llvm-devel port.

  Approved by:	portmgr (miwi)
  Reviewed by:	brooks
  PR:		212343, 225128, 225471, 226388, 226658, 226872, 229050, 230444, 230604, 231355
  Differential Revision: https://reviews.freebsd.org/D17702

Changes:
_U  branches/2018Q4/
  branches/2018Q4/devel/llvm-devel/Makefile
  branches/2018Q4/devel/llvm-devel/Makefile.LICENSE
  branches/2018Q4/devel/llvm-devel/Makefile.snapshot
  branches/2018Q4/devel/llvm-devel/distinfo
  branches/2018Q4/devel/llvm-devel/files/lldb-patch-tools_lldb_source_Plugins_Process_FreeBSD_ProcessFreeBSD.cpp
  branches/2018Q4/devel/llvm-devel/pkg-plist
  branches/2018Q4/devel/llvm60/Makefile
  branches/2018Q4/devel/llvm60/files/clang/patch-head-r331066.diff
  branches/2018Q4/devel/llvm60/files/clang/patch-head-r336227.diff
  branches/2018Q4/devel/llvm60/files/clang/patch-head-r338697.diff
  branches/2018Q4/devel/llvm60/files/clang/patch-head-r339019.diff
  branches/2018Q4/devel/llvm60/files/lld/
  branches/2018Q4/devel/llvm60/files/lldb/
  branches/2018Q4/devel/llvm60/files/patch-head-r308867.diff
  branches/2018Q4/devel/llvm60/files/patch-head-r330686.diff
  branches/2018Q4/devel/llvm60/files/patch-head-r331065.diff
  branches/2018Q4/devel/llvm60/files/patch-head-r331366.diff
  branches/2018Q4/devel/llvm60/files/patch-head-r336969.diff
  branches/2018Q4/devel/llvm60/files/patch-head-r336970.diff
  branches/2018Q4/devel/llvm60/files/patch-head-r337615.diff
  branches/2018Q4/devel/llvm60/files/patch-head-r338689.diff
Comment 10 commit-hook freebsd_committer freebsd_triage 2018-11-01 17:48:32 UTC
A commit references this bug:

Author: brooks
Date: Thu Nov  1 17:47:34 UTC 2018
New revision: 483690
URL: https://svnweb.freebsd.org/changeset/ports/483690

Log:
  Add all patches from base llvm/clang/lld/lldb 7.0 to devel/llvm70

  This adds all the patches that were applied in the past to the
  clang700-import branch, under contrib/llvm. After these, there only
  minimal diffs left between the port sources and the base sources.

  Most of these remaining diffs are due to #ifdef shortcuts in the base
  sources, because we don't compile certain features in. Other diffs are
  because the port has applied a few changes that we don't have in base.

  Also switch to the common LICENSE defintion in devel/llvm-devel and
  chase new USE_GNOME requirements (for libxml2).

  PR:	212343, 230604
  Submitted by:	dim
  MFH:		2018Q4
  Differential Revision:	https://reviews.freebsd.org/D17709

Changes:
  head/devel/llvm70/Makefile
  head/devel/llvm70/files/clang/patch-head-r339019.diff
  head/devel/llvm70/files/lld/
  head/devel/llvm70/files/lld/patch-head-r337282.diff
  head/devel/llvm70/files/lld/patch-head-r338297.diff
  head/devel/llvm70/files/lld/patch-head-r338682.diff
  head/devel/llvm70/files/lld/patch-head-r339304.diff
  head/devel/llvm70/files/lld/patch-lld-manpage.diff
  head/devel/llvm70/files/lldb/
  head/devel/llvm70/files/lldb/patch-head-r332965.diff
  head/devel/llvm70/files/patch-head-r308867.diff