r338682 | emaste | 2018-09-14 17:15:16 +0200 (Fri, 14 Sep 2018) | 16 lines 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 Index: tools/lld/ELF/Config.h =================================================================== --- tools/lld/ELF/Config.h (revision 338681) +++ tools/lld/ELF/Config.h (revision 338682) @@ -156,6 +156,7 @@ struct Configuration { bool ZExecstack; bool ZHazardplt; bool ZIfuncnoplt; + bool ZInterpose; bool ZNocopyreloc; bool ZNodelete; bool ZNodlopen; Index: tools/lld/ELF/Driver.cpp =================================================================== --- tools/lld/ELF/Driver.cpp (revision 338681) +++ tools/lld/ELF/Driver.cpp (revision 338682) @@ -670,6 +670,7 @@ void LinkerDriver::readConfigs(opt::InputArgList & 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: tools/lld/ELF/SyntheticSections.cpp =================================================================== --- tools/lld/ELF/SyntheticSections.cpp (revision 338681) +++ tools/lld/ELF/SyntheticSections.cpp (revision 338682) @@ -1034,6 +1034,8 @@ template void DynamicSection::f 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)