[ELF] - Cleanup. NFCI.

Rename field, added comments.

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

llvm-svn: 329162
This commit is contained in:
George Rimar 2018-04-04 09:39:05 +00:00
parent e0b4638c6b
commit 4d2740c6ed
3 changed files with 11 additions and 7 deletions

View File

@ -788,9 +788,9 @@ void LinkerScript::assignOffsets(OutputSection *Sec) {
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;
}

View File

@ -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;
};

View File

@ -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;
}