[PATCH] D114783: [WIP][ELF] Split scanRelocations into scanRelocations/postScanRelocations

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 30 02:01:42 PST 2021


MaskRay created this revision.
MaskRay added a reviewer: peter.smith.
Herald added subscribers: pengfei, dmgreen, kbarton, arichardson, nemanjai, emaste.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The idea is to make scanRelocations just mark GOT/PLT are needed and let
postScanRelocations do the real work. Arguably the benefit is not large.

- Making it possible to support .plt.got (PR32938): the feature is implementable if the code can know whether GLOB_DAT and JUMP_SLOT are both needed.
- Make non-preemptible IFUNC handling slightly better: avoid setting/clearing sym.gotInIgot

Since this patch moves a large chunk of code out of ELFT templates. My x86-64
executable is actually a few hundred bytes smaller.

We can make copy relocations and canonical PLT entries here as well, then
scanReloc and processRelocAux can avoid the heavylifting code.

Tests are not fixed yet: we build GOT/PLT in the symbol table order,
which may be different from the original order (symbol seen order from relocations).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114783

Files:
  lld/ELF/Relocations.cpp
  lld/ELF/Relocations.h
  lld/ELF/Symbols.h
  lld/ELF/Writer.cpp
  lld/test/ELF/arm-gnu-ifunc.s
  lld/test/ELF/bsymbolic.s
  lld/test/ELF/dynamic-reloc-weak.s
  lld/test/ELF/gnu-ifunc-i386.s
  lld/test/ELF/ppc64-ifunc.s
  lld/test/ELF/symver.s
  lld/test/ELF/wrap-plt.s
  lld/test/ELF/x86-64-plt.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114783.390626.patch
Type: text/x-patch
Size: 23863 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211130/b7ed9b89/attachment.bin>


More information about the llvm-commits mailing list