mirror of
https://github.com/intel/llvm.git
synced 2026-01-19 01:15:50 +08:00
[ELF] - Cleanup of LinkerScript<ELFT>::assignAddresses()
LinkerScript<ELFT>::assignAddresses is becoming larger and looks it can be good time for splitting. I expect to can more SectionsCommand's there, and dispatching some of them separatelly can help to keep method smaller either. Differential revision: https://reviews.llvm.org/D22506 llvm-svn: 276300
This commit is contained in:
@@ -276,6 +276,17 @@ LinkerScript<ELFT>::createSections(OutputSectionFactory<ELFT> &Factory) {
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
void LinkerScript<ELFT>::dispatchAssignment(SymbolAssignment *Cmd) {
|
||||
uint64_t Val = evalExpr(Cmd->Expr, Dot);
|
||||
if (Cmd->Name == ".") {
|
||||
Dot = Val;
|
||||
} else {
|
||||
auto *D = cast<DefinedRegular<ELFT>>(Symtab<ELFT>::X->find(Cmd->Name));
|
||||
D->Value = Val;
|
||||
}
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
void LinkerScript<ELFT>::assignAddresses(
|
||||
ArrayRef<OutputSectionBase<ELFT> *> Sections) {
|
||||
@@ -297,14 +308,7 @@ void LinkerScript<ELFT>::assignAddresses(
|
||||
|
||||
for (const std::unique_ptr<BaseCommand> &Base : Opt.Commands) {
|
||||
if (auto *Cmd = dyn_cast<SymbolAssignment>(Base.get())) {
|
||||
uint64_t Val = evalExpr(Cmd->Expr, Dot);
|
||||
if (Cmd->Name == ".") {
|
||||
|
||||
Dot = Val;
|
||||
} else {
|
||||
auto *D = cast<DefinedRegular<ELFT>>(Symtab<ELFT>::X->find(Cmd->Name));
|
||||
D->Value = Val;
|
||||
}
|
||||
dispatchAssignment(Cmd);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user