From owner-svn-ports-all@freebsd.org Fri Oct 26 21:20:09 2018 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26FC51088DA3; Fri, 26 Oct 2018 21:20:09 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CA2FD6AC2F; Fri, 26 Oct 2018 21:20:08 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D2B82657B; Fri, 26 Oct 2018 21:20:06 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9QLK61E097924; Fri, 26 Oct 2018 21:20:06 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9QLK2aw097734; Fri, 26 Oct 2018 21:20:02 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201810262120.w9QLK2aw097734@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 26 Oct 2018 21:20:02 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r483054 - in head/devel/llvm60: . files files/clang files/lld files/lldb X-SVN-Group: ports-head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head/devel/llvm60: . files files/clang files/lld files/lldb X-SVN-Commit-Revision: 483054 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Oct 2018 21:20:09 -0000 Author: dim (src committer) Date: Fri Oct 26 21:20:02 2018 New Revision: 483054 URL: https://svnweb.freebsd.org/changeset/ports/483054 Log: Add all patches from base llvm/clang/lld/lldb 6.0 to devel/llvm60 This adds all the patches that were applied in the past to head, under contrib/llvm. After these, there only minimal diffs left between the port sources and the base sources. Most of these remaining diffs are due to #ifdef shortcuts in the base sources, because we don't compile certain features in. Other diffs are because the port has applied a few changes that we don't have in base. While here, use Makefile.LICENSE from the devel/llvm-devel port. Approved by: brooks (maintainer) Reviewed by: brooks PR: 212343, 225128, 225471, 226388, 226658, 226872, 229050, 230444, 230604, 231355 MFH: 2018Q4 Differential Revision: https://reviews.freebsd.org/D17702 Added: head/devel/llvm60/files/clang/patch-head-r331066.diff (contents, props changed) head/devel/llvm60/files/clang/patch-head-r336227.diff (contents, props changed) head/devel/llvm60/files/clang/patch-head-r338697.diff (contents, props changed) head/devel/llvm60/files/clang/patch-head-r339019.diff (contents, props changed) head/devel/llvm60/files/lld/ head/devel/llvm60/files/lld/patch-head-r331731.diff (contents, props changed) head/devel/llvm60/files/lld/patch-head-r333401.diff (contents, props changed) head/devel/llvm60/files/lld/patch-head-r336664.diff (contents, props changed) head/devel/llvm60/files/lld/patch-head-r336972.diff (contents, props changed) head/devel/llvm60/files/lld/patch-head-r337282.diff (contents, props changed) head/devel/llvm60/files/lld/patch-head-r338251.diff (contents, props changed) head/devel/llvm60/files/lld/patch-head-r338682.diff (contents, props changed) head/devel/llvm60/files/lld/patch-head-r339013.diff (contents, props changed) head/devel/llvm60/files/lld/patch-head-r339304.diff (contents, props changed) head/devel/llvm60/files/lldb/ head/devel/llvm60/files/lldb/patch-head-r332849.diff (contents, props changed) head/devel/llvm60/files/lldb/patch-head-r332965.diff (contents, props changed) head/devel/llvm60/files/patch-head-r308867.diff (contents, props changed) head/devel/llvm60/files/patch-head-r330686.diff (contents, props changed) head/devel/llvm60/files/patch-head-r331065.diff (contents, props changed) head/devel/llvm60/files/patch-head-r331366.diff (contents, props changed) head/devel/llvm60/files/patch-head-r336969.diff (contents, props changed) head/devel/llvm60/files/patch-head-r336970.diff (contents, props changed) head/devel/llvm60/files/patch-head-r337615.diff (contents, props changed) head/devel/llvm60/files/patch-head-r338689.diff (contents, props changed) Modified: head/devel/llvm60/Makefile Modified: head/devel/llvm60/Makefile ============================================================================== --- head/devel/llvm60/Makefile Fri Oct 26 21:19:56 2018 (r483053) +++ head/devel/llvm60/Makefile Fri Oct 26 21:20:02 2018 (r483054) @@ -2,7 +2,7 @@ PORTNAME= llvm DISTVERSION= 6.0.1 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= devel lang MASTER_SITES= http://${PRE_}releases.llvm.org/${LLVM_RELEASE}/${RCDIR} PKGNAMESUFFIX= ${LLVM_SUFFIX} @@ -12,10 +12,7 @@ DISTFILES= ${PORTNAME}-${DISTVERSION}.src${EXTRACT_SUF MAINTAINER= brooks@FreeBSD.org COMMENT= LLVM and Clang -LICENSE= LLVM -LICENSE_NAME= LLVM Release License -LICENSE_FILE= ${WRKSRC}/LICENSE.TXT -LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept +.include "${.CURDIR}/../llvm-devel/Makefile.LICENSE" LLVM_RELEASE= ${DISTVERSION:C/rc.*//} LLVM_MAJOR= ${LLVM_RELEASE:C/\.[0-9]$//} @@ -84,10 +81,12 @@ LIT_DESC= Install lit and FileCheck test tools LIT_VARS= _USES_PYTHON=python:2.7 LLD_DESC= Install lld, the LLVM linker LLD_DISTFILES= lld-${DISTVERSION}.src${EXTRACT_SUFX} +LLD_EXTRA_PATCHES= ${PATCHDIR}/lld LLDB_BUILD_DEPENDS= swig3.0:devel/swig30 \ ${PY_ENUM34} LLDB_DESC= Install lldb, the LLVM debugger LLDB_DISTFILES= lldb-${DISTVERSION}.src${EXTRACT_SUFX} +LLDB_EXTRA_PATCHES= ${PATCHDIR}/lldb LLDB_IMPLIES= CLANG LLDB_VARS= _USES_PYTHON=python:2.7 OPENMP_DESC= Install libomp, the LLVM OpenMP runtime library @@ -228,6 +227,7 @@ CLANG_PATTERN= (c-index-test|clang|scan-|Reporter.py|S SHEBANG_FILES+= tools/clang/tools/scan-view/bin/scan-view \ tools/clang/tools/clang-format/git-clang-format \ tools/clang/tools/clang-format/clang-format-diff.py +USES+= gnome .endif .if ${PORT_OPTIONS:MCOMPILER_RT} Added: head/devel/llvm60/files/clang/patch-head-r331066.diff ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/llvm60/files/clang/patch-head-r331066.diff Fri Oct 26 21:20:02 2018 (r483054) @@ -0,0 +1,40 @@ +r331066 | dim | 2018-03-16 19:04:13 +0100 (Fri, 16 Mar 2018) | 19 lines + +Pull in r321999 from upstream clang trunk (by Ivan A. Kosarev): + + [CodeGen] Fix TBAA info for accesses to members of base classes + + Resolves: + Bug 35724 - regression (r315984): fatal error: error in backend: + Broken function found (Did not see access type in access path!) + https://bugs.llvm.org/show_bug.cgi?id=35724 + + Differential Revision: https://reviews.llvm.org/D41547 + +This fixes "Did not see access type in access path" fatal errors when +building the devel/gdb port (version 8.1). + +Reported by: jbeich +PR: 226658 +MFC after: 3 months +X-MFC-With: r327952 + +Index: tools/clang/lib/CodeGen/CGExpr.cpp +=================================================================== +--- tools/clang/lib/CodeGen/CGExpr.cpp (revision 331065) ++++ tools/clang/lib/CodeGen/CGExpr.cpp (revision 331066) +@@ -1034,8 +1034,12 @@ Address CodeGenFunction::EmitPointerWithAlignment( + // Derived-to-base conversions. + case CK_UncheckedDerivedToBase: + case CK_DerivedToBase: { +- Address Addr = EmitPointerWithAlignment(CE->getSubExpr(), BaseInfo, +- TBAAInfo); ++ // TODO: Support accesses to members of base classes in TBAA. For now, we ++ // conservatively pretend that the complete object is of the base class ++ // type. ++ if (TBAAInfo) ++ *TBAAInfo = CGM.getTBAAAccessInfo(E->getType()); ++ Address Addr = EmitPointerWithAlignment(CE->getSubExpr(), BaseInfo); + auto Derived = CE->getSubExpr()->getType()->getPointeeCXXRecordDecl(); + return GetAddressOfBaseClass(Addr, Derived, + CE->path_begin(), CE->path_end(), Added: head/devel/llvm60/files/clang/patch-head-r336227.diff ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/llvm60/files/clang/patch-head-r336227.diff Fri Oct 26 21:20:02 2018 (r483054) @@ -0,0 +1,42 @@ +r336227 | dim | 2018-07-12 21:02:59 +0200 (Thu, 12 Jul 2018) | 27 lines + +Pull in r336008 from upstream clang trunk: + + Request init/fini array on FreeBSD 12 and later + + Summary: + + It seems a bad idea to change the default in the middle of a release + branch due to possible changes in global ctor / dtor ordering between + .ctors and .init_array. With FreeBSD 11.0's release imminent lets + change the default now for FreeBSD 12 (the current development + stream) and later. + + FreeBSD rtld has supported .init_array / .fini_array for many years. + As of Jan 1 2017 all supported FreeBSD releases and branches will + have support. + + Reviewers: dim, brooks, arichardson + + Reviewed By: dim, brooks, arichardson + + Subscribers: bsdjhb, krytarowski, emaste, cfe-commits + + Differential Revision: https://reviews.llvm.org/D24867 + +Requested by: jhb +MFC after: 3 days + +Index: tools/clang/lib/Driver/ToolChains/Gnu.cpp +=================================================================== +--- tools/clang/lib/Driver/ToolChains/Gnu.cpp (revision 336226) ++++ tools/clang/lib/Driver/ToolChains/Gnu.cpp (revision 336227) +@@ -2375,6 +2375,8 @@ void Generic_ELF::addClangTargetOptions(const ArgL + bool UseInitArrayDefault = + getTriple().getArch() == llvm::Triple::aarch64 || + getTriple().getArch() == llvm::Triple::aarch64_be || ++ (getTriple().getOS() == llvm::Triple::FreeBSD && ++ getTriple().getOSMajorVersion() >= 12) || + (getTriple().getOS() == llvm::Triple::Linux && + ((!GCCInstallation.isValid() || !V.isOlderThan(4, 7, 0)) || + getTriple().isAndroid())) || Added: head/devel/llvm60/files/clang/patch-head-r338697.diff ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/llvm60/files/clang/patch-head-r338697.diff Fri Oct 26 21:20:02 2018 (r483054) @@ -0,0 +1,104 @@ +r338697 | dim | 2018-09-15 23:22:50 +0200 (Sat, 15 Sep 2018) | 21 lines + +Pull in r325478 from upstream clang trunk (by Ivan A. Kosarev): + + [CodeGen] Initialize large arrays by copying from a global + + Currently, clang compiles explicit initializers for array elements + into series of store instructions. For large arrays of built-in types + this results in bloated output code and significant amount of time + spent on the instruction selection phase. This patch fixes the issue + by initializing such arrays with global constants that store the + binary image of the initializer. + + Differential Revision: https://reviews.llvm.org/D43181 + +This should fix a compiler hang (and excessive memory usage) while +building the science/rmg port. + +Approved by: re (kib) +Reported by: yuri@tsoft.com +See also: https://bugs.llvm.org/show_bug.cgi?id=38798 +MFC after: 3 days + +Index: tools/clang/lib/CodeGen/CGExprAgg.cpp +=================================================================== +--- tools/clang/lib/CodeGen/CGExprAgg.cpp (revision 338696) ++++ tools/clang/lib/CodeGen/CGExprAgg.cpp (revision 338697) +@@ -14,6 +14,7 @@ + #include "CodeGenFunction.h" + #include "CGObjCRuntime.h" + #include "CodeGenModule.h" ++#include "ConstantEmitter.h" + #include "clang/AST/ASTContext.h" + #include "clang/AST/DeclCXX.h" + #include "clang/AST/DeclTemplate.h" +@@ -85,7 +86,7 @@ class AggExprEmitter : public StmtVisitorgetNumInits(); + + uint64_t NumArrayElements = AType->getNumElements(); + assert(NumInitElements <= NumArrayElements); + ++ QualType elementType = ++ CGF.getContext().getAsArrayType(ArrayQTy)->getElementType(); ++ + // DestPtr is an array*. Construct an elementType* by drilling + // down a level. + llvm::Value *zero = llvm::ConstantInt::get(CGF.SizeTy, 0); +@@ -409,6 +413,29 @@ void AggExprEmitter::EmitArrayInit(Address DestPtr + CharUnits elementAlign = + DestPtr.getAlignment().alignmentOfArrayElement(elementSize); + ++ // Consider initializing the array by copying from a global. For this to be ++ // more efficient than per-element initialization, the size of the elements ++ // with explicit initializers should be large enough. ++ if (NumInitElements * elementSize.getQuantity() > 16 && ++ elementType.isTriviallyCopyableType(CGF.getContext())) { ++ CodeGen::CodeGenModule &CGM = CGF.CGM; ++ ConstantEmitter Emitter(CGM); ++ LangAS AS = ArrayQTy.getAddressSpace(); ++ if (llvm::Constant *C = Emitter.tryEmitForInitializer(E, AS, ArrayQTy)) { ++ auto GV = new llvm::GlobalVariable( ++ CGM.getModule(), C->getType(), ++ CGM.isTypeConstant(ArrayQTy, /* ExcludeCtorDtor= */ true), ++ llvm::GlobalValue::PrivateLinkage, C, "constinit", ++ /* InsertBefore= */ nullptr, llvm::GlobalVariable::NotThreadLocal, ++ CGM.getContext().getTargetAddressSpace(AS)); ++ Emitter.finalize(GV); ++ CharUnits Align = CGM.getContext().getTypeAlignInChars(ArrayQTy); ++ GV->setAlignment(Align.getQuantity()); ++ EmitFinalDestCopy(ArrayQTy, CGF.MakeAddrLValue(GV, ArrayQTy, Align)); ++ return; ++ } ++ } ++ + // Exception safety requires us to destroy all the + // already-constructed members if an initializer throws. + // For that, we'll need an EH cleanup. +@@ -1156,11 +1183,8 @@ void AggExprEmitter::VisitInitListExpr(InitListExp + + // Handle initialization of an array. + if (E->getType()->isArrayType()) { +- QualType elementType = +- CGF.getContext().getAsArrayType(E->getType())->getElementType(); +- + auto AType = cast(Dest.getAddress().getElementType()); +- EmitArrayInit(Dest.getAddress(), AType, elementType, E); ++ EmitArrayInit(Dest.getAddress(), AType, E->getType(), E); + return; + } + Added: head/devel/llvm60/files/clang/patch-head-r339019.diff ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/llvm60/files/clang/patch-head-r339019.diff Fri Oct 26 21:20:02 2018 (r483054) @@ -0,0 +1,30 @@ +r339019 | emaste | 2018-09-29 22:01:23 +0200 (Sat, 29 Sep 2018) | 15 lines + +clang: allow ifunc resolvers to accept arguments + +Previously Clang required ifunc resolution functions to take no +arguments, presumably because GCC documented ifunc resolvers as taking +no arguments. However, GCC accepts resolvers accepting arguments, and +our rtld passes CPU ID information (cpuid, hwcap, etc.) to ifunc +resolvers. Just remove the check from the in-tree compiler for our in- +tree compiler; a different (per-OS) approach may be required upstream. + +Reported by: mjg +Approved by: re (rgrimes) +MFC after: 1 week +Relnotes: Yes +Sponsored by: The FreeBSD Foundation + +Index: tools/clang/lib/CodeGen/CodeGenModule.cpp +=================================================================== +--- tools/clang/lib/CodeGen/CodeGenModule.cpp (revision 339018) ++++ tools/clang/lib/CodeGen/CodeGenModule.cpp (revision 339019) +@@ -321,8 +321,6 @@ void CodeGenModule::checkAliases() { + assert(FTy); + if (!FTy->getReturnType()->isPointerTy()) + Diags.Report(Location, diag::err_ifunc_resolver_return); +- if (FTy->getNumParams()) +- Diags.Report(Location, diag::err_ifunc_resolver_params); + } + + llvm::Constant *Aliasee = Alias->getIndirectSymbol(); Added: head/devel/llvm60/files/lld/patch-head-r331731.diff ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/llvm60/files/lld/patch-head-r331731.diff Fri Oct 26 21:20:02 2018 (r483054) @@ -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 ArrayRef ObjFileSymbols).slice(1, this->FirstNonLocal - 1); + } + ++template ArrayRef ObjFile::getGlobalSymbols() { ++ return makeArrayRef(this->Symbols).slice(this->FirstNonLocal); ++} ++ + template + void ObjFile::parse(DenseSet &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 ObjFile : public ELFFi + static bool classof(const InputFile *F) { return F->kind() == Base::ObjKind; } + + ArrayRef getLocalSymbols(); ++ ArrayRef getGlobalSymbols(); + + ObjFile(MemoryBufferRef M, StringRef ArchiveName); + void parse(llvm::DenseSet &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 void SymbolTable::addCombine + + for (InputFile *File : LTO->compile()) { + DenseSet DummyGroups; +- cast>(File)->parse(DummyGroups); ++ auto *Obj = cast>(File); ++ Obj->parse(DummyGroups); ++ for (Symbol *Sym : Obj->getGlobalSymbols()) ++ Sym->parseSymbolVersion(); + ObjectFiles.push_back(File); + } + } Added: head/devel/llvm60/files/lld/patch-head-r333401.diff ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/llvm60/files/lld/patch-head-r333401.diff Fri Oct 26 21:20:02 2018 (r483054) @@ -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 std::vector 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); Added: head/devel/llvm60/files/lld/patch-head-r336664.diff ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/llvm60/files/lld/patch-head-r336664.diff Fri Oct 26 21:20:02 2018 (r483054) @@ -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 + 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(this); +- if (Sec->AreRelocsRela) ++ if (Config->Relocatable) ++ relocateNonAllocForRelocatable(Sec, Buf); ++ else if (Sec->AreRelocsRela) + Sec->relocateNonAlloc(Buf, Sec->template relas()); + else + Sec->relocateNonAlloc(Buf, Sec->template rels()); Added: head/devel/llvm60/files/lld/patch-head-r336972.diff ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/llvm60/files/lld/patch-head-r336972.diff Fri Oct 26 21:20:02 2018 (r483054) @@ -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::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::createInputSectio + ArrayRef 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. Added: head/devel/llvm60/files/lld/patch-head-r337282.diff ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/llvm60/files/lld/patch-head-r337282.diff Fri Oct 26 21:20:02 2018 (r483054) @@ -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; } Added: head/devel/llvm60/files/lld/patch-head-r338251.diff ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/llvm60/files/lld/patch-head-r338251.diff Fri Oct 26 21:20:02 2018 (r483054) @@ -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 void Writer::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. Added: head/devel/llvm60/files/lld/patch-head-r338682.diff ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/llvm60/files/lld/patch-head-r338682.diff Fri Oct 26 21:20:02 2018 (r483054) @@ -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 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) Added: head/devel/llvm60/files/lld/patch-head-r339013.diff ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/llvm60/files/lld/patch-head-r339013.diff Fri Oct 26 21:20:02 2018 (r483054) @@ -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 void Writer::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. Added: head/devel/llvm60/files/lld/patch-head-r339304.diff ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/llvm60/files/lld/patch-head-r339304.diff Fri Oct 26 21:20:02 2018 (r483054) @@ -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 Added: head/devel/llvm60/files/lldb/patch-head-r332849.diff ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/llvm60/files/lldb/patch-head-r332849.diff Fri Oct 26 21:20:02 2018 (r483054) @@ -0,0 +1,38 @@ +r332849 | emaste | 2018-04-21 02:34:46 +0200 (Sat, 21 Apr 2018) | 20 lines + +lldb: propagate error to user if memory read fails + +Previously, an attempt to read an unreadable access reported zeros: + +(lldb) memory read -format hex -size 8 0 +0x00000000: 0x0000000000000000 0x0000000000000000 +0x00000010: 0x0000000000000000 0x0000000000000000 +... + +Now, if DoReadMemory encounters error then return 0 (bytes read) so we +report the error to the user: + +(lldb) memory read -format hex -size 8 0 +error: Bad address + +LLVM PR: 37190 + +MFC after: 1 week +Sponsored by: The FreeBSD Foundation + +Index: tools/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp +=================================================================== +--- tools/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp (revision 332848) ++++ tools/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp (revision 332849) +@@ -163,8 +163,10 @@ static size_t DoReadMemory(lldb::pid_t pid, lldb:: + pi_desc.piod_addr = buf; + pi_desc.piod_len = size; + +- if (PTRACE(PT_IO, pid, (caddr_t)&pi_desc, 0) < 0) ++ if (PTRACE(PT_IO, pid, (caddr_t)&pi_desc, 0) < 0) { + error.SetErrorToErrno(); ++ return 0; ++ } + return pi_desc.piod_len; + } + Added: head/devel/llvm60/files/lldb/patch-head-r332965.diff ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/llvm60/files/lldb/patch-head-r332965.diff Fri Oct 26 21:20:02 2018 (r483054) @@ -0,0 +1,22 @@ +r332965 | emaste | 2018-04-24 21:26:58 +0200 (Tue, 24 Apr 2018) | 8 lines + +lldb: remove assertion that target_arch is FreeBSD + +The target is not necessarily a FreeBSD binary - for example, it may be +a Linux binary running under the linuxulator. Basic ptrace (live) +debugging already worked in this case, except for the assertion. + +Sponsored by: Turing Robotic Industries Inc. + +Index: tools/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp +=================================================================== +--- tools/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp (revision 332964) ++++ tools/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp (revision 332965) +@@ -169,7 +169,6 @@ lldb::RegisterContextSP FreeBSDThread::GetRegister + RegisterInfoInterface *reg_interface = NULL; + const ArchSpec &target_arch = GetProcess()->GetTarget().GetArchitecture(); + +- assert(target_arch.GetTriple().getOS() == llvm::Triple::FreeBSD); + switch (target_arch.GetMachine()) { + case llvm::Triple::aarch64: + reg_interface = new RegisterInfoPOSIX_arm64(target_arch); Added: head/devel/llvm60/files/patch-head-r308867.diff ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/llvm60/files/patch-head-r308867.diff Fri Oct 26 21:20:02 2018 (r483054) @@ -0,0 +1,33 @@ +r308867 | dim | 2016-11-19 22:05:17 +0100 (Sat, 19 Nov 2016) | 15 lines + +Work around LLVM PR30879, which is about a bad interaction between X86 +Call Frame Optimization on i386 and libunwind, by disallowing the +optimization for i386-freebsd12. + +This should fix some instances of broken exception handling when frame +pointers are omitted, in particular some unittests run during the build +of editors/libreoffice. + +This hack will be removed as soon as upstream has implemented a more +permanent fix for this problem. + +Upstream PR: https://llvm.org/bugs/show_bug.cgi?id=30879 +Reviewed by: emaste +PR: 212343 + +Index: lib/Target/X86/X86CallFrameOptimization.cpp +=================================================================== +--- lib/Target/X86/X86CallFrameOptimization.cpp (revision 308866) ++++ lib/Target/X86/X86CallFrameOptimization.cpp (revision 308867) +@@ -125,6 +125,11 @@ bool X86CallFrameOptimization::isLegal(MachineFunc + if (NoX86CFOpt.getValue()) + return false; + ++ // Work around LLVM PR30879 (bad interaction between CFO and libunwind) ++ if (STI->isTargetFreeBSD() && STI->is32Bit() && ++ STI->getTargetTriple().getOSMajorVersion() >= 12) ++ return false; ++ + // We can't encode multiple DW_CFA_GNU_args_size or DW_CFA_def_cfa_offset + // in the compact unwind encoding that Darwin uses. So, bail if there + // is a danger of that being generated. Added: head/devel/llvm60/files/patch-head-r330686.diff ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/llvm60/files/patch-head-r330686.diff Fri Oct 26 21:20:02 2018 (r483054) @@ -0,0 +1,80 @@ +r330686 | dim | 2018-03-09 10:21:22 +0100 (Fri, 09 Mar 2018) | 20 lines + +Pull in r326882 from upstream llvm trunk (by Sjoerd Meijer): + *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***