Index: contrib/llvm/tools/lld/ELF/Config.h =================================================================== --- contrib/llvm/tools/lld/ELF/Config.h +++ 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: contrib/llvm/tools/lld/ELF/Driver.cpp =================================================================== --- contrib/llvm/tools/lld/ELF/Driver.cpp +++ contrib/llvm/tools/lld/ELF/Driver.cpp @@ -672,6 +672,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: contrib/llvm/tools/lld/ELF/SyntheticSections.cpp =================================================================== --- contrib/llvm/tools/lld/ELF/SyntheticSections.cpp +++ contrib/llvm/tools/lld/ELF/SyntheticSections.cpp @@ -1190,6 +1190,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: usr.bin/clang/lld/ld.lld.1 =================================================================== --- usr.bin/clang/lld/ld.lld.1 +++ 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 inticate 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.