diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index 4ee9e1ba3748..7da00fa42245 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -81,7 +81,7 @@ static bool isUnderSysroot(StringRef Path) { template void LinkerScript::setDot(Expr E, const Twine &Loc, bool InSec) { - uintX_t Val = E(); + uint64_t Val = E(); if (Val < Dot) { if (InSec) error(Loc + ": unable to move location counter backward for: " + @@ -398,7 +398,7 @@ template void LinkerScript::output(InputSection *S) { return; bool IsTbss = isTbss(CurOutSec); - uintX_t Pos = IsTbss ? Dot + ThreadBssOffset : Dot; + uint64_t Pos = IsTbss ? Dot + ThreadBssOffset : Dot; Pos = alignTo(Pos, S->Alignment); S->OutSecOff = Pos - CurOutSec->Addr; Pos += S->getSize(); @@ -555,7 +555,7 @@ void LinkerScript::assignOffsets(OutputSectionCommand *Cmd) { setDot(Cmd->AddrExpr, Cmd->Location); if (Cmd->LMAExpr) { - uintX_t D = Dot; + uint64_t D = Dot; LMAOffset = [=] { return Cmd->LMAExpr() - D; }; } @@ -612,7 +612,7 @@ template void LinkerScript::adjustSectionsBeforeSorting() { // corresponding output section. The bfd linker seems to only create them if // '.' is assigned to, but creating these section should not have any bad // consequeces and gives us a section to put the symbol in. - uintX_t Flags = SHF_ALLOC; + uint64_t Flags = SHF_ALLOC; uint32_t Type = SHT_NOBITS; for (const std::unique_ptr &Base : Opt.Commands) { auto *Cmd = dyn_cast(Base.get()); @@ -784,7 +784,7 @@ void LinkerScript::assignAddresses(std::vector &Phdrs) { assignOffsets(Cmd); } - uintX_t MinVA = std::numeric_limits::max(); + uint64_t MinVA = std::numeric_limits::max(); for (OutputSection *Sec : *OutputSections) { if (Sec->Flags & SHF_ALLOC) MinVA = std::min(MinVA, Sec->Addr); diff --git a/lld/ELF/LinkerScript.h b/lld/ELF/LinkerScript.h index 6d53cf71ce4c..e41e6743995f 100644 --- a/lld/ELF/LinkerScript.h +++ b/lld/ELF/LinkerScript.h @@ -234,6 +234,9 @@ protected: // "ScriptConfig" is a bit too long, so define a short name for it. ScriptConfiguration &Opt = *ScriptConfig; + uint64_t Dot; + uint64_t ThreadBssOffset = 0; + public: bool hasPhdrsCommands() { return !Opt.PhdrsCommands.empty(); } @@ -248,8 +251,6 @@ public: // This is a runner of the linker script. template class LinkerScript final : public LinkerScriptBase { - typedef typename ELFT::uint uintX_t; - public: LinkerScript(); ~LinkerScript(); @@ -297,11 +298,9 @@ private: MemoryRegion *findMemoryRegion(OutputSectionCommand *Cmd, OutputSection *Sec); - uintX_t Dot; std::function LMAOffset; OutputSection *CurOutSec = nullptr; MemoryRegion *CurMemRegion = nullptr; - uintX_t ThreadBssOffset = 0; void switchTo(OutputSection *Sec); void flush(); void output(InputSection *Sec);