[all-commits] [llvm/llvm-project] cf783b: Reland D114783/D115603 [ELF] Split scanRelocations...

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Dec 14 16:28:53 PST 2021


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

  Changed paths:
    M lld/ELF/Arch/AArch64.cpp
    M lld/ELF/MapFile.cpp
    M lld/ELF/Relocations.cpp
    M lld/ELF/Relocations.h
    M lld/ELF/Symbols.cpp
    M lld/ELF/Symbols.h
    M lld/ELF/SyntheticSections.cpp
    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 D114783/D115603 [ELF] Split scanRelocations into scanRelocations/postScanRelocations

(Fixed an issue about GOT on a copy relocated alias.)
(Fixed an issue about not creating r_addend=0 IRELATIVE for unreferenced non-preemptible ifunc.)

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