[PATCH] D113228: [RFC][ELF] Refactor relocation processing

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 4 16:46:27 PDT 2021


MaskRay created this revision.
Herald added subscribers: luke957, s.egerton, simoncook, kbarton, arichardson, nemanjai, emaste.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Current relocation processing does:

  if (the relocation expr belongs to category A)
    do something;
  if (the relocation expr belongs to category B)
    do something;
  if (the relocation expr belongs to category C)
    do something;

This refactor flattens it into

  switch (expr) {
  case R_PC:
  case R_...:
    do something;
  case R_...:
    do something;
  ...
  }

which may potentially improve performance.
In addition, if some architectures have strange logic, we can add a new RelExpr member and make it interrupt less to the generic code.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113228

Files:
  lld/ELF/Arch/AArch64.cpp
  lld/ELF/Arch/PPC64.cpp
  lld/ELF/InputSection.cpp
  lld/ELF/Relocations.cpp
  lld/ELF/Relocations.h
  lld/ELF/Target.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113228.384907.patch
Type: text/x-patch
Size: 30541 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211104/5a9907e8/attachment.bin>


More information about the llvm-commits mailing list