From owner-svn-src-all@freebsd.org Mon Jan 29 13:50:29 2018 Return-Path: Delivered-To: svn-src-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 954ECEC8494; Mon, 29 Jan 2018 13:50:29 +0000 (UTC) (envelope-from emaste@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 3BDF773E34; Mon, 29 Jan 2018 13:50:29 +0000 (UTC) (envelope-from emaste@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 32813DF2; Mon, 29 Jan 2018 13:50:29 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0TDoTWR062927; Mon, 29 Jan 2018 13:50:29 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0TDoSNe062924; Mon, 29 Jan 2018 13:50:28 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801291350.w0TDoSNe062924@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 29 Jan 2018 13:50:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328544 - head/contrib/llvm/tools/lld/ELF X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/llvm/tools/lld/ELF X-SVN-Commit-Revision: 328544 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 13:50:29 -0000 Author: emaste Date: Mon Jan 29 13:50:28 2018 New Revision: 328544 URL: https://svnweb.freebsd.org/changeset/base/328544 Log: lld: Remove MemRegionOffset. NFC. We can just use a member variable in MemoryRegion. Obtained from: LLVM r323399 by Rafael Espindola Modified: head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp head/contrib/llvm/tools/lld/ELF/LinkerScript.h head/contrib/llvm/tools/lld/ELF/ScriptParser.cpp Modified: head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp ============================================================================== --- head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp Mon Jan 29 13:49:10 2018 (r328543) +++ head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp Mon Jan 29 13:50:28 2018 (r328544) @@ -590,7 +590,7 @@ void LinkerScript::output(InputSection *S) { // If there is a memory region associated with this input section, then // place the section in that region and update the region index. if (Ctx->MemRegion) { - uint64_t &CurOffset = Ctx->MemRegionOffset[Ctx->MemRegion]; + uint64_t &CurOffset = Ctx->MemRegion->CurPos; CurOffset += Pos - Before; uint64_t CurSize = CurOffset - Ctx->MemRegion->Origin; if (CurSize > Ctx->MemRegion->Length) { @@ -652,7 +652,7 @@ void LinkerScript::assignOffsets(OutputSection *Sec) { Ctx->MemRegion = Sec->MemRegion; if (Ctx->MemRegion) - Dot = Ctx->MemRegionOffset[Ctx->MemRegion]; + Dot = Ctx->MemRegion->CurPos; switchTo(Sec); @@ -693,7 +693,7 @@ void LinkerScript::assignOffsets(OutputSection *Sec) { Cmd->Offset = Dot - Ctx->OutSec->Addr; Dot += Cmd->Size; if (Ctx->MemRegion) - Ctx->MemRegionOffset[Ctx->MemRegion] += Cmd->Size; + Ctx->MemRegion->CurPos += Cmd->Size; Ctx->OutSec->Size = Dot - Ctx->OutSec->Addr; continue; } @@ -888,8 +888,8 @@ void LinkerScript::allocateHeaders(std::vectorMemoryRegions) { - const MemoryRegion *MR = MRI.second; - MemRegionOffset[MR] = MR->Origin; + MemoryRegion *MR = MRI.second; + MR->CurPos = MR->Origin; } } Modified: head/contrib/llvm/tools/lld/ELF/LinkerScript.h ============================================================================== --- head/contrib/llvm/tools/lld/ELF/LinkerScript.h Mon Jan 29 13:49:10 2018 (r328543) +++ head/contrib/llvm/tools/lld/ELF/LinkerScript.h Mon Jan 29 13:50:28 2018 (r328544) @@ -118,11 +118,17 @@ enum class ConstraintKind { NoConstraint, ReadOnly, Re // target memory. Instances of the struct are created by parsing the // MEMORY command. struct MemoryRegion { + MemoryRegion(StringRef Name, uint64_t Origin, uint64_t Length, uint32_t Flags, + uint32_t NegFlags) + : Name(Name), Origin(Origin), Length(Length), Flags(Flags), + NegFlags(NegFlags) {} + std::string Name; uint64_t Origin; uint64_t Length; uint32_t Flags; uint32_t NegFlags; + uint64_t CurPos = 0; }; // This struct represents one section match pattern in SECTIONS() command. @@ -200,7 +206,6 @@ class LinkerScript final { uint64_t ThreadBssOffset = 0; OutputSection *OutSec = nullptr; MemoryRegion *MemRegion = nullptr; - llvm::DenseMap MemRegionOffset; std::function LMAOffset; }; Modified: head/contrib/llvm/tools/lld/ELF/ScriptParser.cpp ============================================================================== --- head/contrib/llvm/tools/lld/ELF/ScriptParser.cpp Mon Jan 29 13:49:10 2018 (r328543) +++ head/contrib/llvm/tools/lld/ELF/ScriptParser.cpp Mon Jan 29 13:50:28 2018 (r328544) @@ -1293,8 +1293,8 @@ void ScriptParser::readMemory() { // Add the memory region to the region map. if (Script->MemoryRegions.count(Name)) setError("region '" + Name + "' already defined"); - MemoryRegion *MR = make(); - *MR = {Name, Origin, Length, Flags, NegFlags}; + MemoryRegion *MR = + make(Name, Origin, Length, Flags, NegFlags); Script->MemoryRegions[Name] = MR; } }