[all-commits] [llvm/llvm-project] a05384: [ELF] Make --no-relax disable R_X86_64_GOTPCRELX a...

Fangrui Song via All-commits all-commits at lists.llvm.org
Fri Nov 12 09:47:43 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a05384dc8930cbe967def7c5c4113740838e8fd0
      https://github.com/llvm/llvm-project/commit/a05384dc8930cbe967def7c5c4113740838e8fd0
  Author: Fangrui Song <i at maskray.me>
  Date:   2021-11-12 (Fri, 12 Nov 2021)

  Changed paths:
    M lld/ELF/Arch/X86_64.cpp
    M lld/ELF/Config.h
    M lld/ELF/Driver.cpp
    M lld/ELF/Options.td
    M lld/docs/ReleaseNotes.rst
    M lld/docs/ld.lld.1
    M lld/test/ELF/x86-64-gotpc-relax.s

  Log Message:
  -----------
  [ELF] Make --no-relax disable R_X86_64_GOTPCRELX and R_X86_64_REX_GOTPCRELX GOT optimization

This brings back the original version of D81359.
I have found several use cases now.

* Unlike GNU ld, LLD's relocation processing is one pass. If we decide to
  optimize(relax) R_X86_64_{,REX_}GOTPCRELX, we will suppress GOT generation and
  cannot undo the decision later. Optimizing R_X86_64_REX_GOTPCRELX can usually
  make it easy to hit `relocation R_X86_64_REX_GOTPCRELX out of range` because
  the distance to GOT is usually shorter. Without --no-relax, the user has to
  recompile with `-Wa,-mrelax-relocations=no`.
* The option would help during my investigationg of the root cause of https://git.kernel.org/linus/09e43968db40c33a73e9ddbfd937f46d5c334924
* There is need for relaxation for AArch64 & RISC-V. Implementing this for
  x86-64 improves consistency with little target-specific cost (two-line
  X86_64.cpp change).

Reviewed By: alexander-shaposhnikov

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




More information about the All-commits mailing list