summaryrefslogtreecommitdiff
path: root/devel/llvm60/files/lld
diff options
context:
space:
mode:
Diffstat (limited to 'devel/llvm60/files/lld')
-rw-r--r--devel/llvm60/files/lld/patch-head-r331731.diff67
-rw-r--r--devel/llvm60/files/lld/patch-head-r333401.diff34
-rw-r--r--devel/llvm60/files/lld/patch-head-r336664.diff52
-rw-r--r--devel/llvm60/files/lld/patch-head-r336972.diff146
-rw-r--r--devel/llvm60/files/lld/patch-head-r337282.diff39
-rw-r--r--devel/llvm60/files/lld/patch-head-r338251.diff123
-rw-r--r--devel/llvm60/files/lld/patch-head-r338682.diff55
-rw-r--r--devel/llvm60/files/lld/patch-head-r339013.diff39
-rw-r--r--devel/llvm60/files/lld/patch-head-r339304.diff37
9 files changed, 592 insertions, 0 deletions
diff --git a/devel/llvm60/files/lld/patch-head-r331731.diff b/devel/llvm60/files/lld/patch-head-r331731.diff
new file mode 100644
index 000000000000..6b162d89f6be
--- /dev/null
+++ b/devel/llvm60/files/lld/patch-head-r331731.diff
@@ -0,0 +1,67 @@
+r331731 | dim | 2018-03-29 15:55:23 +0200 (Thu, 29 Mar 2018) | 22 lines
+
+Pull in r328738 from upstream lld trunk (by Rafael Espindola):
+
+ Strip @VER suffices from the LTO output.
+
+ This fixes pr36623.
+
+ The problem is that we have to parse versions out of names before LTO
+ so that LTO can use that information.
+
+ When we get the LTO produced .o files, we replace the previous symbols
+ with the LTO produced ones, but they still have @ in their names.
+
+ We could just trim the name directly, but calling parseSymbolVersion
+ to do it is simpler.
+
+This is a follow-up to r331366, since we discovered that lld could
+append version strings to symbols twice, when using Link Time
+Optimization.
+
+MFC after: 3 months
+X-MFC-With: r327952
+
+Index: tools/lld/ELF/InputFiles.cpp
+===================================================================
+--- tools/lld/ELF/InputFiles.cpp (revision 331730)
++++ tools/lld/ELF/InputFiles.cpp (revision 331731)
+@@ -281,6 +281,10 @@ template <class ELFT> ArrayRef<Symbol *> ObjFile<E
+ return makeArrayRef(this->Symbols).slice(1, this->FirstNonLocal - 1);
+ }
+
++template <class ELFT> ArrayRef<Symbol *> ObjFile<ELFT>::getGlobalSymbols() {
++ return makeArrayRef(this->Symbols).slice(this->FirstNonLocal);
++}
++
+ template <class ELFT>
+ void ObjFile<ELFT>::parse(DenseSet<CachedHashStringRef> &ComdatGroups) {
+ // Read section and symbol tables.
+Index: tools/lld/ELF/InputFiles.h
+===================================================================
+--- tools/lld/ELF/InputFiles.h (revision 331730)
++++ tools/lld/ELF/InputFiles.h (revision 331731)
+@@ -167,6 +167,7 @@ template <class ELFT> class ObjFile : public ELFFi
+ static bool classof(const InputFile *F) { return F->kind() == Base::ObjKind; }
+
+ ArrayRef<Symbol *> getLocalSymbols();
++ ArrayRef<Symbol *> getGlobalSymbols();
+
+ ObjFile(MemoryBufferRef M, StringRef ArchiveName);
+ void parse(llvm::DenseSet<llvm::CachedHashStringRef> &ComdatGroups);
+Index: tools/lld/ELF/SymbolTable.cpp
+===================================================================
+--- tools/lld/ELF/SymbolTable.cpp (revision 331730)
++++ tools/lld/ELF/SymbolTable.cpp (revision 331731)
+@@ -130,7 +130,10 @@ template <class ELFT> void SymbolTable::addCombine
+
+ for (InputFile *File : LTO->compile()) {
+ DenseSet<CachedHashStringRef> DummyGroups;
+- cast<ObjFile<ELFT>>(File)->parse(DummyGroups);
++ auto *Obj = cast<ObjFile<ELFT>>(File);
++ Obj->parse(DummyGroups);
++ for (Symbol *Sym : Obj->getGlobalSymbols())
++ Sym->parseSymbolVersion();
+ ObjectFiles.push_back(File);
+ }
+ }
diff --git a/devel/llvm60/files/lld/patch-head-r333401.diff b/devel/llvm60/files/lld/patch-head-r333401.diff
new file mode 100644
index 000000000000..131f6a0ea274
--- /dev/null
+++ b/devel/llvm60/files/lld/patch-head-r333401.diff
@@ -0,0 +1,34 @@
+r333401 | emaste | 2018-05-09 13:17:01 +0200 (Wed, 09 May 2018) | 19 lines
+
+lld: Omit PT_NOTE for SHT_NOTE without SHF_ALLOC
+
+A non-alloc note section should not have a PT_NOTE program header.
+
+Found while linking ghc (Haskell compiler) with lld on FreeBSD. Haskell
+emits a .debug-ghc-link-info note section (as the name suggests, it
+contains link info) as a SHT_NOTE section without SHF_ALLOC set.
+
+For this case ld.bfd does not emit a PT_NOTE segment for
+.debug-ghc-link-info. lld previously emitted a PT_NOTE with p_vaddr = 0
+and FreeBSD's rtld segfaulted when trying to parse a note at address 0.
+
+LLVM PR: https://llvm.org/pr37361
+LLVM review: https://reviews.llvm.org/D46623
+
+PR: 226872
+Reviewed by: dim
+Sponsored by: The FreeBSD Foundation
+
+Index: tools/lld/ELF/Writer.cpp
+===================================================================
+--- tools/lld/ELF/Writer.cpp (revision 333400)
++++ tools/lld/ELF/Writer.cpp (revision 333401)
+@@ -1708,7 +1708,7 @@ template <class ELFT> std::vector<PhdrEntry *> Wri
+ // Create one PT_NOTE per a group of contiguous .note sections.
+ PhdrEntry *Note = nullptr;
+ for (OutputSection *Sec : OutputSections) {
+- if (Sec->Type == SHT_NOTE) {
++ if (Sec->Type == SHT_NOTE && (Sec->Flags & SHF_ALLOC)) {
+ if (!Note || Sec->LMAExpr)
+ Note = AddHdr(PT_NOTE, PF_R);
+ Note->add(Sec);
diff --git a/devel/llvm60/files/lld/patch-head-r336664.diff b/devel/llvm60/files/lld/patch-head-r336664.diff
new file mode 100644
index 000000000000..e26fd06d4c5e
--- /dev/null
+++ b/devel/llvm60/files/lld/patch-head-r336664.diff
@@ -0,0 +1,52 @@
+r336664 | emaste | 2018-07-24 13:35:22 +0200 (Tue, 24 Jul 2018) | 11 lines
+
+lld: fix addends with partial linking
+
+[ELF] Update addends in non-allocatable sections for REL targets when
+creating a relocatable output.
+
+LLVM PR: 37735
+LLVM Differential Revision: https://reviews.llvm.org/D48929
+
+PR: 225128
+Obtained from: LLVM r336799 by Igor Kudrin
+
+Index: tools/lld/ELF/InputSection.cpp
+===================================================================
+--- tools/lld/ELF/InputSection.cpp (revision 336663)
++++ tools/lld/ELF/InputSection.cpp (revision 336664)
+@@ -686,6 +686,23 @@ void InputSection::relocateNonAlloc(uint8_t *Buf,
+ }
+ }
+
++// This is used when '-r' is given.
++// For REL targets, InputSection::copyRelocations() may store artificial
++// relocations aimed to update addends. They are handled in relocateAlloc()
++// for allocatable sections, and this function does the same for
++// non-allocatable sections, such as sections with debug information.
++static void relocateNonAllocForRelocatable(InputSection *Sec, uint8_t *Buf) {
++ const unsigned Bits = Config->Is64 ? 64 : 32;
++
++ for (const Relocation &Rel : Sec->Relocations) {
++ // InputSection::copyRelocations() adds only R_ABS relocations.
++ assert(Rel.Expr == R_ABS);
++ uint8_t *BufLoc = Buf + Rel.Offset + Sec->OutSecOff;
++ uint64_t TargetVA = SignExtend64(Rel.Sym->getVA(Rel.Addend), Bits);
++ Target->relocateOne(BufLoc, Rel.Type, TargetVA);
++ }
++}
++
+ template <class ELFT>
+ void InputSectionBase::relocate(uint8_t *Buf, uint8_t *BufEnd) {
+ if (Flags & SHF_ALLOC) {
+@@ -694,7 +711,9 @@ void InputSectionBase::relocate(uint8_t *Buf, uint
+ }
+
+ auto *Sec = cast<InputSection>(this);
+- if (Sec->AreRelocsRela)
++ if (Config->Relocatable)
++ relocateNonAllocForRelocatable(Sec, Buf);
++ else if (Sec->AreRelocsRela)
+ Sec->relocateNonAlloc<ELFT>(Buf, Sec->template relas<ELFT>());
+ else
+ Sec->relocateNonAlloc<ELFT>(Buf, Sec->template rels<ELFT>());
diff --git a/devel/llvm60/files/lld/patch-head-r336972.diff b/devel/llvm60/files/lld/patch-head-r336972.diff
new file mode 100644
index 000000000000..d7497ce5390a
--- /dev/null
+++ b/devel/llvm60/files/lld/patch-head-r336972.diff
@@ -0,0 +1,146 @@
+r336972 | emaste | 2018-07-31 17:25:03 +0200 (Tue, 31 Jul 2018) | 37 lines
+
+lld: [ELF][ARM] Implement support for Tag_ABI_VFP_args
+
+The Tag_ABI_VFP_args build attribute controls the procedure call
+standard used for floating point parameters on ARM. The values are:
+
+0 - Base AAPCS (FP Parameters passed in Core (Integer) registers
+1 - VFP AAPCS (FP Parameters passed in FP registers)
+2 - Toolchain specific (Neither Base or VFP)
+3 - Compatible with all (No use of floating point parameters)
+
+If the Tag_ABI_VFP_args build attribute is missing it has an implicit
+value of 0.
+
+We use the attribute in two ways:
+
+* Detect a clash in calling convention between Base, VFP and Toolchain.
+
+we follow ld.bfd's lead and do not error if there is a clash between an
+implicit Base AAPCS caused by a missing attribute. Many projects
+including the hard-float (VFP AAPCS) version of glibc contain assembler
+files that do not use floating point but do not have Tag_ABI_VFP_args.
+
+* Set the EF_ARM_ABI_FLOAT_SOFT or EF_ARM_ABI_FLOAT_HARD ELF header flag
+
+for Base or VFP AAPCS respectively. This flag is used by some ELF
+loaders.
+
+References:
+* Addenda to, and Errata in, the ABI for the ARM Architecture for
+ Tag_ABI_VFP_args
+* Elf for the ARM Architecture for ELF header flags
+
+Fixes LLVM PR36009
+
+PR: 229050
+Obtained from: llvm r338377 by Peter Smith
+
+Index: tools/lld/ELF/Arch/ARM.cpp
+===================================================================
+--- tools/lld/ELF/Arch/ARM.cpp (revision 336971)
++++ tools/lld/ELF/Arch/ARM.cpp (revision 336972)
+@@ -97,10 +97,19 @@ ARM::ARM() {
+ }
+
+ uint32_t ARM::calcEFlags() const {
++ // The ABIFloatType is used by loaders to detect the floating point calling
++ // convention.
++ uint32_t ABIFloatType = 0;
++ if (Config->ARMVFPArgs == ARMVFPArgKind::Base ||
++ Config->ARMVFPArgs == ARMVFPArgKind::Default)
++ ABIFloatType = EF_ARM_ABI_FLOAT_SOFT;
++ else if (Config->ARMVFPArgs == ARMVFPArgKind::VFP)
++ ABIFloatType = EF_ARM_ABI_FLOAT_HARD;
++
+ // We don't currently use any features incompatible with EF_ARM_EABI_VER5,
+ // but we don't have any firm guarantees of conformance. Linux AArch64
+ // kernels (as of 2016) require an EABI version to be set.
+- return EF_ARM_EABI_VER5;
++ return EF_ARM_EABI_VER5 | ABIFloatType;
+ }
+
+ RelExpr ARM::getRelExpr(RelType Type, const Symbol &S,
+Index: tools/lld/ELF/Config.h
+===================================================================
+--- tools/lld/ELF/Config.h (revision 336971)
++++ tools/lld/ELF/Config.h (revision 336972)
+@@ -54,6 +54,9 @@ enum class SortSectionPolicy { Default, None, Alig
+ // For --target2
+ enum class Target2Policy { Abs, Rel, GotRel };
+
++// For tracking ARM Float Argument PCS
++enum class ARMVFPArgKind { Default, Base, VFP, ToolChain };
++
+ struct SymbolVersion {
+ llvm::StringRef Name;
+ bool IsExternCpp;
+@@ -169,6 +172,7 @@ struct Configuration {
+ StripPolicy Strip;
+ UnresolvedPolicy UnresolvedSymbols;
+ Target2Policy Target2;
++ ARMVFPArgKind ARMVFPArgs = ARMVFPArgKind::Default;
+ BuildIdKind BuildId = BuildIdKind::None;
+ ELFKind EKind = ELFNoneKind;
+ uint16_t DefaultSymbolVersion = llvm::ELF::VER_NDX_GLOBAL;
+Index: tools/lld/ELF/InputFiles.cpp
+===================================================================
+--- tools/lld/ELF/InputFiles.cpp (revision 336971)
++++ tools/lld/ELF/InputFiles.cpp (revision 336972)
+@@ -441,6 +441,46 @@ void ObjFile<ELFT>::initializeSections(
+ }
+ }
+
++// For ARM only, to set the EF_ARM_ABI_FLOAT_SOFT or EF_ARM_ABI_FLOAT_HARD
++// flag in the ELF Header we need to look at Tag_ABI_VFP_args to find out how
++// the input objects have been compiled.
++static void updateARMVFPArgs(const ARMAttributeParser &Attributes,
++ const InputFile *F) {
++ if (!Attributes.hasAttribute(ARMBuildAttrs::ABI_VFP_args))
++ // If an ABI tag isn't present then it is implicitly given the value of 0
++ // which maps to ARMBuildAttrs::BaseAAPCS. However many assembler files,
++ // including some in glibc that don't use FP args (and should have value 3)
++ // don't have the attribute so we do not consider an implicit value of 0
++ // as a clash.
++ return;
++
++ unsigned VFPArgs = Attributes.getAttributeValue(ARMBuildAttrs::ABI_VFP_args);
++ ARMVFPArgKind Arg;
++ switch (VFPArgs) {
++ case ARMBuildAttrs::BaseAAPCS:
++ Arg = ARMVFPArgKind::Base;
++ break;
++ case ARMBuildAttrs::HardFPAAPCS:
++ Arg = ARMVFPArgKind::VFP;
++ break;
++ case ARMBuildAttrs::ToolChainFPPCS:
++ // Tool chain specific convention that conforms to neither AAPCS variant.
++ Arg = ARMVFPArgKind::ToolChain;
++ break;
++ case ARMBuildAttrs::CompatibleFPAAPCS:
++ // Object compatible with all conventions.
++ return;
++ default:
++ error(toString(F) + ": unknown Tag_ABI_VFP_args value: " + Twine(VFPArgs));
++ return;
++ }
++ // Follow ld.bfd and error if there is a mix of calling conventions.
++ if (Config->ARMVFPArgs != Arg && Config->ARMVFPArgs != ARMVFPArgKind::Default)
++ error(toString(F) + ": incompatible Tag_ABI_VFP_args");
++ else
++ Config->ARMVFPArgs = Arg;
++}
++
+ // The ARM support in lld makes some use of instructions that are not available
+ // on all ARM architectures. Namely:
+ // - Use of BLX instruction for interworking between ARM and Thumb state.
+@@ -520,6 +560,8 @@ InputSectionBase *ObjFile<ELFT>::createInputSectio
+ ArrayRef<uint8_t> Contents = check(this->getObj().getSectionContents(&Sec));
+ Attributes.Parse(Contents, /*isLittle*/ Config->EKind == ELF32LEKind);
+ updateSupportedARMFeatures(Attributes);
++ updateARMVFPArgs(Attributes, this);
++
+ // FIXME: Retain the first attribute section we see. The eglibc ARM
+ // dynamic loaders require the presence of an attribute section for dlopen
+ // to work. In a full implementation we would merge all attribute sections.
diff --git a/devel/llvm60/files/lld/patch-head-r337282.diff b/devel/llvm60/files/lld/patch-head-r337282.diff
new file mode 100644
index 000000000000..1e046d6e2b17
--- /dev/null
+++ b/devel/llvm60/files/lld/patch-head-r337282.diff
@@ -0,0 +1,39 @@
+r337282 | alc | 2018-08-04 04:30:51 +0200 (Sat, 04 Aug 2018) | 7 lines
+
+Set the default image base on arm64 and i386 to a superpage-aligned
+address.
+
+Reviewed by: emaste, markj
+Discussed with: dim
+Differential Revision: https://reviews.freebsd.org/D16385
+
+Index: tools/lld/ELF/Arch/AArch64.cpp
+===================================================================
+--- tools/lld/ELF/Arch/AArch64.cpp (revision 337281)
++++ tools/lld/ELF/Arch/AArch64.cpp (revision 337282)
+@@ -66,6 +66,10 @@ AArch64::AArch64() {
+ PltHeaderSize = 32;
+ DefaultMaxPageSize = 65536;
+
++ // Align to the 2 MiB page size (known as a superpage or huge page).
++ // FreeBSD automatically promotes 2 MiB-aligned allocations.
++ DefaultImageBase = 0x200000;
++
+ // It doesn't seem to be documented anywhere, but tls on aarch64 uses variant
+ // 1 of the tls structures and the tcb size is 16.
+ TcbSize = 16;
+Index: tools/lld/ELF/Arch/X86.cpp
+===================================================================
+--- tools/lld/ELF/Arch/X86.cpp (revision 337281)
++++ tools/lld/ELF/Arch/X86.cpp (revision 337282)
+@@ -61,6 +61,10 @@ X86::X86() {
+ PltHeaderSize = 16;
+ TlsGdRelaxSkip = 2;
+ TrapInstr = 0xcccccccc; // 0xcc = INT3
++
++ // Align to the non-PAE large page size (known as a superpage or huge page).
++ // FreeBSD automatically promotes large, superpage-aligned allocations.
++ DefaultImageBase = 0x400000;
+ }
+
+ static bool hasBaseReg(uint8_t ModRM) { return (ModRM & 0xc7) != 0x5; }
diff --git a/devel/llvm60/files/lld/patch-head-r338251.diff b/devel/llvm60/files/lld/patch-head-r338251.diff
new file mode 100644
index 000000000000..1c3df02100cd
--- /dev/null
+++ b/devel/llvm60/files/lld/patch-head-r338251.diff
@@ -0,0 +1,123 @@
+r338251 | markj | 2018-08-23 16:58:19 +0200 (Thu, 23 Aug 2018) | 29 lines
+
+Add an lld option to emit PC-relative relocations for ifunc calls.
+
+The current kernel ifunc implementation creates a PLT entry for each
+ifunc definition. ifunc calls therefore consist of a call to the
+PLT entry followed by an indirect jump. The jump target is written
+during boot when the kernel linker resolves R_[*]_IRELATIVE relocations.
+This implementation is defined by requirements for userland code, where
+text relocations are avoided. This requirement is not present for the
+kernel, so the implementation has avoidable overhead (namely, an extra
+indirect jump per call).
+
+Address this for now by adding a special option to the static linker
+to inhibit PLT creation for ifuncs. Instead, relocations to ifunc call
+sites are passed through to the output file, so the kernel linker can
+enumerate such call sites and apply PC-relative relocations directly
+to the text section. Thus the overhead of an ifunc call becomes exactly
+the same as that of an ordinary function call. This option is only for
+use by the kernel and will not work for regular programs.
+
+The final form of this optimization is up for debate; for now, this
+change is simple and static enough to be acceptable as an interim
+solution.
+
+Reviewed by: emaste
+Discussed with: arichardson, dim
+MFC after: 1 month
+Sponsored by: The FreeBSD Foundation
+Differential Revision: https://reviews.freebsd.org/D16748
+
+Index: tools/lld/ELF/Config.h
+===================================================================
+--- tools/lld/ELF/Config.h (revision 338250)
++++ tools/lld/ELF/Config.h (revision 338251)
+@@ -155,6 +155,7 @@ struct Configuration {
+ bool ZCombreloc;
+ bool ZExecstack;
+ bool ZHazardplt;
++ bool ZIfuncnoplt;
+ bool ZNocopyreloc;
+ bool ZNodelete;
+ bool ZNodlopen;
+Index: tools/lld/ELF/Driver.cpp
+===================================================================
+--- tools/lld/ELF/Driver.cpp (revision 338250)
++++ tools/lld/ELF/Driver.cpp (revision 338251)
+@@ -669,6 +669,7 @@ void LinkerDriver::readConfigs(opt::InputArgList &
+ Config->ZCombreloc = !hasZOption(Args, "nocombreloc");
+ Config->ZExecstack = hasZOption(Args, "execstack");
+ Config->ZHazardplt = hasZOption(Args, "hazardplt");
++ Config->ZIfuncnoplt = hasZOption(Args, "ifunc-noplt");
+ Config->ZNocopyreloc = hasZOption(Args, "nocopyreloc");
+ Config->ZNodelete = hasZOption(Args, "nodelete");
+ Config->ZNodlopen = hasZOption(Args, "nodlopen");
+Index: tools/lld/ELF/Relocations.cpp
+===================================================================
+--- tools/lld/ELF/Relocations.cpp (revision 338250)
++++ tools/lld/ELF/Relocations.cpp (revision 338251)
+@@ -374,6 +374,9 @@ static bool isStaticLinkTimeConstant(RelExpr E, Re
+ R_PPC_PLT_OPD, R_TLSDESC_CALL, R_TLSDESC_PAGE, R_HINT>(E))
+ return true;
+
++ if (Sym.isGnuIFunc() && Config->ZIfuncnoplt)
++ return false;
++
+ // These never do, except if the entire file is position dependent or if
+ // only the low bits are used.
+ if (E == R_GOT || E == R_PLT || E == R_TLSDESC)
+@@ -921,7 +924,9 @@ static void scanRelocs(InputSectionBase &Sec, Arra
+ // Strenghten or relax a PLT access.
+ //
+ // GNU ifunc symbols must be accessed via PLT because their addresses
+- // are determined by runtime.
++ // are determined by runtime. If the -z ifunc-noplt option is specified,
++ // we permit the optimization of ifunc calls by omitting the PLT entry
++ // and preserving relocations at ifunc call sites.
+ //
+ // On the other hand, if we know that a PLT entry will be resolved within
+ // the same ELF module, we can skip PLT access and directly jump to the
+@@ -929,7 +934,7 @@ static void scanRelocs(InputSectionBase &Sec, Arra
+ // all dynamic symbols that can be resolved within the executable will
+ // actually be resolved that way at runtime, because the main exectuable
+ // is always at the beginning of a search list. We can leverage that fact.
+- if (Sym.isGnuIFunc())
++ if (Sym.isGnuIFunc() && !Config->ZIfuncnoplt)
+ Expr = toPlt(Expr);
+ else if (!Preemptible && Expr == R_GOT_PC && !isAbsoluteValue(Sym))
+ Expr =
+@@ -1034,6 +1039,16 @@ static void scanRelocs(InputSectionBase &Sec, Arra
+ continue;
+ }
+
++ // Preserve relocations against ifuncs if we were asked to do so.
++ if (Sym.isGnuIFunc() && Config->ZIfuncnoplt) {
++ if (Config->IsRela)
++ InX::RelaDyn->addReloc({Type, &Sec, Offset, false, &Sym, Addend});
++ else
++ // Preserve the existing addend.
++ InX::RelaDyn->addReloc({Type, &Sec, Offset, false, &Sym, 0});
++ continue;
++ }
++
+ // If the output being produced is position independent, the final value
+ // is still not known. In that case we still need some help from the
+ // dynamic linker. We can however do better than just copying the incoming
+Index: tools/lld/ELF/Writer.cpp
+===================================================================
+--- tools/lld/ELF/Writer.cpp (revision 338250)
++++ tools/lld/ELF/Writer.cpp (revision 338251)
+@@ -1400,8 +1400,11 @@ template <class ELFT> void Writer<ELFT>::finalizeS
+ applySynthetic({InX::EhFrame},
+ [](SyntheticSection *SS) { SS->finalizeContents(); });
+
+- for (Symbol *S : Symtab->getSymbols())
++ for (Symbol *S : Symtab->getSymbols()) {
+ S->IsPreemptible |= computeIsPreemptible(*S);
++ if (S->isGnuIFunc() && Config->ZIfuncnoplt)
++ S->ExportDynamic = true;
++ }
+
+ // Scan relocations. This must be done after every symbol is declared so that
+ // we can correctly decide if a dynamic relocation is needed.
diff --git a/devel/llvm60/files/lld/patch-head-r338682.diff b/devel/llvm60/files/lld/patch-head-r338682.diff
new file mode 100644
index 000000000000..1783fe227489
--- /dev/null
+++ b/devel/llvm60/files/lld/patch-head-r338682.diff
@@ -0,0 +1,55 @@
+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 <class ELFT> void DynamicSection<ELFT>::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)
diff --git a/devel/llvm60/files/lld/patch-head-r339013.diff b/devel/llvm60/files/lld/patch-head-r339013.diff
new file mode 100644
index 000000000000..ba614706a88d
--- /dev/null
+++ b/devel/llvm60/files/lld/patch-head-r339013.diff
@@ -0,0 +1,39 @@
+r339013 | dim | 2018-09-29 16:12:03 +0200 (Sat, 29 Sep 2018) | 24 lines
+
+Pull in r329557 from upstream lld trunk (by George Rimar):
+
+ [ELF] - Allow LLD to produce file symbols.
+
+ This is for PR36716 and
+ this enables emitting STT_FILE symbols.
+
+ Output size affect is minor:
+ lld binary size changes from 52,883,408 to 52,949,400
+ clang binary size changes from 83,136,456 to 83,219,600
+
+ Differential revision: https://reviews.llvm.org/D45261
+
+This fixes a regression in lld that made it stop emitting STT_FILE
+symbols, which ctfmerge relies upon to uniquify function table entries
+that reference STB_LOCAL symbols. Consequently, ctfmerge stopped
+emitting entries for static functions into the function table, and
+dtrace no longer gets type info for them.
+
+Approved by: re (kib)
+Reported by: markj
+PR: 230444
+MFC after: 3 days
+
+Index: tools/lld/ELF/Writer.cpp
+===================================================================
+--- tools/lld/ELF/Writer.cpp (revision 339012)
++++ tools/lld/ELF/Writer.cpp (revision 339013)
+@@ -487,7 +487,7 @@ template <class ELFT> void Writer<ELFT>::run() {
+
+ static bool shouldKeepInSymtab(SectionBase *Sec, StringRef SymName,
+ const Symbol &B) {
+- if (B.isFile() || B.isSection())
++ if (B.isSection())
+ return false;
+
+ // If sym references a section in a discarded group, don't keep it.
diff --git a/devel/llvm60/files/lld/patch-head-r339304.diff b/devel/llvm60/files/lld/patch-head-r339304.diff
new file mode 100644
index 000000000000..59ff933dfff6
--- /dev/null
+++ b/devel/llvm60/files/lld/patch-head-r339304.diff
@@ -0,0 +1,37 @@
+r339304 | emaste | 2018-10-11 15:19:17 +0200 (Thu, 11 Oct 2018) | 13 lines
+
+lld: set sh_link and sh_info for .rela.plt sections
+
+ELF spec says that for SHT_REL and SHT_RELA sh_link should reference the
+associated string table and sh_info should reference the "section to
+which the relocation applies." ELF Tool Chain's elfcopy / strip use
+this (in part) to control whether or not the relocation entry is copied
+to the output.
+
+LLVM PR 37538 https://bugs.llvm.org/show_bug.cgi?id=37538
+
+Approved by: re (kib)
+Obtained from: llvm r344226 (backported for 6.0)
+
+Index: tools/lld/ELF/SyntheticSections.cpp
+===================================================================
+--- tools/lld/ELF/SyntheticSections.cpp (revision 339303)
++++ tools/lld/ELF/SyntheticSections.cpp (revision 339304)
+@@ -1213,11 +1213,13 @@ void RelocationBaseSection::addReloc(const Dynamic
+ void RelocationBaseSection::finalizeContents() {
+ // If all relocations are R_*_RELATIVE they don't refer to any
+ // dynamic symbol and we don't need a dynamic symbol table. If that
+- // is the case, just use 0 as the link.
+- Link = InX::DynSymTab ? InX::DynSymTab->getParent()->SectionIndex : 0;
++ // is the case, just use the index of the regular symbol table section.
++ getParent()->Link = InX::DynSymTab ?
++ InX::DynSymTab->getParent()->SectionIndex :
++ InX::SymTab->getParent()->SectionIndex;
+
+- // Set required output section properties.
+- getParent()->Link = Link;
++ if (InX::RelaIplt == this || InX::RelaPlt == this)
++ getParent()->Info = InX::GotPlt->getParent()->SectionIndex;
+ }
+
+ template <class ELFT>