diff options
-rw-r--r-- | lld/ELF/LinkerScript.cpp | 2 | ||||
-rw-r--r-- | lld/ELF/Symbols.cpp | 3 | ||||
-rw-r--r-- | lld/ELF/Symbols.h | 1 | ||||
-rw-r--r-- | lld/ELF/SyntheticSections.cpp | 4 |
4 files changed, 5 insertions, 5 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index 3ccc2c9a66e..ebbb8ef3b8f 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -872,7 +872,7 @@ ExprValue LinkerScript::getSymbolValue(const Twine &Loc, StringRef S) { 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 6fabb80c927..08d9eb6774e 100644 --- a/lld/ELF/Symbols.cpp +++ b/lld/ELF/Symbols.cpp @@ -103,8 +103,7 @@ static uint64_t getSymVA(const SymbolBody &Body, int64_t &Addend) { 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 b55e5ebf4e6..8cea404e194 100644 --- a/lld/ELF/Symbols.h +++ b/lld/ELF/Symbols.h @@ -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; }; diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index 922ad696b4b..ad1ec14dc00 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -65,7 +65,9 @@ std::vector<InputSection *> elf::createCommonSections() { 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); } |