Index: lld/trunk/ELF/LinkerScript.h =================================================================== --- lld/trunk/ELF/LinkerScript.h +++ lld/trunk/ELF/LinkerScript.h @@ -121,6 +121,7 @@ int getSectionIndex(StringRef Name); std::vector getPhdrIndicesForSection(StringRef Name); + void dispatchAssignment(SymbolAssignment *Cmd); uintX_t Dot; }; Index: lld/trunk/ELF/LinkerScript.cpp =================================================================== --- lld/trunk/ELF/LinkerScript.cpp +++ lld/trunk/ELF/LinkerScript.cpp @@ -277,6 +277,17 @@ } template +void LinkerScript::dispatchAssignment(SymbolAssignment *Cmd) { + uint64_t Val = evalExpr(Cmd->Expr, Dot); + if (Cmd->Name == ".") { + Dot = Val; + } else { + auto *D = cast>(Symtab::X->find(Cmd->Name)); + D->Value = Val; + } +} + +template void LinkerScript::assignAddresses( ArrayRef *> Sections) { // Orphan sections are sections present in the input files which @@ -297,14 +308,7 @@ for (const std::unique_ptr &Base : Opt.Commands) { if (auto *Cmd = dyn_cast(Base.get())) { - uint64_t Val = evalExpr(Cmd->Expr, Dot); - if (Cmd->Name == ".") { - - Dot = Val; - } else { - auto *D = cast>(Symtab::X->find(Cmd->Name)); - D->Value = Val; - } + dispatchAssignment(Cmd); continue; }