[lld] r313076 - Remove Offset from Common.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 12 14:19:09 PDT 2017
Author: rafael
Date: Tue Sep 12 14:19:09 2017
New Revision: 313076
URL: http://llvm.org/viewvc/llvm-project?rev=313076&view=rev
Log:
Remove Offset from Common.
It is not needed since it is always 0.
Modified:
lld/trunk/ELF/LinkerScript.cpp
lld/trunk/ELF/Symbols.cpp
lld/trunk/ELF/Symbols.h
lld/trunk/ELF/SyntheticSections.cpp
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=313076&r1=313075&r2=313076&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Tue Sep 12 14:19:09 2017
@@ -872,7 +872,7 @@ ExprValue LinkerScript::getSymbolValue(c
if (auto *D = dyn_cast<DefinedRegular>(B))
return {D->Section, D->Value, Loc};
if (auto *C = dyn_cast<DefinedCommon>(B))
- return {C->Section, C->Offset, Loc};
+ return {C->Section, 0, Loc};
}
error(Loc + ": symbol not found: " + S);
return 0;
Modified: lld/trunk/ELF/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.cpp?rev=313076&r1=313075&r2=313076&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.cpp (original)
+++ lld/trunk/ELF/Symbols.cpp Tue Sep 12 14:19:09 2017
@@ -103,8 +103,7 @@ static uint64_t getSymVA(const SymbolBod
if (!Config->DefineCommon)
return 0;
auto DC = cast<DefinedCommon>(Body);
- return DC.Section->getParent()->Addr + DC.Section->OutSecOff +
- DC.Offset;
+ return DC.Section->getParent()->Addr + DC.Section->OutSecOff;
}
case SymbolBody::SharedKind: {
auto &SS = cast<SharedSymbol>(Body);
Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=313076&r1=313075&r2=313076&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Tue Sep 12 14:19:09 2017
@@ -172,7 +172,6 @@ public:
// The output offset of this common symbol in the output bss.
// Computed by the writer.
- uint64_t Offset;
uint64_t Size;
BssSection *Section = nullptr;
};
Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=313076&r1=313075&r2=313076&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Tue Sep 12 14:19:09 2017
@@ -65,7 +65,9 @@ std::vector<InputSection *> elf::createC
continue;
Sym->Section = make<BssSection>("COMMON");
- Sym->Offset = Sym->Section->reserveSpace(Sym->Size, Sym->Alignment);
+ size_t Pos = Sym->Section->reserveSpace(Sym->Size, Sym->Alignment);
+ assert(Pos == 0);
+ (void)Pos;
Sym->Section->File = Sym->getFile();
Ret.push_back(Sym->Section);
}
More information about the llvm-commits
mailing list