[PATCH] D22506: [ELF] - Cleanup of LinkerScript<ELFT>::assignAddresses()
Rafael EspĂndola via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 21 09:12:05 PDT 2016
LGTM
On 21 July 2016 at 12:02, George Rimar <grimar at accesssoftek.com> wrote:
> grimar updated this revision to Diff 64908.
> grimar added a comment.
>
> - Made dispatchAssignment as member to simplify.
>
>
> https://reviews.llvm.org/D22506
>
> Files:
> LinkerScript.cpp
> LinkerScript.h
>
> Index: LinkerScript.h
> ===================================================================
> --- LinkerScript.h
> +++ LinkerScript.h
> @@ -121,6 +121,7 @@
>
> int getSectionIndex(StringRef Name);
> std::vector<size_t> getPhdrIndicesForSection(StringRef Name);
> + void dispatchAssignment(SymbolAssignment *Cmd);
>
> uintX_t Dot;
> };
> Index: LinkerScript.cpp
> ===================================================================
> --- LinkerScript.cpp
> +++ LinkerScript.cpp
> @@ -277,6 +277,17 @@
> }
>
> 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 @@
>
> 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;
> }
>
>
>
More information about the llvm-commits
mailing list