[PATCH] D108924: [lld/mac] Tweak estimateStubsInRangeVA a bit

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 30 10:28:54 PDT 2021


thakis added inline comments.


================
Comment at: lld/MachO/ConcatOutputSection.cpp:173-176
+  for (size_t i = callIdx; i < inputs.size(); i++) {
     InputSection *isec = inputs[i];
     isecEnd = alignTo(isecEnd, isec->align) + isec->getSize();
   }
----------------
oontvoo wrote:
> I must be missing something here but why does this need to be a loop and not simply
> 
> ```
> if (callIdx < inputs.size()) {
>   InputSection *isec = inputs.last();
>    secEnd = alignTo(isecEnd, isec->align) + isec->getSize();
> }
> 
> ```
> 
> IOWs, isecEnd seems to get overridden in each iteration, yes?
> 
> 
> 
> 
Yes, this computes the end address of all sections. After the loop, `isecEnd`points right after where the last section would end up, assuming we don't insert thunk sections anywhere along the way.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108924/new/

https://reviews.llvm.org/D108924



More information about the llvm-commits mailing list