Index: head/contrib/llvm/tools/lld/ELF/Config.h =================================================================== --- head/contrib/llvm/tools/lld/ELF/Config.h +++ head/contrib/llvm/tools/lld/ELF/Config.h @@ -156,6 +156,7 @@ bool ZExecstack; bool ZHazardplt; bool ZIfuncnoplt; + bool ZInterpose; bool ZNocopyreloc; bool ZNodelete; bool ZNodlopen; Index: head/contrib/llvm/tools/lld/ELF/Driver.cpp =================================================================== --- head/contrib/llvm/tools/lld/ELF/Driver.cpp +++ head/contrib/llvm/tools/lld/ELF/Driver.cpp @@ -670,6 +670,7 @@ 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"); Index: head/contrib/llvm/tools/lld/ELF/SyntheticSections.cpp =================================================================== --- head/contrib/llvm/tools/lld/ELF/SyntheticSections.cpp +++ head/contrib/llvm/tools/lld/ELF/SyntheticSections.cpp @@ -1034,6 +1034,8 @@ 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) Index: head/usr.bin/clang/lld/ld.lld.1 =================================================================== --- head/usr.bin/clang/lld/ld.lld.1 +++ head/usr.bin/clang/lld/ld.lld.1 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 22, 2018 +.Dd September 14, 2018 .Dt LD.LLD 1 .Os .Sh NAME @@ -450,6 +450,12 @@ 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.