summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2016-07-21 16:07:40 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2016-07-21 16:07:40 +0000
commit10e576e1092ffe95f18bdb23b0b6c19d42839501 (patch)
tree6bcf72327cfcadf1ccf1b181a882d975bb68b050
parentaa76a0cf914fe768f0a31b525693abd541b19480 (diff)
downloadbcm5719-llvm-10e576e1092ffe95f18bdb23b0b6c19d42839501.tar.gz
bcm5719-llvm-10e576e1092ffe95f18bdb23b0b6c19d42839501.zip
[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
-rw-r--r--lld/ELF/LinkerScript.cpp20
-rw-r--r--lld/ELF/LinkerScript.h1
2 files changed, 13 insertions, 8 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index bb75a4b12d9..a5712f964d3 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -277,6 +277,17 @@ LinkerScript<ELFT>::createSections(OutputSectionFactory<ELFT> &Factory) {
}
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) {
// Orphan sections are sections present in the input files which
@@ -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;
}
diff --git a/lld/ELF/LinkerScript.h b/lld/ELF/LinkerScript.h
index c4fa455f265..0af38b4a401 100644
--- a/lld/ELF/LinkerScript.h
+++ b/lld/ELF/LinkerScript.h
@@ -121,6 +121,7 @@ private:
int getSectionIndex(StringRef Name);
std::vector<size_t> getPhdrIndicesForSection(StringRef Name);
+ void dispatchAssignment(SymbolAssignment *Cmd);
uintX_t Dot;
};
OpenPOWER on IntegriCloud