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

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 13 05:23:11 PDT 2017


peter.smith added a comment.

Thanks for the comment, I've put a response inline and hope to update the diff later today.



================
Comment at: ELF/Relocations.cpp:1087
+                                    : PrevIS->OutSecOff + PrevIS->getSize();
+            addThunkSection(OS, ISR, ThunkOff);
+            NeedTrailingTS = false;
----------------
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.


https://reviews.llvm.org/D34689





More information about the llvm-commits mailing list