[lld] r329162 - [ELF] - Cleanup. NFCI.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 4 02:39:05 PDT 2018


Author: grimar
Date: Wed Apr  4 02:39:05 2018
New Revision: 329162

URL: http://llvm.org/viewvc/llvm-project?rev=329162&view=rev
Log:
[ELF] - Cleanup. NFCI.

Rename field, added comments.

This is splitted from the D44894. 
Requested to be committed as independent cleanup.

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

Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=329162&r1=329161&r2=329162&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Wed Apr  4 02:39:05 2018
@@ -788,9 +788,9 @@ void LinkerScript::assignOffsets(OutputS
   for (BaseCommand *Base : Sec->SectionCommands) {
     // This handles the assignments to symbol or to the dot.
     if (auto *Cmd = dyn_cast<SymbolAssignment>(Base)) {
-      Cmd->Offset = Dot - Ctx->OutSec->Addr;
+      Cmd->Addr = Dot;
       assignSymbol(Cmd, true);
-      Cmd->Size = Dot - Ctx->OutSec->Addr - Cmd->Offset;
+      Cmd->Size = Dot - Cmd->Addr;
       continue;
     }
 

Modified: lld/trunk/ELF/LinkerScript.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.h?rev=329162&r1=329161&r2=329162&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.h (original)
+++ lld/trunk/ELF/LinkerScript.h Wed Apr  4 02:39:05 2018
@@ -112,11 +112,11 @@ struct SymbolAssignment : BaseCommand {
   // A string representation of this command. We use this for -Map.
   std::string CommandString;
 
-  // This is just an offset of this assignment command in the output section.
-  unsigned Offset;
+  // Address of this assignment command.
+  unsigned Addr;
 
-  // Size of this assignment command. This is usually 0, but if you move '.'
-  // or use a BYTE()-family command, this may be greater than 0."
+  // Size of this assignment command. This is usually 0, but if
+  // you move '.' this may be greater than 0.
   unsigned Size;
 };
 
@@ -200,7 +200,11 @@ struct ByteCommand : BaseCommand {
   std::string CommandString;
 
   Expr Expression;
+
+  // This is just an offset of this assignment command in the output section.
   unsigned Offset;
+
+  // Size of this data command.
   unsigned Size;
 };
 

Modified: lld/trunk/ELF/MapFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/MapFile.cpp?rev=329162&r1=329161&r2=329162&view=diff
==============================================================================
--- lld/trunk/ELF/MapFile.cpp (original)
+++ lld/trunk/ELF/MapFile.cpp Wed Apr  4 02:39:05 2018
@@ -200,7 +200,7 @@ void elf::writeMapFile() {
       }
 
       if (auto *Cmd = dyn_cast<SymbolAssignment>(Base)) {
-        writeHeader(OS, OSec->Addr + Cmd->Offset, Cmd->Size, 1);
+        writeHeader(OS, Cmd->Addr, Cmd->Size, 1);
         OS << Indent8 << Cmd->CommandString << '\n';
         continue;
       }




More information about the llvm-commits mailing list