mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-03-06 01:19:28 +00:00
Remove Offset from Common.
It is not needed since it is always 0. llvm-svn: 313076
This commit is contained in:
parent
80b806bf30
commit
67df57a242
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user