[all-commits] [llvm/llvm-project] e7a95b: Reland [ELF] Split scanRelocations into scanReloca...

Fangrui Song via All-commits all-commits at lists.llvm.org
Mon Dec 13 20:11:37 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e7a95b067490dc90faea1baa78a66d08e1b2a7d4
      https://github.com/llvm/llvm-project/commit/e7a95b067490dc90faea1baa78a66d08e1b2a7d4
  Author: Fangrui Song <i at maskray.me>
  Date:   2021-12-13 (Mon, 13 Dec 2021)

  Changed paths:
    M lld/ELF/Relocations.cpp
    M lld/ELF/Relocations.h
    M lld/ELF/Symbols.h
    M lld/ELF/Writer.cpp
    M lld/test/ELF/aarch64-ifunc-bti.s
    M lld/test/ELF/aarch64-thunk-pi.s
    M lld/test/ELF/arm-branch-undef-weak-plt-thunk.s
    M lld/test/ELF/arm-gnu-ifunc.s
    M lld/test/ELF/arm-thumb-interwork-thunk.s
    M lld/test/ELF/bsymbolic.s
    M lld/test/ELF/gnu-ifunc-i386.s
    M lld/test/ELF/ppc32-canonical-plt.s
    M lld/test/ELF/ppc32-ifunc-nonpreemptible-pic.s
    M lld/test/ELF/ppc32-reloc-got.s
    M lld/test/ELF/ppc64-ifunc.s
    M lld/test/ELF/relocation-nocopy.s
    M lld/test/ELF/riscv-reloc-got.s
    M lld/test/ELF/symver.s
    M lld/test/ELF/version-script-symver.s
    M lld/test/ELF/wrap-no-real.s
    M lld/test/ELF/wrap-plt.s
    M lld/test/ELF/x86-64-gotpc-relax-und-dso.s
    M lld/test/ELF/x86-64-plt.s
    M lld/test/ELF/x86-x32-plt.s

  Log Message:
  -----------
  Reland [ELF] Split scanRelocations into scanRelocations/postScanRelocations

(Fixed an issue about GOT on a copy relocated alias.)

The idea is to make scanRelocations mark some actions are needed (GOT/PLT/etc)
and postpone the real work to postScanRelocations. It gives some flexibility:

* Make it feasible to support .plt.got (PR32938): we need to know whether GLOB_DAT and JUMP_SLOT are both needed.
* Make non-preemptible IFUNC handling slightly cleaner: avoid setting/clearing sym.gotInIgot
* -z nocopyrel: report all copy relocation places for one symbol
* Make GOT deduplication feasible
* Make parallel relocation scanning feasible (if we can avoid all stateful operations and make Symbol attributes atomic), but parallelism may not be the appealing choice

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

For ppc32-ifunc-nonpreemptible-pic.s: I remove absolute relocation references to non-preemptible ifunc
because absolute relocation references are incorrect in -fpie mode.

Reviewed By: peter.smith, ikudrin

Differential Revision: https://reviews.llvm.org/D114783




More information about the All-commits mailing list