[lld] r323440 - Simplify. NFC.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 25 08:43:49 PST 2018


Author: rafael
Date: Thu Jan 25 08:43:49 2018
New Revision: 323440

URL: http://llvm.org/viewvc/llvm-project?rev=323440&view=rev
Log:
Simplify. NFC.

Modified:
    lld/trunk/ELF/LinkerScript.cpp
    lld/trunk/ELF/LinkerScript.h

Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=323440&r1=323439&r2=323440&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Thu Jan 25 08:43:49 2018
@@ -656,22 +656,18 @@ void LinkerScript::assignOffsets(OutputS
 
   switchTo(Sec);
 
-  if (Sec->LMAExpr) {
-    uint64_t D = Dot;
-    Ctx->LMAOffset = [=] { return Sec->LMAExpr().getValue() - D; };
-  }
+  if (Sec->LMAExpr)
+    Ctx->LMAOffset = Sec->LMAExpr().getValue() - Dot;
 
-  if (MemoryRegion *MR = Sec->LMARegion) {
-    uint64_t Offset = MR->Origin - Dot;
-    Ctx->LMAOffset = [=] { return Offset; };
-  }
+  if (MemoryRegion *MR = Sec->LMARegion)
+    Ctx->LMAOffset = MR->Origin - Dot;
 
   // If neither AT nor AT> is specified for an allocatable section, the linker
   // will set the LMA such that the difference between VMA and LMA for the
   // section is the same as the preceding output section in the same region
   // https://sourceware.org/binutils/docs-2.20/ld/Output-Section-LMA.html
   if (Ctx->LMAOffset)
-    Ctx->OutSec->LMAOffset = Ctx->LMAOffset();
+    Ctx->OutSec->LMAOffset = Ctx->LMAOffset;
 
   // The Size previously denoted how many InputSections had been added to this
   // section, and was used for sorting SHF_LINK_ORDER sections. Reset it to

Modified: lld/trunk/ELF/LinkerScript.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.h?rev=323440&r1=323439&r2=323440&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.h (original)
+++ lld/trunk/ELF/LinkerScript.h Thu Jan 25 08:43:49 2018
@@ -206,7 +206,7 @@ class LinkerScript final {
     uint64_t ThreadBssOffset = 0;
     OutputSection *OutSec = nullptr;
     MemoryRegion *MemRegion = nullptr;
-    std::function<uint64_t()> LMAOffset;
+    uint64_t LMAOffset = 0;
   };
 
   llvm::DenseMap<StringRef, OutputSection *> NameToOutputSection;




More information about the llvm-commits mailing list