Date: Mon, 29 Jan 2018 13:49:10 +0000 (UTC) From: Ed Maste <emaste@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328543 - head/contrib/llvm/tools/lld/ELF Message-ID: <201801291349.w0TDnAuN062803@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: emaste Date: Mon Jan 29 13:49:10 2018 New Revision: 328543 URL: https://svnweb.freebsd.org/changeset/base/328543 Log: lld: Only lookup LMARegion once. NFC. This is similar to how we handle MemRegion. Obtained from: LLVM r323396 by Rafael Espindola Modified: head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp head/contrib/llvm/tools/lld/ELF/OutputSections.h Modified: head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp ============================================================================== --- head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp Mon Jan 29 13:48:15 2018 (r328542) +++ head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp Mon Jan 29 13:49:10 2018 (r328543) @@ -661,13 +661,9 @@ void LinkerScript::assignOffsets(OutputSection *Sec) { Ctx->LMAOffset = [=] { return Sec->LMAExpr().getValue() - D; }; } - if (!Sec->LMARegionName.empty()) { - if (MemoryRegion *MR = MemoryRegions.lookup(Sec->LMARegionName)) { - uint64_t Offset = MR->Origin - Dot; - Ctx->LMAOffset = [=] { return Offset; }; - } else { - error("memory region '" + Sec->LMARegionName + "' not declared"); - } + if (MemoryRegion *MR = Sec->LMARegion) { + uint64_t Offset = MR->Origin - Dot; + Ctx->LMAOffset = [=] { return Offset; }; } // If neither AT nor AT> is specified for an allocatable section, the linker @@ -796,6 +792,12 @@ void LinkerScript::adjustSectionsAfterSorting() { if (auto *Sec = dyn_cast<OutputSection>(Base)) { if (!Sec->Live) continue; + if (!Sec->LMARegionName.empty()) { + if (MemoryRegion *M = MemoryRegions.lookup(Sec->LMARegionName)) + Sec->LMARegion = M; + else + error("memory region '" + Sec->LMARegionName + "' not declared"); + } Sec->MemRegion = findMemoryRegion(Sec); // Handle align (e.g. ".foo : ALIGN(16) { ... }"). if (Sec->AlignExpr) Modified: head/contrib/llvm/tools/lld/ELF/OutputSections.h ============================================================================== --- head/contrib/llvm/tools/lld/ELF/OutputSections.h Mon Jan 29 13:48:15 2018 (r328542) +++ head/contrib/llvm/tools/lld/ELF/OutputSections.h Mon Jan 29 13:49:10 2018 (r328543) @@ -89,6 +89,7 @@ class OutputSection final : public BaseCommand, public // The following members are normally only used in linker scripts. MemoryRegion *MemRegion = nullptr; + MemoryRegion *LMARegion = nullptr; Expr AddrExpr; Expr AlignExpr; Expr LMAExpr;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801291349.w0TDnAuN062803>