[PATCH] D34689: [LLD][ELF] Pre-create ThunkSections at Target specific intervals

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 13 08:01:22 PDT 2017


ikudrin added inline comments.


================
Comment at: ELF/Relocations.cpp:1087
+                                    : PrevIS->OutSecOff + PrevIS->getSize();
+            addThunkSection(OS, ISR, ThunkOff);
+            NeedTrailingTS = false;
----------------
peter.smith wrote:
> ikudrin wrote:
> > As now you create Thunk sections in advance, it is possible that they stay empty when `ThunkCreator::mergeThunks()` is called. In that case, it might call `getTargetInputSection()` on an empty `ThunkSections`, which, on its turn, calls `front()` on an empty vector `Thunks`.
> I think that with the most recent update I've changed the bit of code in mergeThunks to erase ThunkSections with 0 Thunks. Having said that given that getTargetInputSection() is supposed to be able to return nullptr when there is no target I think it makes sense to return nullptr in ThunkSection::getTargetInputSection() if there are no Thunks.
> 
> I'll aim to update the diff later today.
Oh, you are right. I didn't notice the change. I was playing with a patch from D34634 which was a bit outdated.

Thank you for the work!


https://reviews.llvm.org/D34689





More information about the llvm-commits mailing list