Remove Offset from Common.
It is not needed since it is always 0.
llvm-svn: 313076
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 3ccc2c9..ebbb8ef 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -872,7 +872,7 @@
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;
diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp
index 6fabb80..08d9eb6 100644
--- a/lld/ELF/Symbols.cpp
+++ b/lld/ELF/Symbols.cpp
@@ -103,8 +103,7 @@
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);
diff --git a/lld/ELF/Symbols.h b/lld/ELF/Symbols.h
index b55e5eb..8cea404 100644
--- a/lld/ELF/Symbols.h
+++ b/lld/ELF/Symbols.h
@@ -172,7 +172,6 @@
// The output offset of this common symbol in the output bss.
// Computed by the writer.
- uint64_t Offset;
uint64_t Size;
BssSection *Section = nullptr;
};
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index 922ad69..ad1ec14 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -65,7 +65,9 @@
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);
}