[PATCH] D34956: [ELF] - Store pointer to PT_LOAD instead of pointer to first section (FirstInPtLoad) in OutputSection

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 29 01:47:42 PDT 2017


grimar added inline comments.


================
Comment at: ELF/OutputSections.h:71
+  // section in PT_LOAD.
+  PhdrEntry *Load = nullptr;
 
----------------
ruiu wrote:
> `Load` is not a good name, no? `Phdr` is better.
`Phdr` stands for "program header", there are lot of them, isn't it too generic name ?
We want to store pointer to loadable segment section resides in, so may be `LoadPhdr` or `PtLoad` 
is better ?


================
Comment at: ELF/Writer.cpp:1584-1587
+  OutputSection *First = Cmd->Load ? Cmd->Load->First : nullptr;
   // If the section is not in a PT_LOAD, we just have to align it.
   if (!First)
     return alignTo(Off, Cmd->Alignment);
----------------
ruiu wrote:
> Is it possible that Cmd->Load exists but Cmd->Load->First is null? If not, simplify this to:
> 
>   if (!Cmd->Load)
>     return alignTo(Off, Cmd->Alignment):
Done.


https://reviews.llvm.org/D34956





More information about the llvm-commits mailing list