[PATCH] D115993: [ELF] Optimize RelocationSection<ELFT>::writeTo

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 21 09:13:00 PST 2021


MaskRay added inline comments.


================
Comment at: lld/ELF/SyntheticSections.cpp:1668
+  addend = computeAddend();
+  kind = AddendOnly; // Catch errors
 }
----------------
ikudrin wrote:
> And now we have an inconsistency if `kind` was `AddendOnlyWithTargetVA` or `AgainstSymbolWithTargetVA` because `sym` is not `nullptr` and an `assert()` in `computeAddend()` can trigger. Maybe add a new kind `PostComputeRaw` and add `assert`s to `computeAddend()` and `needsDynSymIndex()` to ensure that they are not called after `computeRaw()`?
Every redundant operation costs. We have comprehensive tests so I do not worry much about inconsistency caused problems. Adding `PostComputeRaw` seems to sacrifice too much for the check.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115993



More information about the llvm-commits mailing list