[PATCH] D87245: [LLD][ELF] Fix performance of MarkLive::scanEhFrameSection

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 7 15:44:05 PDT 2020


MaskRay added a comment.

Thanks for noting this issue! Were you profiling ld.lld?

Here we are making a little assumption that a FDE's relocations are contiguous. The same assumption is made by InputSections getReloc (called by `EhInputSection::split`), so I think it is fine.
(A more robust approach is to sort relocations by r_offset, but it is cumbersome/slow to do that here as `rels` are raw `Elf*_Rel[a]` records.)



================
Comment at: lld/ELF/MarkLive.cpp:156
+    for (size_t j = firstRelI, end2 = rels.size();
+         (j < end2) && (rels[j].r_offset < pieceEnd); ++j)
+      resolveReloc(eh, rels[j], true);
----------------
parentheses beside && are not needed


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

https://reviews.llvm.org/D87245



More information about the llvm-commits mailing list