[lld] r285580 - Simplify. NFC.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 31 07:44:42 PDT 2016


Author: rafael
Date: Mon Oct 31 09:44:41 2016
New Revision: 285580

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

No need to subtract then add Sec->getVA().

Modified:
    lld/trunk/ELF/LinkerScript.cpp

Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=285580&r1=285579&r2=285580&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Mon Oct 31 09:44:41 2016
@@ -361,17 +361,17 @@ void LinkerScript<ELFT>::createSections(
 template <class ELFT>
 static void assignSectionSymbol(SymbolAssignment *Cmd,
                                 OutputSectionBase<ELFT> *Sec,
-                                typename ELFT::uint Off) {
+                                typename ELFT::uint Value) {
   if (!Cmd->Sym)
     return;
 
   if (auto *Body = dyn_cast<DefinedSynthetic<ELFT>>(Cmd->Sym)) {
     Body->Section = Sec;
-    Body->Value = Cmd->Expression(Sec->getVA() + Off) - Sec->getVA();
+    Body->Value = Cmd->Expression(Value) - Sec->getVA();
     return;
   }
   auto *Body = cast<DefinedRegular<ELFT>>(Cmd->Sym);
-  Body->Value = Cmd->Expression(Sec->getVA() + Off);
+  Body->Value = Cmd->Expression(Value);
 }
 
 template <class ELFT> static bool isTbss(OutputSectionBase<ELFT> *Sec) {
@@ -439,7 +439,7 @@ template <class ELFT> void LinkerScript<
       CurOutSec->setSize(Dot - CurOutSec->getVA());
       return;
     }
-    assignSectionSymbol<ELFT>(AssignCmd, CurOutSec, Dot - CurOutSec->getVA());
+    assignSectionSymbol<ELFT>(AssignCmd, CurOutSec, Dot);
     return;
   }
 




More information about the llvm-commits mailing list