[PATCH] D65242: [ELF] More dynamic relocation packing

Vic Yang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 29 20:49:18 PDT 2019


victoryang marked an inline comment as done.
victoryang added inline comments.


================
Comment at: lld/ELF/SyntheticSections.cpp:1784
+      offset = r.r_offset;
+      if (config->isRela) {
+        add(r.r_addend - addend);
----------------
pcc wrote:
> pcc wrote:
> > For non-relative RELA relocations we can generally expect the addend to always be the same (usually 0) so you may want to consider only adding relocations with an addend of 0 to `nonRelativeGroups`. That would let you omit the addend field from these relocations.
> Would it be simpler to only support an addend of 0 here? I reckon that non-zero addends are rare enough that we can just let them be emitted in `ungroupedNonRelatives`.
IMO the code would be actually slightly messier if we do that, because the logic in grouping gets more complicated (i.e. need to check the first item in a group doesn't have non-zero addend.)


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

https://reviews.llvm.org/D65242





More information about the llvm-commits mailing list