Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Sep 2018 15:15:17 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r338682 - in head: contrib/llvm/tools/lld/ELF usr.bin/clang/lld
Message-ID:  <201809141515.w8EFFH9t018804@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Fri Sep 14 15:15:16 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

Modified:
  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

Modified: head/contrib/llvm/tools/lld/ELF/Config.h
==============================================================================
--- head/contrib/llvm/tools/lld/ELF/Config.h	Fri Sep 14 14:40:09 2018	(r338681)
+++ head/contrib/llvm/tools/lld/ELF/Config.h	Fri Sep 14 15:15:16 2018	(r338682)
@@ -156,6 +156,7 @@ struct Configuration {
   bool ZExecstack;
   bool ZHazardplt;
   bool ZIfuncnoplt;
+  bool ZInterpose;
   bool ZNocopyreloc;
   bool ZNodelete;
   bool ZNodlopen;

Modified: head/contrib/llvm/tools/lld/ELF/Driver.cpp
==============================================================================
--- head/contrib/llvm/tools/lld/ELF/Driver.cpp	Fri Sep 14 14:40:09 2018	(r338681)
+++ head/contrib/llvm/tools/lld/ELF/Driver.cpp	Fri Sep 14 15:15:16 2018	(r338682)
@@ -670,6 +670,7 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args
   Config->ZExecstack = hasZOption(Args, "execstack");
   Config->ZHazardplt = hasZOption(Args, "hazardplt");
   Config->ZIfuncnoplt = hasZOption(Args, "ifunc-noplt");
+  Config->ZInterpose = hasZOption(Args, "interpose");
   Config->ZNocopyreloc = hasZOption(Args, "nocopyreloc");
   Config->ZNodelete = hasZOption(Args, "nodelete");
   Config->ZNodlopen = hasZOption(Args, "nodlopen");

Modified: head/contrib/llvm/tools/lld/ELF/SyntheticSections.cpp
==============================================================================
--- head/contrib/llvm/tools/lld/ELF/SyntheticSections.cpp	Fri Sep 14 14:40:09 2018	(r338681)
+++ head/contrib/llvm/tools/lld/ELF/SyntheticSections.cpp	Fri Sep 14 15:15:16 2018	(r338682)
@@ -1034,6 +1034,8 @@ template <class ELFT> void DynamicSection<ELFT>::final
   uint32_t DtFlags1 = 0;
   if (Config->Bsymbolic)
     DtFlags |= DF_SYMBOLIC;
+  if (Config->ZInterpose)
+    DtFlags1 |= DF_1_INTERPOSE;
   if (Config->ZNodelete)
     DtFlags1 |= DF_1_NODELETE;
   if (Config->ZNodlopen)

Modified: head/usr.bin/clang/lld/ld.lld.1
==============================================================================
--- head/usr.bin/clang/lld/ld.lld.1	Fri Sep 14 14:40:09 2018	(r338681)
+++ head/usr.bin/clang/lld/ld.lld.1	Fri Sep 14 15:15:16 2018	(r338682)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 22, 2018
+.Dd September 14, 2018
 .Dt LD.LLD 1
 .Os
 .Sh NAME
@@ -450,6 +450,12 @@ be applied by a run-time loader.
 Note that this feature requires special loader support and will
 generally result in application crashes when used outside of freestanding
 environments.
+.It Cm interpose
+Set the
+.Dv DF_1_INTERPOSE
+flag to indicate that the object is an interposer.
+Runtime linkers perform symbol resolution by first searching the application,
+followed by interposers, and then any other dependencies.
 .It Cm muldefs
 Do not error if a symbol is defined multiple times.
 The first definition will be used.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201809141515.w8EFFH9t018804>